def post(self, args): # pylint: disable=no-self-use, missing-function-docstring is_user_admin = GoogleUserDataController.is_user_admin(args[EPQuestPostEditParam.GOOGLE_UID]) if not is_user_admin: return QuestPostPublishFailedResponse(ResponseCodeCollection.FAILED_QUEST_NOT_PUBLISHED_NOT_ADMIN), 401 seq_id = args[EPQuestPostEditParam.SEQ_ID] title = args[EPQuestPostEditParam.TITLE] lang_code = args[EPQuestPostEditParam.LANG_CODE] general_info = args[EPQuestPostEditParam.GENERAL_INFO] video = args[EPQuestPostEditParam.VIDEO] positional_info = EPQuestPostEditParam.pos_info_to_model_key(args[EPQuestPostEditParam.POSITION_INFO]) addendum = args[EPQuestPostEditParam.ADDENDUM] modify_note = args[EPQuestPostEditParam.MODIFY_NOTE] edit_outcome = QuestPostController.edit_post( seq_id, title, lang_code, general_info, video, positional_info, addendum, modify_note ) if edit_outcome == UpdateResult.NOT_FOUND: return QuestPostEditFailedResponse(ResponseCodeCollection.FAILED_POST_NOT_EXISTS), 404 if edit_outcome == UpdateResult.NO_CHANGE: return QuestPostEditSuccessResponse(seq_id), 200 return QuestPostEditSuccessResponse(seq_id), 200
def get(self, args): # pylint: disable=no-self-use, missing-function-docstring, duplicate-code is_user_admin = GoogleUserDataController.is_user_admin(args[EPQuestPostIDCheckParam.GOOGLE_UID]) if not is_user_admin: return QuestPostIDCheckResponse(False, False), 200 seq_id = args[EPQuestPostIDCheckParam.SEQ_ID] lang_code = args[EPQuestPostIDCheckParam.LANG_CODE] available = QuestPostController.is_id_lang_available(seq_id, lang_code) return QuestPostIDCheckResponse(is_user_admin, available), 200
def get(self, args): # pylint: disable=no-self-use, missing-function-docstring start_idx = args[EPQuestPostListParam.START] user_data = GoogleUserDataController.get_user_data(args[EPQuestPostListParam.GOOGLE_UID]) is_user_admin = user_data[GoogleUserDataKeys.IS_SITE_ADMIN] if user_data else False show_ads = not (user_data and GoogleUserDataKeys.ADS_DISABLE_EXPIRY in user_data) lang_code = args[EPQuestPostListParam.LANG_CODE] posts, post_count = QuestPostController.get_posts( lang_code, start=start_idx, limit=args[EPQuestPostListParam.LIMIT] ) return QuestPostListResponse(is_user_admin, show_ads, posts, start_idx, post_count), 200
def post(self, args): # pylint: disable=no-self-use, missing-function-docstring result = GoogleUserDataController.user_logged_in( args[EPUserLoginParam.GOOGLE_UID], args[EPUserLoginParam.GOOGLE_EMAIL]) if result == GoogleLoginType.UNKNOWN: return UserLoginResponse( ResponseCodeCollection.FAILED_LOGIN_NOT_RECORDED), 400 if result == GoogleLoginType.NEW_REGISTER: return UserLoginResponse(ResponseCodeCollection.SUCCESS_NEW), 200 return UserLoginResponse(ResponseCodeCollection.SUCCESS), 200
def get(self, args): # pylint: disable=no-self-use, missing-function-docstring user_data = GoogleUserDataController.get_user_data(args[EPQuestPostGetParam.GOOGLE_UID]) is_user_admin = user_data[GoogleUserDataKeys.IS_SITE_ADMIN] if user_data else False show_ads = not (user_data and GoogleUserDataKeys.ADS_DISABLE_EXPIRY in user_data) seq_id = args[EPQuestPostGetParam.SEQ_ID] lang_code = args[EPQuestPostGetParam.LANG_CODE] increase_count = args[EPQuestPostGetParam.INCREASE_COUNT] result = QuestPostController.get_post(seq_id, lang_code, increase_count) if not result.data: return QuestPostGetFailedResponse(ResponseCodeCollection.FAILED_POST_NOT_EXISTS), 404 return QuestPostGetSuccessResponse(is_user_admin, show_ads, result), 200
def post(self, args): # pylint: disable=no-self-use, missing-function-docstring is_user_admin = GoogleUserDataController.is_user_admin(args[EPQuestPostPublishParam.GOOGLE_UID]) if not is_user_admin: return QuestPostPublishFailedResponse(ResponseCodeCollection.FAILED_QUEST_NOT_PUBLISHED_NOT_ADMIN), 401 seq_id = args[EPQuestPostPublishParam.SEQ_ID] title = args[EPQuestPostPublishParam.TITLE] lang_code = args[EPQuestPostPublishParam.LANG_CODE] general_info = args[EPQuestPostPublishParam.GENERAL_INFO] video = args[EPQuestPostPublishParam.VIDEO] positional_info = EPQuestPostPublishParam.pos_info_to_model_key(args[EPQuestPostPublishParam.POSITION_INFO]) addendum = args[EPQuestPostPublishParam.ADDENDUM] new_seq_id = QuestPostController.publish_post( title, lang_code, general_info, video, positional_info, addendum, seq_id=seq_id ) return QuestPostPublishSuccessResponse(new_seq_id), 200
def post(self, args): # pylint: disable=no-self-use, missing-function-docstring, too-many-locals is_user_admin = GoogleUserDataController.is_user_admin( args[EPDragonAnalysisPostPublishParam.GOOGLE_UID]) if not is_user_admin: return DragonAnalysisPublishFailedResponse( ResponseCodeCollection.FAILED_QUEST_NOT_PUBLISHED_NOT_ADMIN ), 401 seq_id = args[EPDragonAnalysisPostPublishParam.SEQ_ID] unit_name = args[EPDragonAnalysisPostPublishParam.UNIT_NAME] lang_code = args[EPDragonAnalysisPostPublishParam.LANG_CODE] summary = args[EPDragonAnalysisPostPublishParam.SUMMARY] summon_result = args[EPDragonAnalysisPostPublishParam.SUMMON_RESULT] passives = args[EPDragonAnalysisPostPublishParam.PASSIVES] normal_attacks = args[EPDragonAnalysisPostPublishParam.NORMAL_ATTACKS] ultimate = args[EPDragonAnalysisPostPublishParam.ULTIMATE] notes = args[EPDragonAnalysisPostPublishParam.NOTES] suitable_characters = args[ EPDragonAnalysisPostPublishParam.SUITABLE_CHARACTERS] videos = args[EPDragonAnalysisPostPublishParam.VIDEOS] story = args[EPDragonAnalysisPostPublishParam.STORY] keywords = args[EPDragonAnalysisPostPublishParam.KEYWORDS] new_seq_id = UnitAnalysisPostController.publish_dragon_post( unit_name, lang_code, summary, summon_result, passives, normal_attacks, ultimate, notes, suitable_characters, videos, story, keywords, seq_id=seq_id) return DragonAnalysisPublishSuccessResponse(new_seq_id), 200
def post(self, args): # pylint: disable=no-self-use, missing-function-docstring, too-many-locals is_user_admin = GoogleUserDataController.is_user_admin( args[EPCharaAnalysisPostPublishParam.GOOGLE_UID]) if not is_user_admin: return CharaAnalysisPublishFailedResponse( ResponseCodeCollection.FAILED_QUEST_NOT_PUBLISHED_NOT_ADMIN ), 401 seq_id = args[EPCharaAnalysisPostPublishParam.SEQ_ID] unit_name = args[EPCharaAnalysisPostPublishParam.UNIT_NAME] lang_code = args[EPCharaAnalysisPostPublishParam.LANG_CODE] summary = args[EPCharaAnalysisPostPublishParam.SUMMARY] summon_result = args[EPCharaAnalysisPostPublishParam.SUMMON_RESULT] passives = args[EPCharaAnalysisPostPublishParam.PASSIVES] normal_attacks = args[EPCharaAnalysisPostPublishParam.NORMAL_ATTACKS] special_fs = args[EPCharaAnalysisPostPublishParam.FORCE_STRIKES] skills = EPCharaAnalysisPostPublishParam.skill_to_model_key( args[EPCharaAnalysisPostPublishParam.SKILLS]) tips_n_builds = args[EPCharaAnalysisPostPublishParam.TIPS_N_BUILDS] videos = args[EPCharaAnalysisPostPublishParam.VIDEOS] story = args[EPCharaAnalysisPostPublishParam.STORY] keywords = args[EPCharaAnalysisPostPublishParam.KEYWORDS] new_seq_id = UnitAnalysisPostController.publish_chara_post( unit_name, lang_code, summary, summon_result, passives, normal_attacks, special_fs, skills, tips_n_builds, videos, story, keywords, seq_id=seq_id) return CharaAnalysisPublishSuccessResponse(new_seq_id), 200
def get(self, args): # pylint: disable=no-self-use, missing-function-docstring show_ads = GoogleUserDataController.is_user_show_ads( args[EPUserLoginParam.GOOGLE_UID]) return UserShowAdsResponse(show_ads), 200