feat: add VOC data endpoint (POST /api/v1/voc-data)
- Add VocDataIn schema (date, topic, sub_topic, level, depart_id, dep_name) - Add RawVocData SQLAlchemy model (rawdata.raw_voc_data, BIGSERIAL PK) - Add POST /api/v1/voc-data endpoint with voc.data:write permission - Dual-write to local PostgreSQL + Supabase - Table auto-created on startup via Base.metadata.create_all()
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from datetime import date, datetime
|
||||
|
||||
from sqlalchemy import BigInteger, Boolean, DateTime, ForeignKey, Integer, String, Text, UniqueConstraint, func
|
||||
from sqlalchemy import BigInteger, Boolean, Date, DateTime, ForeignKey, Integer, String, Text, UniqueConstraint, func
|
||||
from sqlalchemy.dialects.postgresql import JSONB
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
@@ -65,6 +65,20 @@ class PatientAppointment(Base):
|
||||
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False, server_default=func.now())
|
||||
|
||||
|
||||
class RawVocData(Base):
|
||||
__tablename__ = "raw_voc_data"
|
||||
__table_args__ = {"schema": "rawdata"}
|
||||
|
||||
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
|
||||
date: Mapped[date] = mapped_column(Date, nullable=False)
|
||||
topic: Mapped[str] = mapped_column(String(200), nullable=False)
|
||||
sub_topic: Mapped[str] = mapped_column(String(200), nullable=False)
|
||||
level: Mapped[str] = mapped_column(String(50), nullable=False)
|
||||
depart_id: Mapped[str] = mapped_column(String(50), nullable=False)
|
||||
dep_name: Mapped[str | None] = mapped_column(String(200), nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
|
||||
class ApiClient(Base):
|
||||
__tablename__ = "api_client"
|
||||
__table_args__ = {"schema": "fastapi"}
|
||||
|
||||
Reference in New Issue
Block a user