mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 21:15:41 +00:00
65 lines
1.9 KiB
TypeScript
65 lines
1.9 KiB
TypeScript
import { BaseEntity } from '@edr/api-common';
|
|
import { Column, Entity, Index, OneToMany } from 'typeorm';
|
|
import { ExternalProfile } from './external-profile.entity';
|
|
|
|
export enum CompanyType {
|
|
Customer = 'customer',
|
|
Forwarder = 'forwarder',
|
|
Transporter = 'transporter',
|
|
Broker = 'broker',
|
|
}
|
|
|
|
export enum CompanyStatus {
|
|
Active = 'active',
|
|
Pending = 'pending',
|
|
Suspended = 'suspended',
|
|
Blacklisted = 'blacklisted',
|
|
}
|
|
|
|
@Entity({ schema: 'freight', name: 'companies' })
|
|
@Index(['tin'])
|
|
@Index(['type'])
|
|
export class Company extends BaseEntity {
|
|
@Column({ name: 'name', type: 'varchar', length: 200 })
|
|
name!: string;
|
|
|
|
@Column({ name: 'type', type: 'varchar', length: 32, enum: CompanyType })
|
|
type!: CompanyType;
|
|
|
|
@Column({ name: 'status', type: 'varchar', length: 32, default: CompanyStatus.Pending })
|
|
status!: CompanyStatus;
|
|
|
|
@Column({ name: 'tin', type: 'varchar', length: 10, unique: true })
|
|
tin!: string;
|
|
|
|
@Column({ name: 'vat_number', type: 'varchar', length: 50, nullable: true })
|
|
vatNumber?: string | null;
|
|
|
|
@Column({ name: 'business_license', type: 'varchar', length: 100, nullable: true })
|
|
businessLicense?: string | null;
|
|
|
|
@Column({ name: 'fan_number', type: 'varchar', length: 16, nullable: true })
|
|
fanNumber?: string | null;
|
|
|
|
@Column({ name: 'country', type: 'varchar', length: 32, default: 'Ethiopia' })
|
|
country!: string;
|
|
|
|
@Column({ name: 'address', type: 'text', nullable: true })
|
|
address?: string | null;
|
|
|
|
@Column({ name: 'phone', type: 'varchar', length: 20, nullable: true })
|
|
phone?: string | null;
|
|
|
|
@Column({ name: 'email', type: 'varchar', length: 150, nullable: true })
|
|
email?: string | null;
|
|
|
|
@Column({ name: 'website', type: 'varchar', length: 200, nullable: true })
|
|
website?: string | null;
|
|
|
|
@Column({ name: 'attributes', type: 'jsonb', nullable: true })
|
|
attributes?: Record<string, any> | null;
|
|
|
|
@OneToMany(() => ExternalProfile, (profile) => profile.company)
|
|
profiles?: ExternalProfile[];
|
|
}
|