mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 23:28:11 +00:00
changes
This commit is contained in:
@@ -42,6 +42,43 @@ export const CONTRACT_STATUSES = [
|
||||
|
||||
export type ContractStatus = (typeof CONTRACT_STATUSES)[number];
|
||||
|
||||
/** One article on a per-contract document snapshot (mirrors the template shape). */
|
||||
export interface ContractDocumentArticle {
|
||||
id: string;
|
||||
title: string;
|
||||
body: string;
|
||||
order: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A per-contract copy of the resolved contract-document template, frozen when
|
||||
* staff accept the contract for approval. Staff may edit these articles for a
|
||||
* single contract in the accept/edit dialog — editing NEVER writes back to the
|
||||
* shared six {@link ContractTemplate} rows. The PDF is rendered from this
|
||||
* snapshot when present; a null snapshot renders from the live template.
|
||||
*/
|
||||
export interface ContractDocumentSnapshot {
|
||||
code?: string | null;
|
||||
name?: string | null;
|
||||
documentTitle?: string | null;
|
||||
whereasClauses: string[];
|
||||
articles: ContractDocumentArticle[];
|
||||
}
|
||||
|
||||
/** Loose inbound shape (article ids/order optional) — normalized before store. */
|
||||
export interface ContractDocumentSnapshotInput {
|
||||
code?: string | null;
|
||||
name?: string | null;
|
||||
documentTitle?: string | null;
|
||||
whereasClauses?: string[];
|
||||
articles?: Array<{
|
||||
id?: string;
|
||||
title?: string;
|
||||
body?: string;
|
||||
order?: number;
|
||||
}>;
|
||||
}
|
||||
|
||||
export const CONTRACT_KINDS = ['ONE_TIME', 'GENERAL'] as const;
|
||||
export type ContractKindValue = (typeof CONTRACT_KINDS)[number];
|
||||
|
||||
@@ -193,6 +230,14 @@ export class Contract extends BaseEntity {
|
||||
@Column({ name: 'contract_generated_at', type: 'timestamptz', nullable: true })
|
||||
contractGeneratedAt?: Date | null;
|
||||
|
||||
/**
|
||||
* Per-contract frozen copy of the document template (articles + WHEREAS),
|
||||
* captured at staff accept. Editing it affects only this contract, never the
|
||||
* shared six templates. Null → the PDF renders from the live template.
|
||||
*/
|
||||
@Column({ name: 'document_snapshot', type: 'jsonb', nullable: true })
|
||||
documentSnapshot?: ContractDocumentSnapshot | null;
|
||||
|
||||
@Column({ name: 'contract_summary', type: 'text', nullable: true })
|
||||
contractSummary?: string | null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user