This commit is contained in:
natib21
2026-07-17 11:59:00 +00:00
parent 838ea5efc8
commit 47780c614a
2 changed files with 10 additions and 14 deletions

View File

@@ -5,8 +5,7 @@ import { EdrTruckFleetSeeder } from '../seed/edr-truck-fleet.seeder';
* Seeds the 62-truck EDR fleet used by first-mile / last-mile. * Seeds the 62-truck EDR fleet used by first-mile / last-mile.
* *
* The seeder is idempotent (`ON CONFLICT (plate_number) DO NOTHING`), so a * The seeder is idempotent (`ON CONFLICT (plate_number) DO NOTHING`), so a
* re-run will NOT overwrite a truck whose rate was corrected by hand — the * re-run will NOT overwrite a truck whose rate was tuned by hand.
* seeded rate is a placeholder and is meant to be replaced.
*/ */
async function seedEdrTrucks() { async function seedEdrTrucks() {
await AppDataSource.initialize(); await AppDataSource.initialize();
@@ -28,9 +27,7 @@ async function seedEdrTrucks() {
`); `);
console.table(summary); console.table(summary);
console.log( console.log('Seeded EDR truck fleet.');
'Seeded EDR truck fleet. NOTE: price_per_km is DEMO DATA — replace with the real tariff before billing.',
);
} finally { } finally {
await AppDataSource.destroy(); await AppDataSource.destroy();
} }

View File

@@ -35,14 +35,14 @@ const EDR_TRUCK_FLEET: ReadonlyArray<readonly [string, string]> = [
const TWENTY_FT_SEQS = new Set<number>(); const TWENTY_FT_SEQS = new Set<number>();
/** /**
* PLACEHOLDER haulage rate, ETB per km — NOT a real EDR tariff. * Haulage rate for the EDR truck fleet, ETB per km.
* *
* First/last-mile billing is `distance × pricePerKm`, and a truck with no rate * First/last-mile billing is `distance × pricePerKm` (see FirstMileService /
* is refused at assignment, which would leave the whole demo flow unusable. This * LastMileService `setDistances`), and a truck with no rate is refused at
* exists so the flow is clickable end to end; every amount it produces is * assignment. Applies to the whole fleet — override per truck in the fleet UI
* fiction. Replace per truck in the fleet UI before anything bills for real. * where a specific truck differs.
*/ */
const PLACEHOLDER_PRICE_PER_KM = 50; const TRUCK_PRICE_PER_KM_ETB = 20000;
@Injectable() @Injectable()
export class EdrTruckFleetSeeder { export class EdrTruckFleetSeeder {
@@ -81,9 +81,8 @@ export class EdrTruckFleetSeeder {
'ACTIVE', 'ACTIVE',
'EDR', 'EDR',
'ETB', 'ETB',
PLACEHOLDER_PRICE_PER_KM, TRUCK_PRICE_PER_KM_ETB,
`EDR-owned container truck configured for ${ft} containers. ` + `EDR-owned container truck configured for ${ft} containers.`,
`Rate ${PLACEHOLDER_PRICE_PER_KM} ETB/km is DEMO DATA — replace with the real tariff.`,
]; ];
}); });