fix some bug
This commit is contained in:
+15
-7
@@ -8674,9 +8674,9 @@ __name(_hash, "_hash");
|
||||
// prisma/seed.ts
|
||||
var prisma = new import_client.PrismaClient();
|
||||
async function main() {
|
||||
const existingAdmins = await prisma.adminUser.count();
|
||||
if (existingAdmins > 0 && process.env.RUN_SEED !== "force") {
|
||||
console.log("Seed skipped; admin users already exist");
|
||||
const existingOrders = await prisma.order.count();
|
||||
if (existingOrders > 0 && process.env.RUN_SEED !== "force") {
|
||||
console.log("Seed skipped; data already exists");
|
||||
return;
|
||||
}
|
||||
console.log("Seeding fabric_trade database...");
|
||||
@@ -9123,7 +9123,9 @@ async function main() {
|
||||
productCode: "377-BL",
|
||||
color: "\u0622\u0628\u06CC",
|
||||
requestedMeterage: 2e3,
|
||||
confirmedMeterage: 2e3
|
||||
confirmedMeterage: 2e3,
|
||||
companyId: "company-par",
|
||||
companyName: "\u0634\u0631\u06A9\u062A \u067E\u064E\u0631"
|
||||
},
|
||||
{
|
||||
id: "oi-2",
|
||||
@@ -9133,7 +9135,9 @@ async function main() {
|
||||
productCode: "377-BK",
|
||||
color: "\u0645\u0634\u06A9\u06CC",
|
||||
requestedMeterage: 1500,
|
||||
confirmedMeterage: 1e3
|
||||
confirmedMeterage: 1e3,
|
||||
companyId: "company-par",
|
||||
companyName: "\u0634\u0631\u06A9\u062A \u067E\u064E\u0631"
|
||||
},
|
||||
{
|
||||
id: "oi-3",
|
||||
@@ -9143,7 +9147,9 @@ async function main() {
|
||||
productCode: "378-BLW",
|
||||
color: "\u0622\u0628\u06CC \u067E\u0634\u062A \u0633\u0641\u06CC\u062F",
|
||||
requestedMeterage: 750,
|
||||
confirmedMeterage: 750
|
||||
confirmedMeterage: 750,
|
||||
companyId: "company-par",
|
||||
companyName: "\u0634\u0631\u06A9\u062A \u067E\u064E\u0631"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -9213,7 +9219,9 @@ async function main() {
|
||||
requestedMeterage: 3200,
|
||||
confirmedMeterage: 3200,
|
||||
unitPrice: 25e4,
|
||||
lineTotal: 8e8
|
||||
lineTotal: 8e8,
|
||||
companyId: "company-fam-baft",
|
||||
companyName: "\u0641\u0627\u0645\u200C\u0628\u0627\u0641\u062A"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
+14
-7
@@ -140206,18 +140206,23 @@ var require_run_seed = __commonJS({
|
||||
console.log("No runtime/seed.cjs; skipping seed");
|
||||
return Promise.resolve();
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise((resolve) => {
|
||||
const child = (0, node_child_process_1.spawn)(process.execPath, [seedFile], {
|
||||
stdio: "inherit",
|
||||
env: process.env
|
||||
});
|
||||
child.on("exit", (code) => {
|
||||
if (code === 0)
|
||||
if (code === 0) {
|
||||
resolve();
|
||||
else
|
||||
reject(new Error(`seed exited ${code}`));
|
||||
return;
|
||||
}
|
||||
console.error(`Seed failed (${code}); API will still start`);
|
||||
resolve();
|
||||
});
|
||||
child.on("error", (err) => {
|
||||
console.error("Seed error; API will still start", err);
|
||||
resolve();
|
||||
});
|
||||
child.on("error", reject);
|
||||
});
|
||||
}
|
||||
__name(runBundledSeed, "runBundledSeed");
|
||||
@@ -140236,13 +140241,15 @@ var run_seed_1 = require_run_seed();
|
||||
async function bootstrap() {
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
await (0, apply_migrations_1.applyPendingMigrations)();
|
||||
await (0, run_seed_1.runBundledSeed)();
|
||||
if (process.env.RUN_SEED === "true" || process.env.RUN_SEED === "force") {
|
||||
await (0, run_seed_1.runBundledSeed)();
|
||||
}
|
||||
}
|
||||
const app = await core_1.NestFactory.create(app_module_1.AppModule);
|
||||
const bodyLimit = process.env.BODY_LIMIT || "25mb";
|
||||
app.use((0, express_1.json)({ limit: bodyLimit }));
|
||||
app.use((0, express_1.urlencoded)({ extended: true, limit: bodyLimit }));
|
||||
const globalPrefix = process.env.GLOBAL_PREFIX || "api";
|
||||
const globalPrefix = process.env.GLOBAL_PREFIX || "server/api";
|
||||
app.setGlobalPrefix(globalPrefix);
|
||||
app.enableCors({
|
||||
origin: true,
|
||||
|
||||
Reference in New Issue
Block a user