@api.login_required(oauth_scopes=['teams:write'])
    @api.resolve_object_by_model(Team, 'team')
    @api.permission_required(
        permissions.OwnerRolePermission,
        kwargs_on_request=lambda kwargs: {'obj': kwargs['team']}
    )
    @api.permission_required(permissions.WriteAccessPermission())
    @api.parameters(parameters.AddTeamMemberParameters())
    @api.response(schemas.BaseTeamMemberSchema())
    @api.response(code=http_exceptions.Conflict.code)
    def post(self, args, team):
        """
        Add a new member to a team.
        """
        try:
            user_id = args.pop('user_id')
            user = User.query.get(user_id)
            if user is None:
                abort(
                    code=http_exceptions.NotFound.code,
                    message="User with id %d does not exist" % user_id
                )

            try:
                team_member = TeamMember(team=team, user=user, **args)
            except __HOLE__ as exception:
                abort(code=http_exceptions.Conflict.code, message=str(exception))

            db.session.add(team_member)

            try:
                db.session.commit()
            except sqlalchemy.exc.IntegrityError:
                abort(
                    code=http_exceptions.Conflict.code,
                    message="Could not update team details."
                )
        finally:
            db.session.rollback()
        return team_member
dataset/ETHPy150Open frol/flask-restplus-server-example/app/modules/teams/resources.py/TeamMembers.post