114 query: $listDto->query ??
'',
115 isBanned: $listDto->isBanned,
116 categoryId: $listDto->categoryId,
120 limit: self::CATEGORIES_PAGE_SIZE,
121 page: $listDto->page ?? 0,
124 $categories = $this->categoryProvider->list($categoryQuery);
126 foreach ($categories as $category)
128 if ($category->closed)
130 EventCategoryPullService::getInstance()->addToWatch($this->userId, $category->id);
134 EventCategoryPullService::getInstance()->addToWatch($this->userId);
135 OpenEventPullService::getInstance()->addToWatch($this->userId);
138 $this->categoryProvider->getAllCategory(),
145 $canAdd = EventCategoryAccessController::can(
147 ActionDictionary::ACTION_EVENT_CATEGORY_ADD,
152 $this->addError(
new Error(
'no create access',
'no_create_access'));
157 $eventCategory = CategoryService::getInstance()
158 ->createEventCategory($this->userId, $createEventCategoryDto)
161 $eventCategoryPullService = EventCategoryPullService::getInstance();
162 if ($eventCategory->getClosed())
164 $eventCategoryPullService->addToWatch($this->userId, $eventCategory->getId());
167 return EventCategoryResponseHelper::prepareEventCategoryForUserResponse(
168 eventCategory: $eventCategory,
169 userId: $this->userId,
170 isMuted: !$eventCategory->getClosed(),
179 $canEdit = EventCategoryAccessController::can(
181 ActionDictionary::ACTION_EVENT_CATEGORY_EDIT,
182 $eventCategory->
getId(),
187 $this->addError(
new Error(
'no edit access',
'no_edit_access'));
192 CategoryService::getInstance()->updateEventCategory($this->userId, $eventCategory, $updateEventCategoryDto);
194 return EventCategoryResponseHelper::prepareEventCategoryForUserResponse(
195 eventCategory: $eventCategory,