Refactor OpenAPI fetcher for improved clarity and robustness
Reorganized and enhanced the OpenAPI fetch logic for better maintainability and error handling. Key updates include improved environment variable validation, more detailed error messages, streamlined configuration loading, and additional safety checks for file paths and directories. Added proper logging and ensured the process flow is easy to trace.
This commit is contained in:
parent
c77e579799
commit
dbf7864e7e
@ -234,11 +234,11 @@ dewars = [
|
||||
|
||||
# Define proposals
|
||||
proposals = [
|
||||
Proposal(id=1, number="PROPOSAL-FRODO-001"),
|
||||
Proposal(id=2, number="PROPOSAL-GANDALF-002"),
|
||||
Proposal(id=3, number="PROPOSAL-ARAGORN-003"),
|
||||
Proposal(id=4, number="PROPOSAL-SAURON-004"),
|
||||
Proposal(id=5, number="PROPOSAL-MORDOR-005"),
|
||||
Proposal(id=1, number="p20000"),
|
||||
Proposal(id=2, number="p20001"),
|
||||
Proposal(id=3, number="p20002"),
|
||||
Proposal(id=4, number="p20003"),
|
||||
Proposal(id=5, number="p20004"),
|
||||
]
|
||||
|
||||
# Define shipment specific dewars
|
||||
|
@ -46,9 +46,11 @@ def get_db():
|
||||
# Load only slots (minimal data)
|
||||
def load_slots_data(session: Session):
|
||||
from .data import slots
|
||||
from .data import proposals
|
||||
|
||||
if not session.query(models.Slot).first(): # Load only if no slots exist
|
||||
session.add_all(slots)
|
||||
session.add_all(proposals)
|
||||
session.commit()
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user