This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
frontend/src/modelSchema/bucket.ts

26 lines
748 B
TypeScript

import type {TypeOf} from 'zod'
import {number, array, boolean} from 'zod'
import {IdSchema} from './common/id'
import {DateSchema} from './common/date'
import {TextFieldSchema} from './common/textField'
import {AbstractSchema} from './abstract'
import {UserSchema} from './user'
import {TaskSchema} from './task'
export const BucketSchema = AbstractSchema.extend({
id: IdSchema.default(0),
title: TextFieldSchema,
listId: IdSchema.default(0),
limit: number().default(0),
tasks: array(TaskSchema).default([]),
isDoneBucket: boolean().default(false),
position: number().default(0),
createdBy: UserSchema.nullable(),
created: DateSchema.nullable(),
updated: DateSchema.nullable(),
})
export type IBucket = TypeOf<typeof BucketSchema>