1
0
Fork 0
mirror of https://github.com/muerwre/vk-tg-bot.git synced 2025-04-24 22:46:41 +07:00
This commit is contained in:
Fedor Katurov 2021-04-07 17:33:36 +07:00
commit ddefc2743a
21 changed files with 873 additions and 0 deletions

View file

@ -0,0 +1,20 @@
import * as yup from 'yup'
import { VkConfig, VkEvent } from './types';
const vkChannelEventSchema = yup.string().oneOf(Object.values(VkEvent))
const vkChannelSchema = yup.object().required().shape({
id: yup.string().required().matches(/^@/, ({ path }) => `${path} should start with "@"`),
events: yup.array().of(vkChannelEventSchema)
})
export const vkConfigSchema = yup.object<VkConfig>().required().shape({
groups: yup.array().required().of(yup.object().shape({
id: yup.number().positive(),
name: yup.string().required(),
testResponse: yup.string().required(),
secretKey: yup.string().required(),
apiKey: yup.string().required(),
channels: yup.array().of(vkChannelSchema),
}))
})