27 lines
540 B
Python
27 lines
540 B
Python
"""Tracking Pydantic schemas."""
|
|
from pydantic import BaseModel
|
|
from typing import Optional
|
|
from datetime import date
|
|
|
|
|
|
class TrackingBase(BaseModel):
|
|
"""Base schema for tracking."""
|
|
date: date
|
|
reps: int
|
|
completed: bool = False
|
|
notes: Optional[str] = None
|
|
|
|
|
|
class TrackingCreate(TrackingBase):
|
|
"""Schema for creating tracking."""
|
|
challenge_id: int
|
|
|
|
|
|
class TrackingResponse(TrackingBase):
|
|
"""Schema for tracking response."""
|
|
id: int
|
|
challenge_id: int
|
|
|
|
class Config:
|
|
from_attributes = True
|