mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 12:58:13 +00:00
fix issues
This commit is contained in:
@@ -319,37 +319,11 @@ private async seedWeightLimits(wlRepo: any, ctRepo: any): Promise<void> {
|
||||
const twenty = await ctRepo.findOneByOrFail({ code: "20FT" });
|
||||
const forty = await ctRepo.findOneByOrFail({ code: "40FT" });
|
||||
|
||||
const base = new Date("2026-01-01");
|
||||
|
||||
const rules = [
|
||||
{
|
||||
containerTypeId: twenty.id,
|
||||
tradeDirection: "IMPORT",
|
||||
maxVgmTons: 26,
|
||||
effectiveFrom: base,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
containerTypeId: twenty.id,
|
||||
tradeDirection: "EXPORT",
|
||||
maxVgmTons: 26,
|
||||
effectiveFrom: base,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
containerTypeId: forty.id,
|
||||
tradeDirection: "IMPORT",
|
||||
maxVgmTons: 28,
|
||||
effectiveFrom: base,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
containerTypeId: forty.id,
|
||||
tradeDirection: "EXPORT",
|
||||
maxVgmTons: 28,
|
||||
effectiveFrom: base,
|
||||
isActive: true,
|
||||
},
|
||||
{ containerTypeId: twenty.id, tradeDirection: "IMPORT", maxVgmTons: 26 },
|
||||
{ containerTypeId: twenty.id, tradeDirection: "EXPORT", maxVgmTons: 26 },
|
||||
{ containerTypeId: forty.id, tradeDirection: "IMPORT", maxVgmTons: 28 },
|
||||
{ containerTypeId: forty.id, tradeDirection: "EXPORT", maxVgmTons: 28 },
|
||||
];
|
||||
|
||||
for (const rule of rules) {
|
||||
@@ -361,10 +335,7 @@ private async seedWeightLimits(wlRepo: any, ctRepo: any): Promise<void> {
|
||||
});
|
||||
|
||||
if (existing) {
|
||||
await wlRepo.update(existing.id, {
|
||||
maxVgmTons: rule.maxVgmTons,
|
||||
effectiveFrom: rule.effectiveFrom,
|
||||
});
|
||||
await wlRepo.update(existing.id, { maxVgmTons: rule.maxVgmTons });
|
||||
} else {
|
||||
await wlRepo.insert(rule);
|
||||
}
|
||||
@@ -409,7 +380,6 @@ private async seedWeightLimits(wlRepo: any, ctRepo: any): Promise<void> {
|
||||
ctByCode: Map<string, any>,
|
||||
cargoByCode: Map<string, any>,
|
||||
): Promise<Rate[]> {
|
||||
const effectiveFrom = new Date("2026-01-01");
|
||||
const now = new Date();
|
||||
|
||||
// Each rate is self-describing: `appliesTo` + `trigger` decide how the
|
||||
@@ -479,7 +449,6 @@ private async seedWeightLimits(wlRepo: any, ctRepo: any): Promise<void> {
|
||||
proposedByStaffId: STAFF_USER_ID,
|
||||
approvedByCeoId: CEO_USER_ID,
|
||||
approvedAt: now,
|
||||
effectiveFrom,
|
||||
}))
|
||||
.filter((d) => !existingBySignature.has(signature(d)));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user