vylbot-app/src/database/entities/IgnoredChannel.ts
Vylpes e6c845e3b2
Some checks failed
continuous-integration/drone/push Build is failing
Switch to TypeORM's DataSource API (#299)
- Switch to TypeORM's DataSource API, rather than using the now deprecated ormconfig.json
- This will fix stage deployment not knowing how to deploy the database migrations

#297

> **NOTE:** This change requires the deployment scripts to be updated, please update them on the server before merging

Co-authored-by: Ethan Lane <ethan@vylpes.com>
Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/vylbot-app/pulls/299
2023-05-26 17:59:22 +01:00

20 lines
580 B
TypeScript

import { Entity } from "typeorm";
import BaseEntity from "../../contracts/BaseEntity";
import AppDataSource from "../dataSources/appDataSource";
@Entity()
export default class IgnoredChannel extends BaseEntity {
constructor(channelId: string) {
super();
this.Id = channelId;
}
public static async IsChannelIgnored(channelId: string): Promise<boolean> {
const repository = AppDataSource.getRepository(IgnoredChannel);
const single = await repository.findOne({ where: { Id: channelId } });
return single != undefined;
}
}