diff --git a/src/use-cases/task/interfaces/stepable.ts b/src/use-cases/task/interfaces/stepable.ts index aa4b2ef..1f9df4d 100644 --- a/src/use-cases/task/interfaces/stepable.ts +++ b/src/use-cases/task/interfaces/stepable.ts @@ -1,3 +1,5 @@ +import { isValid, v } from 'suretype' + export interface Stepable { id: string title: string @@ -8,3 +10,12 @@ export interface Stepable { */ 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)