api entities

This commit is contained in:
2022-10-11 12:18:12 +02:00
parent 63478aa887
commit 8866784d49
19 changed files with 106 additions and 21 deletions

View File

@ -0,0 +1,14 @@
import { EntityCtor, EntityInfo } from '@core';
import { randomUUID } from 'crypto';
export class Entity implements EntityInfo {
uuid: string;
createdAt: Date;
updatedAt: Date;
constructor(raw: EntityCtor) {
this.uuid = raw.uuid || randomUUID();
this.createdAt = raw.createdAt || new Date();
this.updatedAt = raw.updatedAt || new Date();
}
}