parameters: (self)
docstring: Creates a tasking-manager project
          ---
          tags:
              - projects
          produces:
              - application/json
          parameters:
              - in: header
                name: Authorization
                description: Base64 encoded session token
                required: true
                type: string
                default: Token sessionTokenHere==
              - in: body
                name: body
                required: true
                description: JSON object for creating draft project
                schema:
                  properties:
                      cloneFromProjectId:
                          type: int
                          default: 1
                          description: Specify this value if you want to clone a project, otherwise avoid information
                      projectName:
                          type: string
                          default: HOT Project
                      areaOfInterest:
                          schema:
                              properties:
                                  type:
                                      type: string
                                      default: FeatureCollection
                                  features:
                                      type: array
                                      items:
                                          schema:
                                              $ref: "#/definitions/GeoJsonFeature"
                          tasks:
                              schema:
                                  properties:
                                      type:
                                          type: string
                                          default: FeatureCollection
                                      features:
                                          type: array
                                          items:
                                              schema:
                                                  $ref: "#/definitions/GeoJsonFeature"
                          arbitraryTasks:
                              type: boolean
                              default: false
          responses:
              201:
                  description: Draft project created successfully
              400:
                  description: Client Error - Invalid Request
              401:
                  description: Unauthorized - Invalid credentials
              403:
                  description: Forbidden
              500:
                  description: Internal Server Error
docstring_summary: Creates a tasking-manager project
          ---
          tags:
              - projects
          produces:
              - application/json
          parameters:
              - in: header
                name: Authorization
                description: Base64 encoded session token
                required: true
                type: string
                default: Token sessionTokenHere==
              - in: body
                name: body
                required: true
                description: JSON object for creating draft project
                schema:
                  properties:
                      cloneFromProjectId:
                          type: int
                          default: 1
                          description: Specify this value if you want to clone a project, otherwise avoid information
                      projectName:
                          type: string
                          default: HOT Project
                      areaOfInterest:
                          schema:
                              properties:
                                  type:
                                      type: string
                                      default: FeatureCollection
                                  features:
                                      type: array
                                      items:
                                          schema:
                                              $ref: "#/definitions/GeoJsonFeature"
                          tasks:
                              schema:
                                  properties:
                                      type:
                                          type: string
                                          default: FeatureCollection
                                      features:
                                          type: array
                                          items:
                                              schema:
                                                  $ref: "#/definitions/GeoJsonFeature"
                          arbitraryTasks:
                              type: boolean
                              default: false
          responses:
              201:
                  description: Draft project created successfully
              400:
                  description: Client Error - Invalid Request
              401:
                  description: Unauthorized - Invalid credentials
              403:
                  description: Forbidden
              500:
                  description: Internal Server Error
docstring_tokens: Creates a tasking - manager project --- tags : - projects produces : - application / json parameters : - in : header name : Authorization description : Base64 encoded session token required : true type : string default : Token sessionTokenHere == - in : body name : body required : true description : JSON object for creating draft project schema : properties : cloneFromProjectId : type : int default : 1 description : Specify this value if you want to clone a project otherwise avoid information projectName : type : string default : HOT Project areaOfInterest : schema : properties : type : type : string default : FeatureCollection features : type : array items : schema : $ref : # / definitions / GeoJsonFeature tasks : schema : properties : type : type : string default : FeatureCollection features : type : array items : schema : $ref : # / definitions / GeoJsonFeature arbitraryTasks : type : boolean default : false responses : 201 : description : Draft project created successfully 400 : description : Client Error - Invalid Request 401 : description : Unauthorized - Invalid credentials 403 : description : Forbidden 500 : description : Internal Server Error
function: def post(self):
          """
          Creates a tasking-manager project
          ---
          tags:
              - projects
          produces:
              - application/json
          parameters:
              - in: header
                name: Authorization
                description: Base64 encoded session token
                required: true
                type: string
                default: Token sessionTokenHere==
              - in: body
                name: body
                required: true
                description: JSON object for creating draft project
                schema:
                  properties:
                      cloneFromProjectId:
                          type: int
                          default: 1
                          description: Specify this value if you want to clone a project, otherwise avoid information
                      projectName:
                          type: string
                          default: HOT Project
                      areaOfInterest:
                          schema:
                              properties:
                                  type:
                                      type: string
                                      default: FeatureCollection
                                  features:
                                      type: array
                                      items:
                                          schema:
                                              $ref: "#/definitions/GeoJsonFeature"
                          tasks:
                              schema:
                                  properties:
                                      type:
                                          type: string
                                          default: FeatureCollection
                                      features:
                                          type: array
                                          items:
                                              schema:
                                                  $ref: "#/definitions/GeoJsonFeature"
                          arbitraryTasks:
                              type: boolean
                              default: false
          responses:
              201:
                  description: Draft project created successfully
              400:
                  description: Client Error - Invalid Request
              401:
                  description: Unauthorized - Invalid credentials
              403:
                  description: Forbidden
              500:
                  description: Internal Server Error
          """
          try:
              draft_project_dto = DraftProjectDTO(request.get_json())
              draft_project_dto.user_id = token_auth.current_user()
              draft_project_dto.validate()
          except DataError as e:
              current_app.logger.error(f"error validating request: {str(e)}")
              return {"Error": "Unable to create project"}, 400
  
          try:
              draft_project_id = ProjectAdminService.create_draft_project(
                  draft_project_dto
              )
              return {"projectId": draft_project_id}, 201
          except ProjectAdminServiceError as e:
              return {"Error": str(e)}, 403
          except (InvalidGeoJson, InvalidData):
              return {"Error": "Invalid GeoJson"}, 400
          except Exception as e:
              error_msg = f"Project PUT - unhandled error: {str(e)}"
              current_app.logger.critical(error_msg)
              return {"Error": "Unable to create project"}, 500
function_tokens: def post ( self ) : try : draft_project_dto = DraftProjectDTO ( request . get_json ( ) ) draft_project_dto . user_id = token_auth . current_user ( ) draft_project_dto . validate ( ) except DataError as e : current_app . logger . error ( f"error validating request: {str(e)}" ) return { "Error" : "Unable to create project" } , 400 try : draft_project_id = ProjectAdminService . create_draft_project ( draft_project_dto ) return { "projectId" : draft_project_id } , 201 except ProjectAdminServiceError as e : return { "Error" : str ( e ) } , 403 except ( InvalidGeoJson , InvalidData ) : return { "Error" : "Invalid GeoJson" } , 400 except Exception as e : error_msg = f"Project PUT - unhandled error: {str(e)}" current_app . logger . critical ( error_msg ) return { "Error" : "Unable to create project" } , 500