Feature/49 ignore channel lists when logging #168
2 changed files with 34 additions and 0 deletions
21
src/entity/IgnoredChannel.ts
Normal file
21
src/entity/IgnoredChannel.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import { Entity, getConnection } from "typeorm";
|
||||
import BaseEntity from "../contracts/BaseEntity";
|
||||
|
||||
@Entity()
|
||||
export default class IgnoredChannel extends BaseEntity {
|
||||
constructor(channelId: string) {
|
||||
super();
|
||||
|
||||
this.Id = channelId;
|
||||
}
|
||||
|
||||
public static async IsChannelIgnored(channelId: string): Promise<boolean> {
|
||||
const connection = getConnection();
|
||||
|
||||
const repository = connection.getRepository(IgnoredChannel);
|
||||
|
||||
const single = await repository.findOne(channelId);
|
||||
|
||||
return single != undefined;
|
||||
}
|
||||
}
|
13
src/migration/1657647026816-CreateIgnoredChannel
Normal file
13
src/migration/1657647026816-CreateIgnoredChannel
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm"
|
||||
|
||||
export class migration1657647026816 implements MigrationInterface {
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
queryRunner.query(`CREATE TABLE ignored_channel (Id varchar(255), PRIMARY KEY (Id))`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
queryRunner.query(`DROP TABLE ignored_channel`)
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue