Files
armonia-api/app/schemas/service.py
T
kiskaadee 67f41ca2f1 feat(models): implement SQLModel table models, portable database engine, and align INDIVIDUAL schema
- Define SQLModel table models for AdminAllowlist, AdminAuditLog, Client, Service, Package, Booking, and Payment with foreign keys and strict validation.
- Configure portable SQLModel create_engine in app/db/database.py supporting local SQLite and Turso Cloud (sqlite+libsql://) with PRAGMA foreign_keys = ON.
- Provide get_session generator dependency for FastAPI routers.
- Align ONE_ON_ONE service type to INDIVIDUAL across schema.sql, routers, seeds, and documentation.
- Add unit tests for all models and database connectivity (75 tests passing).

Refs: #6
2026-10-19 12:58:59 -05:00

42 lines
1.2 KiB
Python

from __future__ import annotations
from typing import Literal
from pydantic import BaseModel, Field
class ServiceBase(BaseModel):
name: str = Field(..., min_length=2, max_length=150)
description: str | None = None
service_type: Literal["GROUP", "INDIVIDUAL"]
modality: Literal["PRESENCIAL", "ONLINE"]
default_schedule: str | None = None
price_mxn: int = Field(..., ge=0)
max_capacity: int = Field(default=1, ge=1)
duration_minutes: int = Field(default=60, ge=15)
buffer_minutes: int = Field(default=0, ge=0)
is_active: bool = True
class ServiceCreate(ServiceBase):
slug: str = Field(..., min_length=2, max_length=100)
class ServiceUpdate(BaseModel):
name: str | None = None
description: str | None = None
service_type: Literal["GROUP", "INDIVIDUAL"] | None = None
modality: Literal["PRESENCIAL", "ONLINE"] | None = None
default_schedule: str | None = None
price_mxn: int | None = Field(default=None, ge=0)
max_capacity: int | None = Field(default=None, ge=1)
duration_minutes: int | None = Field(default=None, ge=15)
buffer_minutes: int | None = Field(default=None, ge=0)
is_active: bool | None = None
class ServiceRead(ServiceBase):
id: str
slug: str
created_at: str