Update API service to use raw_waiting_time table
- 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
This commit is contained in:
21
03-apiservice-v0.1/app/db/engine.py
Normal file
21
03-apiservice-v0.1/app/db/engine.py
Normal file
@@ -0,0 +1,21 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user