Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
Warnings:

- You are about to alter the column `title` on the `Task` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(200)`.
- You are about to alter the column `description` on the `Task` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(500)`.

*/
-- AlterTable
ALTER TABLE "Task" ALTER COLUMN "title" SET DATA TYPE VARCHAR(200),
ALTER COLUMN "description" SET DATA TYPE VARCHAR(500);
4 changes: 2 additions & 2 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ enum TaskStatus {

model Task {
id String @id @default(uuid())
title String
description String
title String @db.VarChar(200)
description String @db.VarChar(500)
status TaskStatus @default(pending)
user_id String
created_at DateTime @default(now())
Expand Down
10 changes: 8 additions & 2 deletions src/zod/taskSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ import { pt } from "zod/locales";
z.config(pt());

export const taskSchema = z.object({
title: z.string("Coluna 'title' é obrigatório!"),
description: z.string("Coluna 'description' é obrigatória!"),
title: z
.string("Coluna 'title' é obrigatório!")
.min(5, "O título deve conter no mínimo 5 caracteres.")
.max(200, "O título deve conter no máximo 200 caracteres."),
description: z
.string("Coluna 'description' é obrigatória!")
.min(10, "A descrição deve conter no mínimo 10 caracteres.")
.max(500, "A descrição deve conter no máximo 500 caracteres."),
status: z.enum(["pending", "in_progress", "done"]).optional(),
});

Expand Down
Loading
Loading