parameters: (self, team_id, project_id)
docstring: Update role of a team on a project
          ---
          tags:
            - teams
          produces:
            - application/json
          parameters:
              - in: header
                name: Authorization
                description: Base64 encoded session token
                required: true
                type: string
                default: Token sessionTokenHere==
              - name: project_id
                in: path
                description: Unique project ID
                required: true
                type: integer
                default: 1
              - name: team_id
                in: path
                description: Unique team ID
                required: true
                type: integer
                default: 1
              - in: body
                name: body
                required: true
                description: The role that the team will have on the project
                schema:
                    properties:
                        role:
                          type: string
          responses:
              201:
                  description: Team project assignment created
              401:
                  description: Forbidden, if user is not a manager of the project
              403:
                  description: Forbidden, if user is not authenticated
              404:
                  description: Not found
              500:
                  description: Internal Server Error
docstring_summary: Update role of a team on a project
          ---
          tags:
            - teams
          produces:
            - application/json
          parameters:
              - in: header
                name: Authorization
                description: Base64 encoded session token
                required: true
                type: string
                default: Token sessionTokenHere==
              - name: project_id
                in: path
                description: Unique project ID
                required: true
                type: integer
                default: 1
              - name: team_id
                in: path
                description: Unique team ID
                required: true
                type: integer
                default: 1
              - in: body
                name: body
                required: true
                description: The role that the team will have on the project
                schema:
                    properties:
                        role:
                          type: string
          responses:
              201:
                  description: Team project assignment created
              401:
                  description: Forbidden, if user is not a manager of the project
              403:
                  description: Forbidden, if user is not authenticated
              404:
                  description: Not found
              500:
                  description: Internal Server Error
docstring_tokens: Update role of a team on a project --- tags : - teams produces : - application / json parameters : - in : header name : Authorization description : Base64 encoded session token required : true type : string default : Token sessionTokenHere == - name : project_id in : path description : Unique project ID required : true type : integer default : 1 - name : team_id in : path description : Unique team ID required : true type : integer default : 1 - in : body name : body required : true description : The role that the team will have on the project schema : properties : role : type : string responses : 201 : description : Team project assignment created 401 : description : Forbidden if user is not a manager of the project 403 : description : Forbidden if user is not authenticated 404 : description : Not found 500 : description : Internal Server Error
function: def patch(self, team_id, project_id):
          """Update role of a team on a project
          ---
          tags:
            - teams
          produces:
            - application/json
          parameters:
              - in: header
                name: Authorization
                description: Base64 encoded session token
                required: true
                type: string
                default: Token sessionTokenHere==
              - name: project_id
                in: path
                description: Unique project ID
                required: true
                type: integer
                default: 1
              - name: team_id
                in: path
                description: Unique team ID
                required: true
                type: integer
                default: 1
              - in: body
                name: body
                required: true
                description: The role that the team will have on the project
                schema:
                    properties:
                        role:
                          type: string
          responses:
              201:
                  description: Team project assignment created
              401:
                  description: Forbidden, if user is not a manager of the project
              403:
                  description: Forbidden, if user is not authenticated
              404:
                  description: Not found
              500:
                  description: Internal Server Error
          """
          if not TeamService.is_user_team_manager(team_id, token_auth.current_user()):
              return {"Error": "User is not an admin or a manager for the team"}, 401
          try:
              role = request.get_json(force=True)["role"]
          except DataError as e:
              current_app.logger.error(f"Error validating request: {str(e)}")
              return str(e), 400
  
          try:
              TeamService.change_team_role(team_id, project_id, role)
              return {"Status": "Team role updated successfully."}, 200
          except NotFound as e:
              return {"Error": str(e)}, 404
          except TeamServiceError as e:
              return str(e), 402
          except Exception as e:
              error_msg = f"Team-Project PATCH - unhandled error: {str(e)}"
              current_app.logger.critical(error_msg)
              return {"Error": error_msg}, 500
function_tokens: def patch ( self , team_id , project_id ) : if not TeamService . is_user_team_manager ( team_id , token_auth . current_user ( ) ) : return { "Error" : "User is not an admin or a manager for the team" } , 401 try : role = request . get_json ( force = True ) [ "role" ] except DataError as e : current_app . logger . error ( f"Error validating request: {str(e)}" ) return str ( e ) , 400 try : TeamService . change_team_role ( team_id , project_id , role ) return { "Status" : "Team role updated successfully." } , 200 except NotFound as e : return { "Error" : str ( e ) } , 404 except TeamServiceError as e : return str ( e ) , 402 except Exception as e : error_msg = f"Team-Project PATCH - unhandled error: {str(e)}" current_app . logger . critical ( error_msg ) return { "Error" : error_msg } , 500