api entities
This commit is contained in:
14
api/src/entities/entity.ts
Normal file
14
api/src/entities/entity.ts
Normal 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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user