mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 03:40:56 +00:00
27 lines
820 B
TypeScript
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;
|
|
}
|