def post(self, team_unid): args = self.create_parser.parse_args() user_unid = args['user_unid'] member_type = args['member_type'] team = get_team(team_unid) user = get_user(user_unid) user_team = UserTeam.add_user_to_team(user_unid, team_unid, member_type) if user_team.member_type == 2: team.team_captain = user_team.user_unid team.number_participants += 1 return {'status': 'true', 'user_team_unid': user_team.unid, 'team': team.serialize()}
def post(self): args = self.create_team_parser.parse_args() name = args['team_name'] max_members = args['max_participants'] captain = args['team_captain'] num_members = args['number_participants'] route = args['route_id'] needs_accessibility = args.get('requires_accessibility', 0) public = args.get('public_team', 0) public = 0 if public == "0" or public == 0 or public == None else 1 captain_user = User.fetch_user_by_unid(captain) if captain_user is None: return {'status': 'false', 'message': 'Team captain given does not exist'}, 400 team = TeamModel.create_team(name, captain, max_members, num_members, public) user_team = UserTeam.add_user_to_team(captain, team.unid, 2) return {'status': 'true', 'team_id': team.unid, 'user_team': user_team.unid}, 201