♻️ Add shared eslint config
This commit is contained in:
@ -10,6 +10,20 @@ export const answerSchema = z.object({
|
||||
storageUsed: z.number().nullable(),
|
||||
})
|
||||
|
||||
export const answerInputSchema = answerSchema
|
||||
.omit({
|
||||
createdAt: true,
|
||||
resultId: true,
|
||||
variableId: true,
|
||||
storageUsed: true,
|
||||
})
|
||||
.and(
|
||||
z.object({
|
||||
variableId: z.string().nullish(),
|
||||
storageUsed: z.number().nullish(),
|
||||
})
|
||||
)
|
||||
|
||||
export type Stats = {
|
||||
totalViews: number
|
||||
totalStarts: number
|
||||
@ -17,3 +31,5 @@ export type Stats = {
|
||||
}
|
||||
|
||||
export type Answer = z.infer<typeof answerSchema>
|
||||
|
||||
export type AnswerInput = z.infer<typeof answerInputSchema>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { z } from 'zod'
|
||||
import { answerSchema } from './answer'
|
||||
import { answerInputSchema, answerSchema } from './answer'
|
||||
import { InputBlockType } from './blocks'
|
||||
import { variableWithValueSchema } from './typebot/variable'
|
||||
|
||||
@ -20,6 +20,12 @@ export const resultWithAnswersSchema = resultSchema.and(
|
||||
})
|
||||
)
|
||||
|
||||
export const resultWithAnswersInputSchema = resultSchema.and(
|
||||
z.object({
|
||||
answers: z.array(answerInputSchema),
|
||||
})
|
||||
)
|
||||
|
||||
export const logSchema = z.object({
|
||||
id: z.string(),
|
||||
createdAt: z.date(),
|
||||
@ -33,10 +39,14 @@ export type Result = z.infer<typeof resultSchema>
|
||||
|
||||
export type ResultWithAnswers = z.infer<typeof resultWithAnswersSchema>
|
||||
|
||||
export type ResultWithAnswersInput = z.infer<
|
||||
typeof resultWithAnswersInputSchema
|
||||
>
|
||||
|
||||
export type Log = z.infer<typeof logSchema>
|
||||
|
||||
export type ResultValues = Pick<
|
||||
ResultWithAnswers,
|
||||
ResultWithAnswersInput,
|
||||
'answers' | 'createdAt' | 'variables'
|
||||
>
|
||||
|
||||
|
Reference in New Issue
Block a user