goci icon indicating copy to clipboard operation
goci copied to clipboard

Implement an Endpoint to Update File Types

Open karatugo opened this issue 1 month ago • 0 comments

Description: There are scenarios where curators need to update the file type for all studies in a submission or for a specific GCST ID. This requires the creation of a new endpoint in the gwas-sumstats-service that allows curators to send a request via curl to update file types and regenerate the corresponding YAML metadata.

Acceptance Criteria:

  1. A new endpoint is implemented in the gwas-sumstats-service to handle file type updates.
  2. The endpoint accepts a request to update file types for:
    • All studies in a submission.
    • A specific study identified by its GCST ID.
  3. The endpoint regenerates the YAML metadata for the affected studies after updating the file types.
  4. The endpoint is accessible via curl and returns appropriate responses (e.g., success, failure, or validation errors).
  5. Proper error handling is implemented for invalid requests or missing data.
  6. Documentation is updated to include usage examples for the new endpoint.

Proposed Endpoint:

  • Method: POST
  • Path: /v1/update-file-type
  • Request Body:
    {
      "submission_id": "optional_submission_id",
      "gcst_id": "optional_gcst_id",
      "new_file_type": "new_file_type_value"
    }
    
  • Response:
    • Success: 200 OK with a message confirming the update and metadata regeneration.
    • Failure: 400 Bad Request or 404 Not Found with an error message.

Example Curl Request:

curl -X POST "gwas-ss-service:8000/v1/update-file-type" \
-H "Content-Type: application/json" \
-d '{
  "submission_id": "SUB12345",
  "new_file_type": "updated_file_type"
}'

karatugo avatar Jan 24 '25 10:01 karatugo