add stepable schema

This commit is contained in:
Julien Calixte
2023-04-04 00:20:14 +02:00
parent 48a3be6936
commit a6d3c68729

View File

@@ -1,3 +1,5 @@
import { isValid, v } from 'suretype'
export interface Stepable { export interface Stepable {
id: string id: string
title: string title: string
@@ -8,3 +10,12 @@ export interface Stepable {
*/ */
totalEstimation: number totalEstimation: number
} }
const stepableSchema = v.object({
id: v.string().minLength(1).required(),
title: v.string().minLength(1).required(),
estimation: v.number(),
totalEstimation: v.number().required()
})
const isValidStepable = (data: unknown) => isValid(stepableSchema, data)