You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
880 B
34 lines
880 B
/**
|
|
* 将历史已成功导入的工单/DO/转仓指令补写入 /logs 导入日志。
|
|
* Usage: pnpm exec tsx scripts/backfill-instruction-import-logs.ts
|
|
* pnpm exec tsx scripts/backfill-instruction-import-logs.ts --dry-run
|
|
*/
|
|
import { backfillInstructionImportLogs } from "../src/services/import/instruction-import-log";
|
|
import { prisma } from "../src/services/db";
|
|
|
|
async function main() {
|
|
const dryRun = process.argv.includes("--dry-run");
|
|
const result = await backfillInstructionImportLogs({ dryRun });
|
|
console.log(
|
|
JSON.stringify(
|
|
{
|
|
dryRun,
|
|
scannedMails: result.scannedMails,
|
|
created: result.created,
|
|
skipped: result.skipped,
|
|
},
|
|
null,
|
|
2,
|
|
),
|
|
);
|
|
}
|
|
|
|
main()
|
|
.catch((err) => {
|
|
console.error(err);
|
|
process.exitCode = 1;
|
|
})
|
|
.finally(async () => {
|
|
await prisma.$disconnect();
|
|
});
|