- Created a new TDocumentEnvelope base type for shared document properties - Refactored TLetterEnvelope to extend from TDocumentEnvelope - Refactored TContractEnvelope to extend from TDocumentEnvelope - Centralized common fields like version tracking, date, and formatting
107 lines
2.0 KiB
TypeScript
107 lines
2.0 KiB
TypeScript
import * as database from "../database/index.js";
|
|
import * as business from "./index.js";
|
|
|
|
/**
|
|
* Base type for common document properties across different document types.
|
|
*/
|
|
export type TDocumentEnvelope<TYPE extends string, FIELDS> = {
|
|
/**
|
|
* Document type identifier
|
|
*/
|
|
type: TYPE;
|
|
|
|
/**
|
|
* Unique identifier for the document
|
|
*/
|
|
id: string;
|
|
|
|
/**
|
|
* Document creation/issuance date as a Unix timestamp
|
|
*/
|
|
date: number;
|
|
|
|
/**
|
|
* Document status in its lifecycle
|
|
*/
|
|
status: string;
|
|
|
|
/**
|
|
* Version information for the document
|
|
*/
|
|
versionInfo: {
|
|
/**
|
|
* Should follow semVer format
|
|
*/
|
|
version: string;
|
|
|
|
/**
|
|
* Type of version (draft vs final)
|
|
*/
|
|
type: "draft" | "final";
|
|
|
|
/**
|
|
* When this version was last modified
|
|
*/
|
|
lastModified?: number;
|
|
|
|
/**
|
|
* Version history for tracking changes
|
|
*/
|
|
history?: {
|
|
version: string;
|
|
modifiedAt: number;
|
|
modifiedBy?: string;
|
|
changeDescription?: string;
|
|
}[];
|
|
};
|
|
|
|
/**
|
|
* Primary language of the document
|
|
*/
|
|
language: string;
|
|
|
|
/**
|
|
* The text displayed at the top of the document, often a greeting or introduction
|
|
*/
|
|
topText?: string;
|
|
|
|
/**
|
|
* The text displayed at the bottom of the document, often a signature or conclusion
|
|
*/
|
|
bottomText?: string;
|
|
|
|
/**
|
|
* Formatting/branding information
|
|
*/
|
|
appearance?: {
|
|
/**
|
|
* URL to the logo to be displayed on the document
|
|
*/
|
|
logoUrl?: string;
|
|
|
|
/**
|
|
* Primary color for document styling
|
|
*/
|
|
accentColor?: string;
|
|
|
|
/**
|
|
* Font family for the document
|
|
*/
|
|
fontFamily?: string;
|
|
};
|
|
|
|
/**
|
|
* References to PDF versions of the document
|
|
*/
|
|
pdf?: business.IPdf;
|
|
|
|
/**
|
|
* PDF attachments are additional PDFs attached to the document
|
|
*/
|
|
pdfAttachments?: business.IPdf[];
|
|
|
|
/**
|
|
* Track document lifecycle actions
|
|
*/
|
|
objectActions?: database.IObjectAction[];
|
|
} & FIELDS; |