Files
armonia-api/app/schemas/service.py
T
kiskaadee 92edb4ac12 feat(packages): add multi-session package endpoints and service buffer schema
- Add `packages` table and indexes in `schema.sql` to track prepaid or
  partially paid multi-session therapy bundles (`total_sessions`,
  `completed_sessions`, `financial_status`).
- Add `buffer_minutes`, `duration_minutes`, and `package_id` columns to
  support mandatory post-consultation buffers and package redemptions.
- Seed 15-minute mandatory buffer on `atencion-psicologica-individual`.
- Implement `/packages` CRUD router (`POST`, `GET`, `PATCH`) and mount it
  in `app/main.py`.

Refs: #1
2026-10-18 12:00:10 -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", "ONE_ON_ONE"]
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", "ONE_ON_ONE"] | 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