flip_api.trusts_services.update_trust_status

Attributes

router

Functions

check_model_exists(→ bool)

Check if a model exists in the database.

check_trust_exists(→ bool)

Check if a trust exists in the database.

update_trust_status(, model_id, trust_status, data, ...)

Update the status of a trust intersect with a model.

Module Contents

flip_api.trusts_services.update_trust_status.router
flip_api.trusts_services.update_trust_status.check_model_exists(model_id: uuid.UUID, db: sqlmodel.Session) bool

Check if a model exists in the database.

Parameters:
  • model_id (UUID) – ID of the model to check.

  • db (Session) – Database session.

Returns:

True if the model exists, False otherwise.

Return type:

bool

flip_api.trusts_services.update_trust_status.check_trust_exists(trust_id: str, db: sqlmodel.Session) bool

Check if a trust exists in the database.

Parameters:
  • trust_id (str) – ID of the trust to check.

  • db (Session) – Database session.

Returns:

True if the trust exists, False otherwise.

Return type:

bool

flip_api.trusts_services.update_trust_status.update_trust_status(request: fastapi.Request, trust_id: str = Path(..., description='ID of the trust'), model_id: uuid.UUID = Path(..., description='ID of the model'), trust_status: str = Path(..., description='New status to set'), data: flip_api.domain.schemas.trusts.UpdateTrustStatusSchema | None = Body(None), db: sqlmodel.Session = Depends(get_session), user_id: uuid.UUID = Depends(verify_token)) dict[str, str]

Update the status of a trust intersect with a model.

Parameters:
  • request (Request) – FastAPI request object.

  • trust_id (str) – ID of the trust.

  • model_id (UUID) – ID of the model.

  • trust_status (str) – New status to set.

  • data (UpdateTrustStatusSchema | None) – Request body containing additional data.

  • db (Session) – Database session.

  • user_id (UUID) – ID of the authenticated user.

Returns:

Success message.

Return type:

dict[str, str]

Raises:
  • HTTPException – If the user does not have permission to update the trust status, if the model or trust does not

  • exist, if the trust status is invalid, if there is an error communicating with the trust, or if there is an

  • error updating the trust status in the database.