def post(self): request_data = json.loads(self.request.body) logging.info(request_data) team_owner = current_user_player() application = TeamApplication.get_by_id(int(request_data['application_id'])) team = application.team.get() # VALIDATIONS if not validate_is_team_owner(self.response, team_owner, team): return # DO SHIT applicant = application.player.get() applicant.team = application.team applicant.put() application.key.delete() _websocket_notify_team("Team_NewMember", team.key, "player.team.members.[%s]" % applicant.key.id(), applicant.get_data_nick_and_id()) # Because how this transaction work, we manualy add the player itself as a member of the team team_data = team.get_data("full") team_data['members'].append(applicant.get_data_nick_and_id()) websocket_notify_player("Player_TeamApplicationAccepted", applicant.key, "player", {'team': team_data}) set_json_response(self.response, {'code': "OK"})
def post(self): request_data = json.loads(self.request.body) logging.info(request_data) player = current_user_player() application = TeamApplication.get_by_id(int(request_data['application_id'])) team = application.team.get() # VALIDATIONS if not validate_is_team_owner(self.response, player, team): return # DO SHIT application.key.delete() _websocket_notify_team("Team_ApplicationDeclined", team.key, "player.team.applications.-[%s]" % application.key.id(), application.get_data()) set_json_response(self.response, {'code': "OK"})