18 lines
464 B
Python
18 lines
464 B
Python
from pydantic import BaseModel, Field
|
|
from datetime import date
|
|
|
|
class TaskCreate(BaseModel):
|
|
title: str = Field(..., min_length=1, max_length=255)
|
|
description: str = Field(None, max_length=1000)
|
|
due_date: date = Field(...)
|
|
status: str = Field("pending", min_length=1, max_length=20)
|
|
|
|
class TaskResponse(BaseModel):
|
|
id: int
|
|
title: str
|
|
description: str
|
|
due_date: date
|
|
status: str
|
|
|
|
class Config:
|
|
from_attributes = True |