"use strict";(()=>{var e={};e.id=3338,e.ids=[3338],e.modules={76102:e=>{e.exports=require("@moduletrace/datasquirel/dist/client")},39383:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/actions/users/user-auth")},65967:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/utils/ejson")},93726:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/utils/numberfy")},30889:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/utils/slugify")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},9973:e=>{e.exports=require("serverless-mysql")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,s)=>{Object.defineProperty(s,"M",{enumerable:!0,get:function(){return function e(s,r){return r in s?s[r]:"then"in s&&"function"==typeof s.then?s.then(s=>e(s,r)):"function"==typeof s&&"default"===r?s:void 0}}})},670:(e,s,r)=>{r.r(s),r.d(s,{config:()=>p,default:()=>d,routeModule:()=>L});var o={};r.r(o),r.d(o,{default:()=>l});var t=r(89947),n=r(2706),_=r(96762),a=r(29021),i=r.n(a),c=r(48786),S=r(69842),u=r(33873),D=r.n(u);async function l(e,s){if("POST"!==e.method)return s.json({msg:"Failed!"});let{user:r}=await (0,S.A)(e,s,!0);if(!r)return s.json({success:!1,msg:"Unauthorized"});let{paradigm:o,payload:t}=e.body;try{console.log("Deleting media =>",t.id);let e=t.media_url,r=process.env.DSQL_STATIC_SERVER_DIR,o=process.env.DSQL_STATIC_HOST;if(!r){console.log("No Static Root Path"),s.json({success:!1,msg:"No Static Root Path"});return}let n=e.replace(o,""),_=D().join(r,n),a=i().existsSync(_);if(console.log("relativePath",n),console.log("STATIC_ROOT",r),console.log("STATIC_HOST",o),console.log("filePath",_),console.log("fileExist",a),a){s.json({success:!1});return}}catch(e){console.log("File verification Error =>",e.message),console.log("File Truly doesn't exist, cotinuing ...")}"user_media"===o&&await (0,c.A)(`DELETE FROM user_media WHERE id='${t.id}'`),s.json({success:!0})}let d=(0,_.M)(o,"default"),p=(0,_.M)(o,"config"),L=new t.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/purgeDb",pathname:"/api/purgeDb",bundlePath:"",filename:""},userland:o})},55153:(e,s,r)=>{r.d(s,{On:()=>t.a,_n:()=>_}),r(76102);var o=r(65967),t=r.n(o);r(30889);var n=r(93726);let _=r.n(n)()},69842:(e,s,r)=>{r.d(s,{A:()=>_});var o=r(39383),t=r.n(o),n=r(55153);async function _(e,s,r,o){let _=t()({req:e,level:r?"deep":void 0}),a={DSQL_REMOTE_SQL_HOST:process.env.DSQL_REMOTE_SQL_HOST,DSQL_SU_USER_ID:process.env.DSQL_SU_USER_ID,DSQL_HOST_ENV:process.env.DSQL_HOST_ENV,DSQL_HOST:process.env.DSQL_HOST,DSQL_STATIC_HOST:process.env.DSQL_STATIC_HOST,DSQL_GOOGLE_CLIENT_ID:process.env.DSQL_GOOGLE_CLIENT_ID,DSQL_TINY_MCE_API_KEY:process.env.DSQL_TINY_MCE_API_KEY};return o&&_.payload?.id&&(0,n._n)(process.env.DSQL_SU_USER_ID)!==_.payload.id?{user:null,appData:a}:{user:_.payload,appData:a}}},48786:(e,s,r)=>{r.d(s,{A:()=>t});var o=r(7447);async function t(...e){let s=(0,o.A)();try{if(!s)throw Error("No Connection provided to DB_HANDLER function!");let r=await s.query(...e);return JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await s?.end()}}},7447:(e,s,r)=>{r.d(s,{A:()=>n});var o=r(9973),t=r.n(o);function n(e){return global.DSQL_USE_LOCAL||e?.local?global.DSQL_DB_CONN||t()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.ro?global.DSQL_READ_ONLY_DB_CONN||t()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.fa?global.DSQL_FULL_ACCESS_DB_CONN||t()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):global.DSQL_DB_CONN||t()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}})}},2706:(e,s)=>{Object.defineProperty(s,"A",{enumerable:!0,get:function(){return r}});var r=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,s,r)=>{e.exports=r(75600)}};var s=require("../../webpack-api-runtime.js");s.C(e);var r=s(s.s=670);module.exports=r})();