UNPKG

@jfln/marvin-db

Version:

biblioteca de objetos para normalizar o acesso a um banco mongo db

56 lines (45 loc) 1.16 kB
import {Entity, Property, Enum} from '@mikro-orm/core' import {BaseEntity} from './BaseEntity' import {User} from '../interfaces/User.interface' import {Content} from '../interfaces/Content.interface' import {AuditType} from '../types/Audit.types' @Entity({tableName: 'audits'}) export class Audit extends BaseEntity { @Enum(() => AuditType) auditType: string @Property() deleted: boolean @Property({type: 'json', nullable: false}) content: Content @Property({type: 'json', nullable: false}) user: User public setAuditType(auditType: AuditType): this { this.auditType = auditType return this } public setDeleted(deleted: boolean): this { this.deleted = deleted return this } public setContent(content: Content): this { this.content = content return this } public setUser(user: User): this { this.user = user return this } constructor( auditType: AuditType, deleted: boolean, guildId: string, content: Content, user: User, ) { super(guildId) this.auditType = auditType this.deleted = deleted this.content = content this.user = user } }