2026-04-06 12:41:49 +01:00
|
|
|
"""
|
|
|
|
|
Router dependencies for organisation module
|
|
|
|
|
|
|
|
|
|
Classes:
|
|
|
|
|
- List: Description
|
|
|
|
|
- Classes: Description
|
|
|
|
|
|
|
|
|
|
Functions:
|
|
|
|
|
- List: Description
|
|
|
|
|
- Functions: Description
|
2026-05-25 09:05:17 +01:00
|
|
|
"""
|
|
|
|
|
from typing import Annotated
|
|
|
|
|
|
|
|
|
|
from fastapi import HTTPException, Depends
|
|
|
|
|
|
|
|
|
|
from src.database import db_dependency
|
|
|
|
|
|
|
|
|
|
from src.organisation.models import Organisation as Org
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_org_model(db: db_dependency, org_id: int) -> type[Org]:
|
|
|
|
|
org_model = db.query(Org).filter(Org.id == org_id).first()
|
|
|
|
|
if org_model is None:
|
|
|
|
|
raise HTTPException(status_code=404, detail="Organisation not found")
|
|
|
|
|
|
|
|
|
|
return org_model
|
|
|
|
|
|
|
|
|
|
org_model_dependency = Annotated[type[Org], Depends(get_org_model)]
|