refactor
This commit is contained in:
@@ -47,16 +47,16 @@ def ProjectChannelConflict() -> HTTPException:
|
||||
return HTTPException(status.HTTP_409_CONFLICT, 'Project channel already exists in target workspace')
|
||||
|
||||
|
||||
def PurchaseNotFound(purchase_id: uuid.UUID | None = None) -> HTTPException:
|
||||
if purchase_id is None:
|
||||
return HTTPException(status.HTTP_404_NOT_FOUND, 'Purchase not found')
|
||||
return HTTPException(status.HTTP_404_NOT_FOUND, f'Purchase {purchase_id} not found')
|
||||
def PlacementNotFound(placement_id: uuid.UUID | None = None) -> HTTPException:
|
||||
if placement_id is None:
|
||||
return HTTPException(status.HTTP_404_NOT_FOUND, 'Placement not found')
|
||||
return HTTPException(status.HTTP_404_NOT_FOUND, f'Placement {placement_id} not found')
|
||||
|
||||
|
||||
def PurchaseChannelNotFound(purchase_channel_id: uuid.UUID | None = None) -> HTTPException:
|
||||
if purchase_channel_id is None:
|
||||
return HTTPException(status.HTTP_404_NOT_FOUND, 'Purchase channel not found')
|
||||
return HTTPException(status.HTTP_404_NOT_FOUND, f'Purchase channel {purchase_channel_id} not found')
|
||||
def PublicationNotFound(publication_id: uuid.UUID | None = None) -> HTTPException:
|
||||
if publication_id is None:
|
||||
return HTTPException(status.HTTP_404_NOT_FOUND, 'Publication not found')
|
||||
return HTTPException(status.HTTP_404_NOT_FOUND, f'Publication {publication_id} not found')
|
||||
|
||||
|
||||
def ChannelAlreadyExists(telegram_id: int) -> HTTPException:
|
||||
@@ -90,16 +90,10 @@ def CreativeMediaTooLarge(max_bytes: int) -> HTTPException:
|
||||
def CreativeInUse(creative_id: uuid.UUID) -> HTTPException:
|
||||
return HTTPException(
|
||||
status.HTTP_400_BAD_REQUEST,
|
||||
f'Creative {creative_id} is used in active placements and cannot be deleted',
|
||||
f'Creative {creative_id} is used in active publications and cannot be deleted',
|
||||
)
|
||||
|
||||
|
||||
def PlacementNotFound(placement_id: uuid.UUID | None = None) -> HTTPException:
|
||||
if placement_id is None:
|
||||
return HTTPException(status.HTTP_404_NOT_FOUND, 'Placement not found')
|
||||
return HTTPException(status.HTTP_404_NOT_FOUND, f'Placement {placement_id} not found')
|
||||
|
||||
|
||||
def WorkspaceNotFound(workspace_id: uuid.UUID | None = None) -> HTTPException:
|
||||
if workspace_id is None:
|
||||
return HTTPException(status.HTTP_404_NOT_FOUND, 'Workspace not found')
|
||||
|
||||
Reference in New Issue
Block a user