
This commit includes: - Project structure and configuration - Database models for tasks, users, and categories - Authentication system with JWT - CRUD endpoints for tasks and categories - Search, filter, and sorting functionality - Health check endpoint - Alembic migration setup - Documentation
47 lines
955 B
Python
47 lines
955 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
# Shared properties
|
|
class TaskBase(BaseModel):
|
|
title: Optional[str] = None
|
|
description: Optional[str] = None
|
|
is_completed: Optional[bool] = False
|
|
due_date: Optional[datetime] = None
|
|
priority: Optional[str] = "medium"
|
|
category_id: Optional[int] = None
|
|
|
|
|
|
# Properties to receive on task creation
|
|
class TaskCreate(TaskBase):
|
|
title: str = Field(..., min_length=1, max_length=100)
|
|
|
|
|
|
# Properties to receive on task update
|
|
class TaskUpdate(TaskBase):
|
|
pass
|
|
|
|
|
|
# Properties shared by models stored in DB
|
|
class TaskInDBBase(TaskBase):
|
|
id: int
|
|
title: str
|
|
owner_id: int
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Properties to return to client
|
|
class Task(TaskInDBBase):
|
|
pass
|
|
|
|
|
|
# Properties stored in DB
|
|
class TaskInDB(TaskInDBBase):
|
|
pass
|