Skip to content

Commit 52da08d

Browse files
committed
fix: minor draft service/repo fixes
fix a copy-pasted docstring; add a rollback
1 parent 15ed7af commit 52da08d

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/dioptra/restapi/db/repository/drafts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,8 @@ def get_by_filters_paged(
426426
for unlimited length
427427
428428
Returns:
429-
A 2-tuple including a page of Group objects, and a count of the
430-
total number of groups matching the criteria
429+
A 2-tuple including a page of DraftResource objects, and a count
430+
of the total number of drafts matching the criteria
431431
432432
Raises:
433433
EntityDoesNotExistError: if the given user does not exist, or if

src/dioptra/restapi/v1/shared/drafts/service.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,15 @@ def modify(
445445
provided_resource_snapshot_id=payload["resource_snapshot_id"],
446446
)
447447

448-
self._uow.drafts_repo.update(
449-
draft,
450-
payload["resource_data"],
451-
payload["resource_snapshot_id"],
452-
)
448+
try:
449+
self._uow.drafts_repo.update(
450+
draft,
451+
payload["resource_data"],
452+
payload["resource_snapshot_id"],
453+
)
454+
except Exception:
455+
self._uow.rollback()
456+
raise
453457

454458
if commit:
455459
self._uow.commit()

0 commit comments

Comments
 (0)