Only one writeable campaign version at a time
This commit is contained in:
@@ -288,11 +288,11 @@ def fork_version_for_edit(
|
||||
session: Session = Depends(get_session),
|
||||
principal: ApiPrincipal = Depends(require_scope("campaign:write")),
|
||||
):
|
||||
"""Create a new editable campaign version from a locked/validated/sent version.
|
||||
"""Create the campaign's next and only editable working version.
|
||||
|
||||
Versions that were validated, built, queued or sent are immutable audit
|
||||
snapshots. This endpoint makes an explicit editable copy and makes that
|
||||
new copy the campaign's current version.
|
||||
A new working copy may be created only after the current version is
|
||||
permanently user-locked or delivery-final. Validation and temporary user
|
||||
locks must be removed in place instead of creating parallel drafts.
|
||||
"""
|
||||
|
||||
payload = payload or CampaignVersionUpdateRequest()
|
||||
@@ -324,6 +324,8 @@ def fork_version_for_edit(
|
||||
campaign=CampaignResponse.model_validate(campaign),
|
||||
version=CampaignVersionResponse.model_validate(version),
|
||||
)
|
||||
except LockedCampaignVersionError as exc:
|
||||
raise HTTPException(status_code=status.HTTP_409_CONFLICT, detail=str(exc)) from exc
|
||||
except CampaignPersistenceError as exc:
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=str(exc)) from exc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user