mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 08:32:54 +00:00
feat(rule-engine): add yard_locations table, seed 5 facility yard GPS coords
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { BaseEntity } from '@edr/api-common';
|
||||
import { Column, Entity, Index, JoinColumn, OneToOne } from 'typeorm';
|
||||
|
||||
import { Yard } from './yard.entity';
|
||||
|
||||
/**
|
||||
* GPS position of a yard (decimal degrees, WGS84). One record per yard;
|
||||
* today only the five facility yards (Sebeta, GMP/Indode, Mojo, Adama,
|
||||
* Dire Dawa) are seeded.
|
||||
*/
|
||||
@Entity({ schema: 'freight', name: 'yard_locations' })
|
||||
@Index(['yardId'], { unique: true })
|
||||
export class YardLocation extends BaseEntity {
|
||||
@Column({ name: 'yard_id', type: 'uuid' })
|
||||
yardId!: string;
|
||||
|
||||
@OneToOne(() => Yard, { nullable: false, onDelete: 'CASCADE' })
|
||||
@JoinColumn({ name: 'yard_id' })
|
||||
yard?: Yard;
|
||||
|
||||
@Column({ name: 'latitude', type: 'double precision' })
|
||||
latitude!: number;
|
||||
|
||||
@Column({ name: 'longitude', type: 'double precision' })
|
||||
longitude!: number;
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import { WeightLimitRule } from './entities/weight-limit-rule.entity';
|
||||
import { Yard } from './entities/yard.entity';
|
||||
import { YardDistance } from './entities/yard-distance.entity';
|
||||
import { YardFacility } from './entities/yard-facility.entity';
|
||||
import { YardLocation } from './entities/yard-location.entity';
|
||||
|
||||
import { APPROVAL_RULES_REPOSITORY } from './interfaces/approval-rules.repository.interface';
|
||||
import { CARGO_TYPES_REPOSITORY } from './interfaces/cargo-types.repository.interface';
|
||||
@@ -88,6 +89,7 @@ import { BookingRateSnapshot } from '../bookings/entities/booking-rate-snapshot.
|
||||
Yard,
|
||||
YardDistance,
|
||||
YardFacility,
|
||||
YardLocation,
|
||||
ShippingLine,
|
||||
Rate,
|
||||
ApprovalRule,
|
||||
|
||||
Reference in New Issue
Block a user