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:
parent
e2457eb8c8
commit
948f5ae67c
9 changed files with 265 additions and 11 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue