forked from sr2/cloud-api
fix: questionnaire patch route update for new model
This commit is contained in:
parent
804e21b871
commit
2a20172d78
1 changed files with 3 additions and 1 deletions
|
|
@ -22,6 +22,7 @@ from sqlalchemy.sql import exists
|
|||
from src.database import db_dependency
|
||||
from src.contact.models import Contact
|
||||
from src.iam.models import Group
|
||||
from src.auth.service import root_user_dependency
|
||||
|
||||
from src.organisation.dependencies import org_model_dependency
|
||||
from src.organisation.constants import ContactType
|
||||
|
|
@ -55,6 +56,7 @@ async def get_org_by_id(db: db_dependency, org_id: Annotated[int, Path(gt=0)]):
|
|||
|
||||
@router.post("/")
|
||||
async def create_org(db: db_dependency, org_request: OrgOrgPostRequest):
|
||||
# TODO: Root user from current user
|
||||
org_model = Org(**org_request.model_dump())
|
||||
|
||||
org_model.status = "partial" # Status is always set to partial at first, see update_questionnaire() doc
|
||||
|
|
@ -74,7 +76,7 @@ async def update_questionnaire(db: db_dependency, q_request: OrgQuestionnairePat
|
|||
if org_model is None:
|
||||
raise HTTPException(status_code=404, detail="Organisation not found")
|
||||
|
||||
org_model.intake_questionnaire = q_request.intake_questionnaire
|
||||
org_model.intake_questionnaire = q_request.intake_questionnaire.model_dump()
|
||||
|
||||
# Allows for partially completed questionnaires to be saved without being submitted for review
|
||||
if not q_request.partial:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue