Skip to content

Commit 67a49b3

Browse files
committed
@GitHK review: doc
1 parent 363ad0d commit 67a49b3

File tree

1 file changed

+12
-8
lines changed
  • services/web/server/src/simcore_service_webserver/folders

1 file changed

+12
-8
lines changed

services/web/server/src/simcore_service_webserver/folders/_trash_api.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@ async def _check_exists_and_access(
2222
user_id: UserID,
2323
folder_id: FolderID,
2424
) -> bool:
25-
# 1. exists ?
25+
# exists?
26+
# check whether this folder exists
27+
# otherwise raise not-found error
2628
folder_db = await _folders_db.get(
2729
app, folder_id=folder_id, product_name=product_name
2830
)
2931

30-
# 2. can ?
32+
# can?
33+
# check whether user in product has enough permissions to delete this folder
34+
# otherwise raise forbidden error
3135
workspace_is_private = True
3236
if folder_db.workspace_id:
3337
await check_user_workspace_access(
@@ -49,7 +53,7 @@ async def _check_exists_and_access(
4953
return workspace_is_private
5054

5155

52-
async def _batch_update_folders(
56+
async def _folders_db_update(
5357
app: web.Application,
5458
*,
5559
product_name: ProductName,
@@ -97,23 +101,23 @@ async def trash_folder(
97101
app, product_name=product_name, user_id=user_id, folder_id=folder_id
98102
)
99103

100-
# 3. Trash
104+
# Trash
101105
trashed_at = arrow.utcnow().datetime
102106

103107
_logger.debug(
104108
"TODO: Unit of work for all folders and projects and fails if force_stop_first=%s is False",
105109
force_stop_first,
106110
)
107111

108-
# 3.1 Trash folder and children
109-
await _batch_update_folders(
112+
# 1. Trash folder and children
113+
await _folders_db_update(
110114
app,
111115
folder_id=folder_id,
112116
product_name=product_name,
113117
trashed_at=trashed_at,
114118
)
115119

116-
# 3.2 Trash all child projects that I am an owner
120+
# 2. Trash all child projects that I am an owner
117121
child_projects: list[
118122
ProjectID
119123
] = await _folders_db.get_projects_recursively_only_if_user_is_owner(
@@ -149,7 +153,7 @@ async def untrash_folder(
149153
# 3. UNtrash
150154

151155
# 3.1 UNtrash folder and children
152-
await _batch_update_folders(
156+
await _folders_db_update(
153157
app,
154158
folder_id=folder_id,
155159
product_name=product_name,

0 commit comments

Comments
 (0)