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

#4 added simple DB layer

This commit is contained in:
Fedor Katurov 2021-05-04 11:38:22 +07:00
parent f3a746efe8
commit c0588acd26
15 changed files with 476 additions and 11 deletions

View file

@ -2,6 +2,7 @@ import { TelegramConfig } from "../service/telegram/types";
import { VkConfig, VkEvent } from "../service/vk/types";
import { HttpConfig } from "../api/http/types";
import { LoggerConfig } from "../service/logger/types";
import { PostgresConfig } from "../service/db/postgres/types";
export type TemplateConfig = Record<VkEvent, string>;
@ -11,4 +12,5 @@ export interface Config extends Record<string, any> {
vk: VkConfig;
logger?: LoggerConfig;
templates?: TemplateConfig;
postgres?: PostgresConfig;
}

View file

@ -4,6 +4,7 @@ import { Config } from "./types";
import { vkConfigSchema } from "../service/vk/validation";
import { telegramConfigSchema } from "../service/telegram/validation";
import { loggerConfigSchema } from "../service/logger/config";
import { dbConfigValidatior } from "../service/db/postgres/validation";
const templateConfigSchema = object().shape({
message_new: string().required(),
@ -15,6 +16,7 @@ const configSchema = object<Config>().required().shape({
telegram: telegramConfigSchema,
logger: loggerConfigSchema,
templates: templateConfigSchema,
postgres: dbConfigValidatior,
});
export const validateConfig = (config: Config) =>