Files
evidencija-rezija/app/lib/db-types.ts

50 lines
980 B
TypeScript

import { ObjectId } from "mongodb";
export interface BillAttachment {
fileName: string;
fileSize: number;
fileType: string;
fileLastModified: number;
fileContentsBase64: string;
};
/** Bill basic data */
export interface LocationBase {
name: string;
/** the value is encoded as yyyymm (i.e. 202301) */
yearMonth: number;
};
/** bill object in the form returned by MongoDB */
export interface MongoLocation {
_id: ObjectId;
bills: MongoBill[];
};
/** plain-object Location version */
export interface PlainLocation {
id: string;
bills: PlainBill[];
};
/** Bill basic data */
export interface BillBase {
name: string;
paid: boolean;
attachment?: BillAttachment|null;
notes?: string|null;
};
/** bill object in the form returned by MongoDB */
export interface MongoBill extends BillBase {
_id: ObjectId;
};
/** plain-object bill version */
export interface PlainBill extends BillBase {
id: string;
};