@jfln/marvin-db
Version:
biblioteca de objetos para normalizar o acesso a um banco mongo db
31 lines (24 loc) • 776 B
text/typescript
import {Entity, Property, Enum} from '@mikro-orm/core'
import {BaseEntity} from '../BaseEntity'
import {Channel} from '../../interfaces/Channel.interface'
export class SettingsChannel extends BaseEntity {
channels: Channel[]
public setChannels(channels: Channel[]): SettingsChannel {
this.channels = channels
return this
}
public addChannel(channel: Channel): SettingsChannel {
this.channels.push(channel)
return this
}
public removeChannel(channel: Channel): SettingsChannel {
this.channels = this.channels.filter(c => c.id !== channel.id)
return this
}
constructor(guildId: string, channels: Channel[]) {
super(guildId)
this.channels = channels
}
}