mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 17:38:12 +00:00
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { BaseEntity } from '@edr/api-common';
|
|
import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm';
|
|
import { Contract } from './contract.entity';
|
|
|
|
export const CONTRACT_REVIEW_NOTE_TYPES = [
|
|
'CHANGES_REQUESTED',
|
|
'REJECTION',
|
|
'STAFF_NOTE',
|
|
'CUSTOMER_NOTE',
|
|
'AMENDMENT',
|
|
] as const;
|
|
export type ContractReviewNoteType =
|
|
(typeof CONTRACT_REVIEW_NOTE_TYPES)[number];
|
|
|
|
@Entity({ schema: 'freight', name: 'contract_review_notes' })
|
|
@Index(['contractId'])
|
|
export class ContractReviewNote extends BaseEntity {
|
|
@Column({ name: 'contract_id', type: 'uuid' })
|
|
contractId!: string;
|
|
|
|
@ManyToOne(() => Contract, (c) => c.reviewNotes, { onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'contract_id' })
|
|
contract?: Contract;
|
|
|
|
@Column({ name: 'note_type', type: 'varchar', length: 40 })
|
|
noteType!: ContractReviewNoteType;
|
|
|
|
@Column({ name: 'body', type: 'text' })
|
|
body!: string;
|
|
|
|
@Column({ name: 'author_role', type: 'varchar', length: 20, nullable: true })
|
|
authorRole?: string | null;
|
|
|
|
@Column({ name: 'author_user_id', type: 'uuid', nullable: true })
|
|
authorUserId?: string | null;
|
|
}
|