|
@@ -157,11 +157,15 @@ class CollectionsRouter(BaseRouterV3):
|
|
|
with a specified name and optional description. The user creating
|
|
with a specified name and optional description. The user creating
|
|
|
the collection is automatically added as a member.
|
|
the collection is automatically added as a member.
|
|
|
"""
|
|
"""
|
|
|
- user_collections_count = (
|
|
|
|
|
|
|
+ logger.info(f"Creating collection {name}")
|
|
|
|
|
+ user_collections_count = 0
|
|
|
|
|
+ '''
|
|
|
|
|
+ (
|
|
|
await self.services.management.collections_overview(
|
|
await self.services.management.collections_overview(
|
|
|
user_ids=[auth_user.id], limit=1, offset=0
|
|
user_ids=[auth_user.id], limit=1, offset=0
|
|
|
)
|
|
)
|
|
|
)["total_entries"]
|
|
)["total_entries"]
|
|
|
|
|
+ '''
|
|
|
user_max_collections = (
|
|
user_max_collections = (
|
|
|
await self.services.management.get_user_max_collections(
|
|
await self.services.management.get_user_max_collections(
|
|
|
auth_user.id
|
|
auth_user.id
|
|
@@ -172,6 +176,7 @@ class CollectionsRouter(BaseRouterV3):
|
|
|
f"User has reached the maximum number of collections allowed ({user_max_collections}).",
|
|
f"User has reached the maximum number of collections allowed ({user_max_collections}).",
|
|
|
400,
|
|
400,
|
|
|
)
|
|
)
|
|
|
|
|
+ logger.info(f"Creating collection {name}")
|
|
|
collection = await self.services.management.create_collection(
|
|
collection = await self.services.management.create_collection(
|
|
|
owner_id=auth_user.id,
|
|
owner_id=auth_user.id,
|
|
|
name=name,
|
|
name=name,
|
|
@@ -603,6 +608,7 @@ class CollectionsRouter(BaseRouterV3):
|
|
|
collection. Deleting a collection removes all associations but does
|
|
collection. Deleting a collection removes all associations but does
|
|
|
not delete the documents within it.
|
|
not delete the documents within it.
|
|
|
"""
|
|
"""
|
|
|
|
|
+ logger.info(f"Deleting collection {id}")
|
|
|
if id == generate_default_user_collection_id(auth_user.id):
|
|
if id == generate_default_user_collection_id(auth_user.id):
|
|
|
raise R2RException(
|
|
raise R2RException(
|
|
|
"Cannot delete the default user collection.",
|
|
"Cannot delete the default user collection.",
|
|
@@ -611,7 +617,7 @@ class CollectionsRouter(BaseRouterV3):
|
|
|
await authorize_collection_action(
|
|
await authorize_collection_action(
|
|
|
auth_user, id, CollectionAction.DELETE, self.services
|
|
auth_user, id, CollectionAction.DELETE, self.services
|
|
|
)
|
|
)
|
|
|
-
|
|
|
|
|
|
|
+ logger.info(f"Deleting collection {id}")
|
|
|
await self.services.management.delete_collection(collection_id=id)
|
|
await self.services.management.delete_collection(collection_id=id)
|
|
|
return GenericBooleanResponse(success=True) # type: ignore
|
|
return GenericBooleanResponse(success=True) # type: ignore
|
|
|
|
|
|