Update the specified organization in the database. Args: organization_id (str): The ID of the organization values_to_update (Dict[str, Any]): The values to update in the organization
(organization_id: str, values_to_update: Dict[str, Any])
| 1154 | |
| 1155 | |
| 1156 | async def update_organization(organization_id: str, values_to_update: Dict[str, Any]): |
| 1157 | """ |
| 1158 | Update the specified organization in the database. |
| 1159 | |
| 1160 | Args: |
| 1161 | organization_id (str): The ID of the organization |
| 1162 | values_to_update (Dict[str, Any]): The values to update in the organization |
| 1163 | """ |
| 1164 | |
| 1165 | async with engine.core_session() as session: |
| 1166 | result = await session.execute( |
| 1167 | select(OrganizationDB).filter_by(id=uuid.UUID(organization_id)) |
| 1168 | ) |
| 1169 | organization = result.scalar() |
| 1170 | if organization is None: |
| 1171 | raise Exception(f"Organization with ID {organization_id} not found") |
| 1172 | |
| 1173 | for key, value in values_to_update.items(): |
| 1174 | if hasattr(organization, key): |
| 1175 | setattr(organization, key, value) |
| 1176 | |
| 1177 | await session.commit() |
| 1178 | await session.refresh(organization) |
| 1179 | |
| 1180 | |
| 1181 | async def create_or_update_default_project(values_to_update: Dict[str, Any]): |
no test coverage detected