- Change RawOpdCheckpoint model to RawWaitingTime - Update schema from FeedCheckpointIn to FeedWaitingTimeIn - Switch to rawdata.raw_waiting_time table - Keep existing /feed/checkpoint endpoint - Add new fields: vn, txn, name, doctor_code, doctor_name, location_code, location_name, step_name, time - Update permission to feed.waiting-time:write
22 lines
527 B
Python
22 lines
527 B
Python
from urllib.parse import quote_plus
|
|
|
|
from sqlalchemy import create_engine
|
|
|
|
from app.core.config import settings
|
|
|
|
|
|
def build_db_url() -> str:
|
|
user = quote_plus(settings.DB_USER)
|
|
password = quote_plus(settings.DB_PASSWORD)
|
|
host = settings.DB_HOST
|
|
port = settings.DB_PORT
|
|
db = quote_plus(settings.DB_NAME)
|
|
|
|
return (
|
|
f"postgresql+psycopg://{user}:{password}@{host}:{port}/{db}"
|
|
f"?sslmode={quote_plus(settings.DB_SSLMODE)}"
|
|
)
|
|
|
|
|
|
engine = create_engine(build_db_url(), pool_pre_ping=True)
|