
- Implemented user authentication with JWT - Added CRUD operations for users and items - Setup database connection with SQLAlchemy - Added migration scripts for easy database setup - Included health check endpoint for monitoring generated with BackendIM... (backend.im)
31 lines
590 B
Python
31 lines
590 B
Python
from pydantic import BaseModel
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
|
|
|
|
class ItemBase(BaseModel):
|
|
title: str
|
|
description: Optional[str] = None
|
|
price: float
|
|
|
|
|
|
class ItemCreate(ItemBase):
|
|
pass
|
|
|
|
|
|
class ItemUpdate(BaseModel):
|
|
title: Optional[str] = None
|
|
description: Optional[str] = None
|
|
price: Optional[float] = None
|
|
is_active: Optional[bool] = None
|
|
|
|
|
|
class ItemResponse(ItemBase):
|
|
id: int
|
|
is_active: bool
|
|
owner_id: int
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
orm_mode = True |