UNPKG

@jfln/marvin-db

Version:

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

31 lines (24 loc) 673 B
import {Entity, Property, Enum} from '@mikro-orm/core' import {BaseEntity} from '../BaseEntity' import {Tag} from '../../interfaces/Tag.interface' @Entity({tableName: 'setting-rules'}) export class SettingsRules extends BaseEntity { @Property({type: 'json'}) tags: Tag[] public setTags(tags: Tag[]): SettingsRules { this.tags = tags return this } public addTag(tag: Tag): SettingsRules { this.tags.push(tag) return this } public removeTag(tagId: string): SettingsRules { this.tags = this.tags.filter(t => t.id !== tagId) return this } constructor(guildId: string, tags: Tag[]) { super(guildId) this.tags = tags } }