Automated Action fb94dd1153 Fix updated_at column in migration and schema to ensure auto-update on record changes
Fixed two issues:
1. Added onupdate and server_default to updated_at column in migration script
2. Changed updated_at to be non-optional in TodoResponse schema

🤖 Generated with BackendIM... (backend.im)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-12 16:37:27 +00:00

32 lines
785 B
Python

from typing import Optional
from datetime import datetime
from pydantic import BaseModel, Field
# Shared properties
class TodoBase(BaseModel):
title: str = Field(..., min_length=1, max_length=100)
description: Optional[str] = Field(None, max_length=500)
completed: bool = False
# Properties to receive on todo creation
class TodoCreate(TodoBase):
pass
# Properties to receive on todo update
class TodoUpdate(BaseModel):
title: Optional[str] = Field(None, min_length=1, max_length=100)
description: Optional[str] = Field(None, max_length=500)
completed: Optional[bool] = None
# Properties to return to client
class TodoResponse(TodoBase):
id: int
created_at: datetime
updated_at: datetime
class Config:
from_attributes = True