Files
edr-platform/apps/edr-freight-api/src/modules/rule-engine/entities/yard-location.entity.ts

27 lines
820 B
TypeScript

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;
}