This commit is contained in:
marshal
2026-07-01 20:55:17 +03:00
parent 612df8daff
commit 9c18d086d7
112 changed files with 5654 additions and 1370 deletions

View File

@@ -468,15 +468,15 @@ export class DemoBookingsSeeder {
const djibouti = yardByCode.get("DJIBOUTI");
const addis = yardByCode.get("ADDIS_ABABA");
if (djibouti && addis) {
const routeName = "Djibouti → Addis Ababa";
let route = await manager.getRepository(Route).findOneBy({ name: routeName });
let route = await manager.getRepository(Route).findOne({
where: { originYardId: djibouti.id, destinationYardId: addis.id },
});
if (!route) {
route = await manager.getRepository(Route).save(
manager.getRepository(Route).create({
name: routeName,
originYardId: djibouti.id,
destinationYardId: addis.id,
isActive: true,
status: 'AVAILABLE',
}),
);
await manager.getRepository(RouteMilestone).save([
@@ -484,11 +484,13 @@ export class DemoBookingsSeeder {
routeId: route.id,
yardId: djibouti.id,
sequenceNo: 1,
distanceKm: 0,
}),
manager.getRepository(RouteMilestone).create({
routeId: route.id,
yardId: addis.id,
sequenceNo: 2,
distanceKm: 780,
}),
]);
}

View File

@@ -286,15 +286,15 @@ export class PricingDataSeeder {
const routeRepo = manager.getRepository(Route);
const milestoneRepo = manager.getRepository(RouteMilestone);
const routeName = "Addis Ababa → Dire Dawa";
let route = await routeRepo.findOneBy({ name: routeName });
let route = await routeRepo.findOne({
where: { originYardId: addis.id, destinationYardId: direDawa.id },
});
if (!route) {
route = await routeRepo.save(
routeRepo.create({
name: routeName,
originYardId: addis.id,
destinationYardId: direDawa.id,
isActive: true,
status: 'AVAILABLE',
}),
);
await milestoneRepo.save([
@@ -302,11 +302,13 @@ export class PricingDataSeeder {
routeId: route.id,
yardId: addis.id,
sequenceNo: 1,
distanceKm: 0,
}),
milestoneRepo.create({
routeId: route.id,
yardId: direDawa.id,
sequenceNo: 2,
distanceKm: 445,
}),
]);
this.logger.log("Seeded domestic route Addis Ababa → Dire Dawa");