fix(passenger-api): fix seed TypeScript errors for dev

This commit is contained in:
Abubeker Yasin
2026-06-08 11:35:12 +03:00
committed by Abubeker
parent 72f8441a2b
commit f5c9a72521
3 changed files with 15 additions and 11 deletions

View File

@@ -147,9 +147,9 @@ async function seedCoachTypesAndClasses() {
for (const ct of coachTypes) {
await prisma.coachType.upsert({
where: { code: ct.code },
where: { id: ct.code },
update: {},
create: ct,
create: { ...ct, id: ct.code },
});
}
@@ -161,7 +161,7 @@ async function seedCoachTypesAndClasses() {
];
for (const sc of seatClasses) {
const ct = await prisma.coachType.findUnique({ where: { code: sc.coachCode } });
const ct = await prisma.coachType.findUnique({ where: { id: sc.coachCode } });
await prisma.seatClass.upsert({
where: { coachTypeId_name: { coachTypeId: ct!.id, name: sc.name } },
update: {},
@@ -204,9 +204,9 @@ async function seedRoute() {
async function seedCoaches() {
console.log('\n🚃 Seeding coaches and seats...');
const ecoCoachType = await prisma.coachType.findUnique({ where: { code: 'ECO' } });
const ecoBedCoachType = await prisma.coachType.findUnique({ where: { code: 'ECO_BED' } });
const vipBedCoachType = await prisma.coachType.findUnique({ where: { code: 'VIP_BED' } });
const ecoCoachType = await prisma.coachType.findUnique({ where: { id: 'ECO' } });
const ecoBedCoachType = await prisma.coachType.findUnique({ where: { id: 'ECO_BED' } });
const vipBedCoachType = await prisma.coachType.findUnique({ where: { id: 'VIP_BED' } });
const coaches = [
{ number: 'C-001', coachTypeId: ecoCoachType!.id, arrangement: '2+2', capacity: 48 },
@@ -330,7 +330,7 @@ async function seedFareRules() {
fareRules.push({
routeId: route!.id,
seatClassId: sc.id,
passengerCategory: 'ADULT',
passengerCategory: 'ADULT' as const,
baseFareMinor: sc.baseFareMinor,
currency: 'ETB',
validFrom,
@@ -338,7 +338,7 @@ async function seedFareRules() {
fareRules.push({
routeId: route!.id,
seatClassId: sc.id,
passengerCategory: 'CHILD',
passengerCategory: 'CHILD' as const,
baseFareMinor: Math.floor(sc.baseFareMinor * 0.5),
discountPercent: 50,
currency: 'ETB',
@@ -396,7 +396,7 @@ async function seedPaymentMethods() {
await prisma.paymentMethod.upsert({
where: { type: m.type as any },
update: {},
create: m,
create: { ...m, type: m.type as any, region: m.region as any },
});
}
console.log(`${methods.length} payment methods created`);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long