- Flutter frontend with Provider state management - FastAPI backend with SQLAlchemy ORM - Internationalization support (EN/DE) - Clean Architecture folder structure - GoRouter for navigation - GetIt for dependency injection
50 lines
1.2 KiB
Python
50 lines
1.2 KiB
Python
from datetime import datetime
|
|
from enum import Enum
|
|
from typing import Optional
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class Priority(str, Enum):
|
|
low = "low"
|
|
medium = "medium"
|
|
high = "high"
|
|
|
|
|
|
class TaskBase(BaseModel):
|
|
title: str = Field(..., min_length=1, max_length=200)
|
|
description: Optional[str] = None
|
|
date: str = Field(..., pattern=r"^\d{4}-\d{2}-\d{2}$")
|
|
time: Optional[str] = Field(None, pattern=r"^\d{2}:\d{2}$")
|
|
priority: Priority = Priority.medium
|
|
|
|
|
|
class TaskCreate(TaskBase):
|
|
pass
|
|
|
|
|
|
class TaskUpdate(BaseModel):
|
|
title: Optional[str] = Field(None, min_length=1, max_length=200)
|
|
description: Optional[str] = None
|
|
date: Optional[str] = Field(None, pattern=r"^\d{4}-\d{2}-\d{2}$")
|
|
time: Optional[str] = Field(None, pattern=r"^\d{2}:\d{2}$")
|
|
priority: Optional[Priority] = None
|
|
is_done: Optional[bool] = None
|
|
|
|
|
|
class TaskResponse(TaskBase):
|
|
id: str
|
|
is_done: bool
|
|
created_at: Optional[datetime]
|
|
updated_at: Optional[datetime]
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class RescheduleRequest(BaseModel):
|
|
target_date: str = Field(..., pattern=r"^\d{4}-\d{2}-\d{2}$")
|
|
|
|
|
|
class HealthResponse(BaseModel):
|
|
status: str = "ok"
|