diff --git a/backend/btrixcloud/models.py b/backend/btrixcloud/models.py index 115d41a6e2..b6fef762c6 100644 --- a/backend/btrixcloud/models.py +++ b/backend/btrixcloud/models.py @@ -1155,6 +1155,13 @@ class OrgStorageReplicaRefs(BaseModel): storageReplicas: List[StorageRef] +# ============================================================================ +class OrgAllStorages(BaseModel): + """Response model for listing all available storages""" + + allStorages: List[StorageRef] + + # ============================================================================ class S3StorageIn(BaseModel): """Custom S3 Storage input model""" diff --git a/backend/btrixcloud/storages.py b/backend/btrixcloud/storages.py index 7e8feb0384..4ffc9ea444 100644 --- a/backend/btrixcloud/storages.py +++ b/backend/btrixcloud/storages.py @@ -49,6 +49,7 @@ OrgStorageRefs, OrgStorageRef, OrgStorageReplicaRefs, + OrgAllStorages, DeletedResponse, UpdatedResponse, UpdatedResponseId, @@ -387,14 +388,14 @@ async def _run_post_storage_replica_update_tasks( org, replica_storage, remove=True ) - def get_available_storages(self, org: Organization) -> List[StorageRef]: + def get_available_storages(self, org: Organization) -> Dict[str, List[StorageRef]]: """return a list of available default + custom storages""" refs: List[StorageRef] = [] for name in self.default_storages: refs.append(StorageRef(name=name, custom=False)) for name in org.customStorages: refs.append(StorageRef(name=name, custom=True)) - return refs + return {"allStorages": refs} @asynccontextmanager async def get_s3_client( @@ -893,7 +894,7 @@ def get_storage_refs( @router.get( "/all-storages", tags=["organizations", "storage"], - response_model=List[StorageRef], + response_model=OrgAllStorages, ) def get_available_storages(org: Organization = Depends(org_owner_dep)): return storage_ops.get_available_storages(org)