- Update dependency minimatch to 3.1.1 - Update dependency xml2js Co-authored-by: Ethan Lane <ethan@vylpes.com> Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/vylbot-app/pulls/295 Reviewed-by: VylpesTester <tester@vylpes.com>
45 lines
No EOL
1.1 KiB
TypeScript
45 lines
No EOL
1.1 KiB
TypeScript
import { Column, Entity, getConnection } from "typeorm";
|
|
import BaseEntity from "../../contracts/BaseEntity";
|
|
|
|
@Entity()
|
|
export default class Lobby extends BaseEntity {
|
|
constructor(channelId: string, roleId: string, cooldown: number, name: string) {
|
|
super();
|
|
|
|
this.ChannelId = channelId;
|
|
this.RoleId = roleId;
|
|
this.Cooldown = cooldown;
|
|
this.Name = name;
|
|
|
|
this.LastUsed = new Date(0);
|
|
}
|
|
|
|
@Column()
|
|
public ChannelId: string;
|
|
|
|
@Column()
|
|
public RoleId: string;
|
|
|
|
@Column()
|
|
public Cooldown: number;
|
|
|
|
@Column()
|
|
public LastUsed: Date;
|
|
|
|
@Column()
|
|
public Name: string;
|
|
|
|
public MarkAsUsed() {
|
|
this.LastUsed = new Date();
|
|
}
|
|
|
|
public static async FetchOneByChannelId(channelId: string, relations?: string[]): Promise<Lobby | null> {
|
|
const connection = getConnection();
|
|
|
|
const repository = connection.getRepository(Lobby);
|
|
|
|
const single = await repository.findOne({ where: { ChannelId: channelId }, relations: relations || [] });
|
|
|
|
return single;
|
|
}
|
|
} |