|
|
@@ -11,7 +11,8 @@ function persist(){writeFileSync(statePath,JSON.stringify(state),{mode:0o600});}
|
|
|
async function parse(path,method='GET',data){const r=await fetch(base+'/parse'+path,{method,headers:{'Content-Type':'application/json','X-Parse-Application-Id':appId,'X-Parse-Master-Key':process.env.XIAOSHU_MASTER_KEY},...(data?{body:JSON.stringify(data)}:{})});const d=await r.json();if(!r.ok)throw Error('Parse '+path.split('?')[0]+': '+(d.error||r.status));return d;}
|
|
|
async function call(path,token,params,allowFailure=false){const r=await fetch(base+'/api/functions/'+path,{method:'POST',headers:{'Content-Type':'application/json','X-Parse-Application-Id':appId},body:JSON.stringify({token,params}),signal:AbortSignal.timeout(60000)});const d=await r.json();if(!allowFailure&&(!r.ok||d.success===false||d.retcode<0))throw Error((params.operation||params.action||path)+': '+(d.message||d.retmsg||d.error||r.status));return {status:r.status,data:d.data??d.result,raw:d};}
|
|
|
const ops=async(operation,params={},allow=false)=>call('xiaoshu/ops/gateway-v3',state.admin.sessionToken,{operation,...params},allow);
|
|
|
-const mutate=(operation,targetId,payload,key=randomUUID(),allow=false)=>ops(operation,{targetId,payload,reason:'发布隔离账户验收',idempotencyKey:key},allow);
|
|
|
+const creditVersions=new Map();
|
|
|
+const mutate=async(operation,targetId,payload,key=randomUUID(),allow=false)=>{let expectedUpdatedAt='';if(operation==='ops/users/adjust-balance'){if(!creditVersions.has(key)){const preview=await ops('ops/users/credit-preview',{objectId:targetId,payload},allow);if(preview.status!==200)return preview;creditVersions.set(key,preview.data.version);}expectedUpdatedAt=creditVersions.get(key);}return ops(operation,{targetId,payload,reason:'发布隔离账户验收',idempotencyKey:key,expectedUpdatedAt},allow);};
|
|
|
const expect=(ok,label)=>{if(!ok)throw Error('Assertion: '+label);console.log('PASS '+label);};
|
|
|
async function user(kind,index,extra={}){const legacyUserId=999000000+(suffix%100000)*10+index;const value=await parse('/users','POST',{username:'enrollment_release_'+suffix+'_'+kind+'_'+index,password,company,identityType:kind,legacyGroupId:kind==='store'?2:kind==='coach'?3:1,legacyUserId,realName:'发布验收'+kind,legacyUserData:{UserID:legacyUserId,GroupID:kind==='store'?2:kind==='coach'?3:1,ParentUserID:0,Purse:0,SilverCoin:0,UserExp:0,UserPoint:0},...extra});state.users.push({...value,legacyUserId,kind});persist();return state.users.at(-1);}
|
|
|
async function installHelper(){const ids=state.users.map(u=>u.legacyUserId),idObjects=state.users.map(u=>u.objectId),path='xiaoshu/system/enrollment-check-'+suffix;
|
|
|
@@ -23,11 +24,15 @@ try{
|
|
|
const store=await user('store',2),coach=await user('coach',3),empty=await user('member',4);
|
|
|
const created=(await mutate('ops/users/create','',{displayName:'发布验收学员',nickname:'发布验收学员',username:'release_member_'+suffix,email:'release_member_'+suffix+'@example.invalid',mobile:'199'+String(suffix).slice(-8),parentUserId:store.legacyUserId,password})).data;
|
|
|
const student={objectId:created.objectId,legacyUserId:Number(created.userId),kind:'created-member'};state.users.push(student);persist();
|
|
|
+ const credit40Created=(await mutate('ops/users/create','',{displayName:'发布验收30分钟学员',nickname:'发布验收30分钟学员',username:'credit40_'+suffix,mobile:'191'+String(suffix).slice(-8),parentUserId:store.legacyUserId,password})).data;
|
|
|
+ const credit40={objectId:credit40Created.objectId,legacyUserId:Number(credit40Created.userId),kind:'created-member'};state.users.push(credit40);persist();
|
|
|
await installHelper();expect(!!created.objectId&&student.legacyUserId>0,'创建学员并关联门店');
|
|
|
const zero=(await ops('ops/course-bindings/options',{studentId:empty.legacyUserId,categoryKey:'word'})).data;expect(!zero.eligible,'零余额开课资格被拒绝');
|
|
|
- for(const account of ['Purse','SilverCoin','UserPoint','UserExp']){const fundKey=randomUUID(),transferKey=randomUUID(),fund={account,amount:10,payMethod:'运营记账'},transfer={account,amount:5,payMethod:'运营记账',direction:'add'};for(let retry=0;retry<2;retry++){await mutate('ops/stores/credit-post',store.objectId,fund,fundKey);await mutate('ops/users/adjust-balance',student.objectId,transfer,transferKey);}}
|
|
|
- const storeAccounts=(await ops('ops/stores/credit-accounts',{objectId:store.objectId})).data;expect(storeAccounts.accounts.every(a=>a.balance===5)&&storeAccounts.transactions.length===8,'总部入账与双边划拨重试不重复记账');
|
|
|
- const accounts=(await ops('ops/users/credit-accounts',{objectId:student.objectId})).data;expect(accounts.accounts.every(a=>a.balance===5),'四类课时门店划拨后学员余额一致');
|
|
|
+ for(const account of ['Purse','SilverCoin','UserPoint','UserExp']){const key=randomUUID();await mutate('ops/stores/credit-post',store.objectId,{account,amount:20,payMethod:'运营记账'},key);await mutate('ops/stores/credit-post',store.objectId,{account,amount:20,payMethod:'运营记账'},key);}
|
|
|
+ for(const account of ['Purse','SilverCoin','UserPoint','UserExp']){const key=randomUUID(),p={account,amount:account==='UserExp'?1:5,payMethod:'运营记账',direction:'add'};await mutate('ops/users/adjust-balance',student.objectId,p,key);await mutate('ops/users/adjust-balance',student.objectId,p,key);}
|
|
|
+ const storeAccounts=(await ops('ops/stores/credit-accounts',{objectId:store.objectId})).data;expect(storeAccounts.accounts.find(a=>a.account==='UserPoint').balance===7.5,'配套划拨门店陪练余额正确,重试不重复记账');
|
|
|
+ const accounts=(await ops('ops/users/credit-accounts',{objectId:student.objectId})).data;expect(accounts.accounts.every(a=>a.balance===({Purse:5,SilverCoin:5,UserExp:1,UserPoint:12.5})[a.account]),'成套充值及独立陪练入账正确');
|
|
|
+ const trialAgain=await mutate('ops/users/adjust-balance',student.objectId,{account:'UserExp',amount:1,payMethod:'运营记账',direction:'add'},randomUUID(),true);expect(trialAgain.status===409,'体验二次授予被拒绝');
|
|
|
const initial=(await ops('ops/course-bindings/options',{studentId:student.legacyUserId,categoryKey:'word'})).data;expect(initial.categories.length===6,'六个新分类来自线上教学标准');
|
|
|
for(const categoryKey of ['primary_writing','middle_writing','high_writing']){const o=(await ops('ops/course-bindings/options',{studentId:student.legacyUserId,categoryKey})).data;expect(o.items.every(i=>i.stageKey===categoryKey.split('_')[0]),categoryKey+' 学阶限制');}
|
|
|
const course=initial.items.find(i=>i.eligible&&!i.alreadyOpened);expect(!!course,'完整目录存在可开内容');
|
|
|
@@ -128,16 +133,41 @@ try{
|
|
|
expect(trace.status===30&&trace.lessonCount===1&&trace.hasReport&&trace.studentReview.score===5&&trace.creditState==='consumed','后台对账显示唯一记录、报告、评价与消费预留');
|
|
|
const afterVersion=(await call('xiaoshu/app/gateway',coach.sessionToken,{action:'app_live_versions',source:'database'})).data;expect(beforeVersion.version!==afterVersion.version,'跨设备更新版本随课堂推进变化');
|
|
|
await mutate('ops/appointments/complete',appointment,{});
|
|
|
- const after=(await ops('ops/users/credit-accounts',{objectId:student.objectId})).data;expect(after.accounts.find(a=>a.account==='SilverCoin').balance===4&&after.accounts.find(a=>a.account==='UserPoint').balance===4,'教师完课与管理员重试只扣一次');
|
|
|
+ const after=(await ops('ops/users/credit-accounts',{objectId:student.objectId})).data;expect(after.accounts.find(a=>a.account==='SilverCoin').balance===4&&after.accounts.find(a=>a.account==='UserPoint').balance===11.5,'教师完课与管理员重试只扣一次');
|
|
|
const a2=(await mutate('ops/appointments/create','',{...draft,bindingId:self.bindingIds[0],startTime:'12:00'})).data.targetIds[0];await mutate('ops/appointments/cancel',a2,{});await mutate('ops/appointments/restore',a2,{});await mutate('ops/appointments/cancel',a2,{});const cancelledCommon=await parse('/classes/CommonModel/'+a2);const cancelledStart=await call('xiaoshu/app/gateway',coach.sessionToken,{action:'e_order_update_v2',status:10,content:JSON.stringify({GeneralID:cancelledCommon.generalId})},true);expect(cancelledStart.status===409,'取消预约禁止开课');
|
|
|
const a3=(await mutate('ops/appointments/create','',{...draft,bindingId:word.bindingIds[0],startTime:'13:00'})).data.targetIds[0],a3Common=await parse('/classes/CommonModel/'+a3);await call('xiaoshu/app/gateway',coach.sessionToken,{action:'e_order_update_v2',status:10,content:JSON.stringify({GeneralID:a3Common.generalId})});
|
|
|
const nextDetail=(await call('xiaoshu/app/gateway',coach.sessionToken,{action:'e_order_detail',id:a3Common.generalId})).data[0];
|
|
|
- const rechargeRace=await Promise.all([mutate('ops/users/adjust-balance',student.objectId,{account:'SilverCoin',amount:1,payMethod:'运营记账',direction:'add'},randomUUID(),true),call('xiaoshu/app/gateway',coach.sessionToken,{...feedback,orderId:a3Common.generalId,expectedUpdatedAt:nextDetail.updatedAt,requestKey:randomUUID()},true)]);expect(rechargeRace.every(r=>r.status===200),'充值与完课并发都成功');
|
|
|
+ const rechargeRace=await Promise.all([mutate('ops/users/adjust-balance',student.objectId,{account:'SilverCoin',amount:1,payMethod:'运营记账',direction:'add'},randomUUID(),true),call('xiaoshu/app/gateway',coach.sessionToken,{...feedback,orderId:a3Common.generalId,expectedUpdatedAt:nextDetail.updatedAt,requestKey:randomUUID()},true)]);if(rechargeRace[0].status===409)rechargeRace[0]=await mutate('ops/users/adjust-balance',student.objectId,{account:'SilverCoin',amount:1,payMethod:'运营记账',direction:'add'});expect(rechargeRace.every(r=>r.status===200),'充值与完课并发,余额版本过期后刷新重试成功');
|
|
|
const concurrentBalance=(await ops('ops/users/credit-accounts',{objectId:student.objectId})).data;expect(concurrentBalance.accounts.find(a=>a.account==='SilverCoin').balance===4,'充值与完课并发余额无覆盖');
|
|
|
const transfer=accounts.transactions.find(t=>t.kind==='transfer'&&t.account==='Purse');await mutate('ops/users/adjust-balance',student.objectId,{account:'Purse',amount:4,payMethod:'运营记账',direction:'deduct',sourceTransactionId:transfer.objectId});
|
|
|
const drafts=['14:00','15:00'].map(startTime=>({...draft,bindingId:word.bindingIds[0],durationMinutes:30,startTime}));const race=await Promise.all(drafts.map(p=>mutate('ops/appointments/create','',p,randomUUID(),true)));expect(race.filter(r=>r.status===200).length===1&&race.filter(r=>r.status===409).length===1,'服务器多连接争抢最后一节课仅一单成功');
|
|
|
const winner=race.find(r=>r.status===200).data.targetIds[0];await mutate('ops/appointments/cancel',winner,{});
|
|
|
const race2=await Promise.all([mutate('ops/appointments/create','',drafts[0],randomUUID(),true),mutate('ops/users/adjust-balance',student.objectId,{account:'Purse',amount:1,payMethod:'运营记账',direction:'deduct',sourceTransactionId:transfer.objectId},randomUUID(),true)]);expect(race2.filter(r=>r.status===200).length===1,'退款和预留并发互斥');
|
|
|
+ // Exact customer recharge/complete scenario through deployed gateways and a separate isolated student.
|
|
|
+ for(const [account,amount] of [['Purse',40],['UserPoint',20]])await mutate('ops/stores/credit-post',store.objectId,{account,amount,payMethod:'运营记账'});
|
|
|
+ const p40={account:'Purse',amount:40,payMethod:'运营记账',direction:'add'},k40=randomUUID();await mutate('ops/users/adjust-balance',credit40.objectId,p40,k40);
|
|
|
+ let a40=(await ops('ops/users/credit-accounts',{objectId:credit40.objectId})).data;expect(a40.accounts.find(a=>a.account==='Purse').balance===40&&a40.accounts.find(a=>a.account==='UserPoint').balance===20,'真实30分钟成套充值40次得到40与20');
|
|
|
+ const b40=(await mutate('ops/course-bindings/save','',{studentId:credit40.legacyUserId,categoryKey:'word',courseIds:[course.courseId]})).data.bindingIds[0];
|
|
|
+ const c40=(await mutate('ops/appointments/create','',{...draft,studentId:credit40.legacyUserId,bindingId:b40,durationMinutes:30,startTime:'20:00'})).data.targetIds[0],g40=(await parse('/classes/CommonModel/'+c40)).generalId;
|
|
|
+ await call('xiaoshu/app/gateway',coach.sessionToken,{action:'e_order_update_v2',status:10,content:JSON.stringify({GeneralID:g40})});
|
|
|
+ await call('xiaoshu/app/gateway',coach.sessionToken,{action:'stu_record_update_v2',orderId:g40,uid:credit40.legacyUserId,batchId:'credit40-round',saveMode:'confirm',expectedVersion:0,requestKey:randomUUID(),addon:JSON.stringify({bindingId:b40,xxqs:[{GeneralID:lessonWords[0].GeneralID,Title:lessonWords[0].Title,check:1}]})});
|
|
|
+ const d40=(await call('xiaoshu/app/gateway',coach.sessionToken,{action:'e_order_detail',id:g40})).data[0],f40={...feedback,orderId:g40,expectedUpdatedAt:d40.updatedAt,requestKey:randomUUID()};
|
|
|
+ await call('xiaoshu/app/gateway',coach.sessionToken,f40);await call('xiaoshu/app/gateway',coach.sessionToken,f40);
|
|
|
+ a40=(await ops('ops/users/credit-accounts',{objectId:credit40.objectId})).data;expect(a40.accounts.find(a=>a.account==='Purse').balance===39&&a40.accounts.find(a=>a.account==='UserPoint').balance===19.5,'真实教师30分钟结课后39与19.5,重复结课不多扣');
|
|
|
+ const h40=(await ops('ops/users/credit-ledger',{objectId:credit40.objectId,pageSize:100})).data;expect(h40.items.flatMap(r=>r.lines).filter(l=>l.kind==='lesson').length===2,'真实课时与陪练完课流水同时生成并关联课次');
|
|
|
+ const badRole=await call('xiaoshu/ops/gateway-v3',coach.sessionToken,{operation:'ops/users/credit-preview',objectId:credit40.objectId,payload:p40},true);expect(badRole.status===403,'陪练无权充值');
|
|
|
+ const correction={account:'Purse',amount:1,direction:'adjust',adjustSign:'deduct',adjustMode:'paired',payMethod:'运营记账',evidence:'隔离历史差错凭据'},beforeCorrection=(await ops('ops/stores/credit-accounts',{objectId:store.objectId})).data.accounts;
|
|
|
+ const correctionKey=randomUUID();await mutate('ops/users/adjust-balance',credit40.objectId,correction,correctionKey);await mutate('ops/users/adjust-balance',credit40.objectId,correction,correctionKey);
|
|
|
+ const corrected=(await ops('ops/users/credit-accounts',{objectId:credit40.objectId})).data;expect(corrected.accounts.find(a=>a.account==='Purse').balance===38&&corrected.accounts.find(a=>a.account==='UserPoint').balance===19,'独立差错调整配套扣回,重试幂等');expect(JSON.stringify((await ops('ops/stores/credit-accounts',{objectId:store.objectId})).data.accounts)===JSON.stringify(beforeCorrection),'独立调整不改变门店库存');
|
|
|
+ const trial40={account:'UserExp',amount:1,direction:'add',payMethod:'运营记账'};const trialRace=await Promise.all([mutate('ops/users/adjust-balance',credit40.objectId,trial40,randomUUID(),true),mutate('ops/users/adjust-balance',credit40.objectId,trial40,randomUUID(),true)]);expect(trialRace.filter(r=>r.status===200).length===1,'真实并发体验发放仅一次成功');
|
|
|
+ const trialSource=(await ops('ops/users/credit-accounts',{objectId:credit40.objectId})).data.transactions.find(t=>t.account==='UserExp'&&t.kind==='transfer');await mutate('ops/users/adjust-balance',credit40.objectId,{...trial40,direction:'deduct',sourceTransactionId:trialSource.objectId});const reissue=await mutate('ops/users/adjust-balance',credit40.objectId,trial40,randomUUID(),true);expect(reissue.status===409,'真实体验退回后仍不可再次发放');
|
|
|
+ const trialOptions=(await ops('ops/course-bindings/options',{studentId:student.legacyUserId,categoryKey:'trial'})).data,trialCourse=trialOptions.items.find(i=>i.eligible&&!i.alreadyOpened);expect(!!trialCourse,'真实体验课程目录可开通');
|
|
|
+ const bt=(await mutate('ops/course-bindings/save','',{studentId:student.legacyUserId,categoryKey:'trial',courseIds:[trialCourse.courseId]})).data.bindingIds[0],trialDraft={...draft,courseId:trialCourse.courseId,bindingId:bt,durationMinutes:60,startTime:'21:00'};
|
|
|
+ const trialAppointments=await Promise.all([mutate('ops/appointments/create','',trialDraft,randomUUID(),true),mutate('ops/appointments/create','',{...trialDraft,startTime:'22:00'},randomUUID(),true)]);expect(trialAppointments.filter(r=>r.status===200).length===1,'真实并发体验预约仅一次成功');
|
|
|
+ const ct=trialAppointments.find(r=>r.status===200).data.targetIds[0];await mutate('ops/appointments/cancel',ct,{});await mutate('ops/appointments/restore',ct,{});expect((await ops('ops/users/credit-accounts',{objectId:student.objectId})).data.accounts.find(a=>a.account==='UserExp').balance===1,'取消体验释放预留,不扣体验余额');
|
|
|
+ const gt=(await parse('/classes/CommonModel/'+ct)).generalId,beforeTrial=(await ops('ops/users/credit-accounts',{objectId:student.objectId})).data.accounts;await call('xiaoshu/app/gateway',coach.sessionToken,{action:'e_order_update_v2',status:10,content:JSON.stringify({GeneralID:gt})});const dt=(await call('xiaoshu/app/gateway',coach.sessionToken,{action:'e_order_detail',id:gt})).data[0],ft={...feedback,orderId:gt,expectedUpdatedAt:dt.updatedAt,requestKey:randomUUID()};await call('xiaoshu/app/gateway',coach.sessionToken,ft);await call('xiaoshu/app/gateway',coach.sessionToken,ft);
|
|
|
+ const afterTrial=(await ops('ops/users/credit-accounts',{objectId:student.objectId})).data.accounts;expect(afterTrial.find(a=>a.account==='UserExp').balance===0&&afterTrial.filter(a=>a.account!=='UserExp').every(a=>a.balance===beforeTrial.find(b=>b.account===a.account).balance),'真实体验结课只扣1次体验,普通课时及陪练不变,重复结课不重复扣减');
|
|
|
+ const mobileLedger=await call('xiaoshu/app/gateway',studentToken,{action:'user_point_list',stype:3,cpage:1,psize:100});expect(mobileLedger.status===200&&mobileLedger.data.length>=2,'学生端回读体验充值与消费流水');
|
|
|
const reconciliation=(await call(state.helper.path,state.admin.sessionToken,{mode:'reconcile'})).data;expect(reconciliation.every(r=>Number(r.balance)===Number(r.ledger)),'门店学员四类余额与流水逐项对账');
|
|
|
const audit=(await call(state.helper.path,state.admin.sessionToken,{mode:'audit'})).data;expect(audit[0].missing===0,'全部课时业务单均有事务审计');
|
|
|
const deletion=await call('xiaoshu/app/gateway',empty.sessionToken,{action:'app_deletion_request',reason:'隔离发布验证注销申请'}),deletionRetry=await call('xiaoshu/app/gateway',empty.sessionToken,{action:'app_deletion_request',reason:'隔离发布验证重复申请'});expect(deletion.data.id===deletionRetry.data.id,'真实注销重复请求幂等');
|
|
|
@@ -173,6 +203,7 @@ const statements=[
|
|
|
['DELETE FROM "CourseAppointment" WHERE "company"=$1 AND "szyh"::text=ANY($2::text[])',[co,texts]],
|
|
|
['DELETE FROM "CommonModel" c USING "CourseBinding" b WHERE c."company"=$1 AND b."company"=$1 AND c."modelId"=58 AND c."itemId"=b."id" AND b."yhid"::text=ANY($2::text[])',[co,texts]],
|
|
|
['DELETE FROM "CourseBinding" WHERE "company"=$1 AND "yhid"::text=ANY($2::text[])',[co,texts]],
|
|
|
+['DELETE FROM "CreditOperation" WHERE company=$1 AND "studentId"=ANY($2::numeric[])',[co,ids]],['DELETE FROM "TrialEligibility" WHERE company=$1 AND "studentId"=ANY($2::numeric[])',[co,ids]],
|
|
|
...['UserExpDomP','UserSIcon','UserExpHis','UserUserPoint'].map(t=>['DELETE FROM "'+t+'" WHERE "company"=$1 AND "userId"=ANY($2::numeric[])',[co,ids]]),
|
|
|
['DELETE FROM "CreditTransaction" WHERE "company"=$1 AND ("storeId"=ANY($2::numeric[]) OR "studentId"=ANY($2::numeric[]))',[co,ids]],
|
|
|
['DELETE FROM "EnrollmentCommand" WHERE "company"=$1 AND "request"->>\'uid\'=ANY($2::text[])',[co,texts]]];
|
|
|
@@ -180,7 +211,7 @@ const ledgerTables=['UserExpDomP','UserSIcon','UserExpHis','UserUserPoint'],acco
|
|
|
const ledger=ledgerTables.map((table,i)=>`SELECT "userId",'${accounts[i]}' AS account,"score" FROM "${table}" WHERE "company"=$1 AND "userId"=ANY($2::numeric[])`).join(' UNION ALL ');
|
|
|
const queries={counts:['SELECT "enrollmentStatus",count(*)::int AS count FROM "CourseBinding" WHERE "company"=$1 GROUP BY "enrollmentStatus"',[co]],
|
|
|
reconcile:[`SELECT u."legacyUserId",ac.account,COALESCE((u."legacyUserData"->>ac.account)::numeric,0) balance,COALESCE(sum(l."score"),0) ledger FROM "_User" u CROSS JOIN unnest(ARRAY['Purse','SilverCoin','UserExp','UserPoint']) ac(account) LEFT JOIN (${ledger}) l ON l."userId"=u."legacyUserId" AND l.account=ac.account WHERE u."objectId"=ANY($3::text[]) GROUP BY u."objectId",u."legacyUserId",ac.account`,[co,ids,objects]],
|
|
|
-audit:[`SELECT count(*)::int AS missing FROM "CreditTransaction" t WHERE t."company"=$1 AND t."operatorId"=$2 AND NOT EXISTS(SELECT 1 FROM "SysLog" s WHERE s."company"=t."company" AND s."sourceKey"='credit:'||t."objectId")`,[co,admin]]};
|
|
|
+audit:[`SELECT count(*)::int AS missing FROM "CreditTransaction" t WHERE t."company"=$1 AND t."operatorId"=$2 AND NOT EXISTS(SELECT 1 FROM "SysLog" s WHERE s."company"=t."company" AND (s."sourceKey"='credit:'||t."objectId" OR s."sourceKey"='credit-operation:'||t."operationId"))`,[co,admin]]};
|
|
|
const code=`async function handler(request,response){try{if(!request.user||request.user.id!==${JSON.stringify(admin)})return response.status(403).json({success:false});const mode=(request.body.params||{}).mode,queries=${JSON.stringify(queries)};if(queries[mode])return response.json({success:true,data:await Psql.query(...queries[mode])});if(mode!=='cleanup')return response.status(400).json({success:false});for(const [sql,args] of ${JSON.stringify(statements)})await Psql.none(sql,args);return response.json({success:true,data:{cleaned:true}});}catch(e){return response.status(500).json({success:false,message:String(e.message),detail:e.detail||'',where:e.where||''});}}`;
|
|
|
new Function(code);return code;
|
|
|
}
|