Пример #1
0
    def _is_post_exist(self, post_id) -> bool:
        send_message(PostTopicEnum.IS_POST_EXIST.value, post_id=post_id)

        return get_event_object(topic_name=PostTopicEnum.IS_POST_EXIST.value)
Пример #2
0
    def _get_user(self, user_id: int) -> Optional[UserEntity]:
        send_message(UserTopicEnum.GET_USER, user_id=user_id)

        return get_event_object(UserTopicEnum.GET_USER)
Пример #3
0
    def _get_region_group(self, id: int):
        send_message(topic_name=RegionTopicEnum.GET_REGION_GROUP, id=id)

        return get_event_object(topic_name=RegionTopicEnum.GET_REGION_GROUP)
Пример #4
0
 def _get_target_user_for_notification(self):
     send_message(topic_name=NotificationTopicEnum.GET_KEYWORD_TARGET_USER)
     return get_event_object(
         topic_name=NotificationTopicEnum.GET_KEYWORD_TARGET_USER)
Пример #5
0
    def _block_post(self, post_id: int):
        send_message(topic_name=PostTopicEnum.BLOCK.value, post_id=post_id)

        return get_event_object(topic_name=PostTopicEnum.BLOCK.value)
Пример #6
0
    def _add_report_count(self, post_id: int) -> int:
        send_message(topic_name=PostTopicEnum.ADD_REPORT_COUNT.value,
                     post_id=post_id)

        return get_event_object(
            topic_name=PostTopicEnum.ADD_REPORT_COUNT.value)
Пример #7
0
def _get_post(post_id: int) -> Optional[PostEntity]:
    send_message(topic_name=PostTopicEnum.GET_POST.value,
                 post_id=post_id,
                 is_blocked=True)

    return get_event_object(topic_name=PostTopicEnum.GET_POST.value)