(self, project_id, task_id)
Set a task as mapped
        ---
        tags:
            - tasks
        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: Project ID the task is associated with
              required: true
              type: integer
              default: 1
            - name: task_id
              in: path
              description: Unique task ID
              required: true
              type: integer
              default: 1
            - in: body
              name: body
              required: true
              description: JSON object for unlocking a task
              schema:
                  id: TaskUpdateUnlock
                  required:
                      - status
                  properties:
                      status:
                          type: string
                          description: The new status for the task
                          default: MAPPED
                      comment:
                          type: string
                          description: Optional user comment about the task
                          default: Comment about the mapping
        responses:
            200:
                description: Task unlocked
            400:
                description: Client Error
            401:
                description: Unauthorized - Invalid credentials
            403:
                description: Forbidden
            404:
                description: Task not found
            500:
                description: Internal Server Error
Set a task as mapped
        ---
        tags:
            - tasks
        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: Project ID the task is associated with
              required: true
              type: integer
              default: 1
            - name: task_id
              in: path
              description: Unique task ID
              required: true
              type: integer
              default: 1
            - in: body
              name: body
              required: true
              description: JSON object for unlocking a task
              schema:
                  id: TaskUpdateUnlock
                  required:
                      - status
                  properties:
                      status:
                          type: string
                          description: The new status for the task
                          default: MAPPED
                      comment:
                          type: string
                          description: Optional user comment about the task
                          default: Comment about the mapping
        responses:
            200:
                description: Task unlocked
            400:
                description: Client Error
            401:
                description: Unauthorized - Invalid credentials
            403:
                description: Forbidden
            404:
                description: Task not found
            500:
                description: Internal Server Error
Set a task as mapped --- tags : - tasks 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 : Project ID the task is associated with required : true type : integer default : 1 - name : task_id in : path description : Unique task ID required : true type : integer default : 1 - in : body name : body required : true description : JSON object for unlocking a task schema : id : TaskUpdateUnlock required : - status properties : status : type : string description : The new status for the task default : MAPPED comment : type : string description : Optional user comment about the task default : Comment about the mapping responses : 200 : description : Task unlocked 400 : description : Client Error 401 : description : Unauthorized - Invalid credentials 403 : description : Forbidden 404 : description : Task not found 500 : description : Internal Server Error
def post(self, project_id, task_id):
        """
        Set a task as mapped
        ---
        tags:
            - tasks
        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: Project ID the task is associated with
              required: true
              type: integer
              default: 1
            - name: task_id
              in: path
              description: Unique task ID
              required: true
              type: integer
              default: 1
            - in: body
              name: body
              required: true
              description: JSON object for unlocking a task
              schema:
                  id: TaskUpdateUnlock
                  required:
                      - status
                  properties:
                      status:
                          type: string
                          description: The new status for the task
                          default: MAPPED
                      comment:
                          type: string
                          description: Optional user comment about the task
                          default: Comment about the mapping
        responses:
            200:
                description: Task unlocked
            400:
                description: Client Error
            401:
                description: Unauthorized - Invalid credentials
            403:
                description: Forbidden
            404:
                description: Task not found
            500:
                description: Internal Server Error
        """
        try:
            authenticated_user_id = token_auth.current_user()
            mapped_task = MappedTaskDTO(request.get_json())
            mapped_task.user_id = authenticated_user_id
            mapped_task.task_id = task_id
            mapped_task.project_id = project_id
            mapped_task.validate()
        except DataError as e:
            current_app.logger.error(f"Error validating request: {str(e)}")
            return {"Error": "Task unlock failed"}, 400

        try:
            task = MappingService.unlock_task_after_mapping(mapped_task)
            return task.to_primitive(), 200
        except NotFound:
            return {"Error": "Task Not Found"}, 404
        except MappingServiceError:
            return {"Error": "Task unlock failed"}, 403
        except Exception as e:
            error_msg = f"Task Lock API - unhandled error: {str(e)}"
            current_app.logger.critical(error_msg)
            return {"Error": "Task unlock failed"}, 500
        finally:
            # Refresh mapper level after mapping
            UserService.check_and_update_mapper_level(authenticated_user_id)
def post ( self , project_id , task_id ) : try : authenticated_user_id = token_auth . current_user ( ) mapped_task = MappedTaskDTO ( request . get_json ( ) ) mapped_task . user_id = authenticated_user_id mapped_task . task_id = task_id mapped_task . project_id = project_id mapped_task . validate ( ) except DataError as e : current_app . logger . error ( f"Error validating request: {str(e)}" ) return { "Error" : "Task unlock failed" } , 400 try : task = MappingService . unlock_task_after_mapping ( mapped_task ) return task . to_primitive ( ) , 200 except NotFound : return { "Error" : "Task Not Found" } , 404 except MappingServiceError : return { "Error" : "Task unlock failed" } , 403 except Exception as e : error_msg = f"Task Lock API - unhandled error: {str(e)}" current_app . logger . critical ( error_msg ) return { "Error" : "Task unlock failed" } , 500 finally : # Refresh mapper level after mapping UserService . check_and_update_mapper_level ( authenticated_user_id )