29 lines
676 B
Python
29 lines
676 B
Python
|
|
from pydantic import BaseModel
|
||
|
|
from typing import Optional
|
||
|
|
from datetime import date, time
|
||
|
|
import uuid
|
||
|
|
|
||
|
|
class HabitCreate(BaseModel):
|
||
|
|
name: str
|
||
|
|
description: Optional[str] = None
|
||
|
|
frequency_type: str = "daily"
|
||
|
|
target_count: int = 1
|
||
|
|
reminder_time: Optional[time] = None
|
||
|
|
start_date: Optional[date] = None
|
||
|
|
|
||
|
|
class HabitResponse(BaseModel):
|
||
|
|
id: uuid.UUID
|
||
|
|
name: str
|
||
|
|
description: Optional[str]
|
||
|
|
frequency_type: str
|
||
|
|
target_count: int
|
||
|
|
is_active: bool
|
||
|
|
start_date: date
|
||
|
|
|
||
|
|
class Config:
|
||
|
|
from_attributes = True
|
||
|
|
|
||
|
|
class HabitCompletionCreate(BaseModel):
|
||
|
|
notes: Optional[str] = None
|
||
|
|
quality_rating: Optional[int] = None
|