vylbot-app/src/entity/Server.ts
Vylpes 514be692fd
150 assignable roles should be its own table to prevent limitations on length (#158)
* Add entity

* Update role config command to use new entity

* Update role command to use new entity

* Remove legacy code from config command
2022-05-14 14:59:32 +01:00

27 lines
No EOL
610 B
TypeScript

import { Entity, OneToMany } from "typeorm";
import BaseEntity from "../contracts/BaseEntity";
import Role from "./Role";
import Setting from "./Setting";
@Entity()
export default class Server extends BaseEntity {
constructor(serverId: string) {
super();
this.Id = serverId;
}
@OneToMany(() => Setting, x => x.Server)
Settings: Setting[];
@OneToMany(() => Role, x => x.Server)
Roles: Role[];
public AddSettingToServer(setting: Setting) {
this.Settings.push(setting);
}
public AddRoleToServer(role: Role) {
this.Roles.push(role);
}
}