2
0
Files
bot/packages/models/src/features/answer.ts

36 lines
726 B
TypeScript
Raw Normal View History

import { z } from 'zod'
2021-12-30 10:24:16 +01:00
export const answerSchema = z.object({
createdAt: z.date(),
resultId: z.string(),
blockId: z.string(),
groupId: z.string(),
variableId: z.string().nullable(),
content: z.string(),
storageUsed: z.number().nullable(),
})
2022-01-03 17:39:59 +01:00
2022-11-21 11:12:43 +01:00
export const answerInputSchema = answerSchema
.omit({
createdAt: true,
resultId: true,
variableId: true,
storageUsed: true,
})
.and(
z.object({
variableId: z.string().nullish(),
storageUsed: z.number().nullish(),
})
)
2022-01-03 17:39:59 +01:00
export type Stats = {
totalViews: number
totalStarts: number
totalCompleted: number
2022-01-03 17:39:59 +01:00
}
export type Answer = z.infer<typeof answerSchema>
2022-11-21 11:12:43 +01:00
export type AnswerInput = z.infer<typeof answerInputSchema>