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.
38 lines
1012 B
38 lines
1012 B
import { prisma } from "../src/services/db";
|
|
import { ParsePipeline } from "../src/services/parse/pipeline";
|
|
|
|
async function main() {
|
|
const id = BigInt(process.argv[2] || "258");
|
|
await prisma.mailMessage.update({
|
|
where: { id },
|
|
data: { status: "PARSING", version: { increment: 1 } },
|
|
});
|
|
await ParsePipeline.run(id);
|
|
const mail = await prisma.mailMessage.findUnique({
|
|
where: { id },
|
|
include: { parseResult: true },
|
|
});
|
|
const shipments = (mail?.parseResult?.shipments as Array<{ row_status?: string }>) || [];
|
|
console.log(
|
|
JSON.stringify(
|
|
{
|
|
id: Number(id),
|
|
status: mail?.status,
|
|
mailType: mail?.mailType,
|
|
lastError: mail?.lastError,
|
|
validRows: shipments.filter((s) => s.row_status === "VALID").length,
|
|
totalRows: shipments.length,
|
|
header: mail?.parseResult?.containerHeader,
|
|
},
|
|
null,
|
|
2,
|
|
),
|
|
);
|
|
await prisma.$disconnect();
|
|
}
|
|
|
|
main().catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
});
|