1
0
Fork 0
mirror of https://github.com/muerwre/vk-tg-bot.git synced 2025-04-25 06:56:40 +07:00

#4 fixed event handling

This commit is contained in:
Fedor Katurov 2021-05-06 18:04:24 +07:00
parent e2457eb8c8
commit 948f5ae67c
9 changed files with 265 additions and 11 deletions

View file

@ -19,6 +19,8 @@ export class PostgresDB implements Storage {
constructor(private config: PostgresConfig) {}
connect = async () => {
logger.info(`connecting to ${this.config.uri}`);
this.connection = await createConnection({
type: "postgres",
url: this.config.uri,
@ -50,19 +52,24 @@ export class PostgresDB implements Storage {
});
};
getEventById = async (
getEventByVKEventId = async (
type: VkEvent,
id: number,
vkEventId: number,
vkGroupId: number,
channel: string
) => {
return await this.events.findOne({
type,
id,
vkEventId,
vkGroupId,
channel,
});
};
getEventById = async (id: number) => {
return await this.events.findOne({
id,
});
};
createEvent = async (
type: VkEvent,