Add bulk action for removing tag from subscribers

[MAILPOET-5454]
This commit is contained in:
Jan Lysý
2023-07-07 13:03:54 +02:00
committed by Aschepikov
parent aa12fd57d7
commit 577a82ca49
5 changed files with 93 additions and 0 deletions

View File

@@ -293,6 +293,8 @@ class Subscribers extends APIEndpoint {
$count = $this->subscribersRepository->bulkUnsubscribe($ids);
} elseif ($data['action'] === 'addTag' && $tag instanceof TagEntity) {
$count = $this->subscribersRepository->bulkAddTag($tag, $ids);
} elseif ($data['action'] === 'removeTag' && $tag instanceof TagEntity) {
$count = $this->subscribersRepository->bulkRemoveTag($tag, $ids);
} else {
throw UnexpectedValueException::create()
->withErrors([APIError::BAD_REQUEST => "Invalid bulk action '{$data['action']}' provided."]);