diff --git a/CHANGELOG.md b/CHANGELOG.md index f82dee799..73397cbae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,12 +8,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- Submission endpoint update #371 + - Adds mandatory query parameter `folder` for submit endpoint POST + - On actions add and modify object is added or updated to folder(submission) where it belongs with it's accession ID, schema, submission type, title and filename + - Adds metax integration to submit endpoint - Integration with Metax service #356 - Adds new local container for testing against mocked Metax API - Introduces new env vars: METAX_USER, METAX_PASS, METAX_URL - Adds new key metaxIdentifier to Study and Dataset collections containing metax id returned from Metax API - Adds new handler MetaxServiceHandler to take care of mapping Submitter metadata to Metax metadata and to connect to Metax API - Add patching of folders after object save and update operations #354 + - Adds mandatory query parameter `folder` for objects endpoint POST - Object is added or updated to folder(submission) where it belongs with it's accession ID, schema, submission type, title and filename in the case of CSV and XML upload - Adds configuration for mypy linting to VScode devcontainer setup - Templates API #256 @@ -46,7 +51,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - multilevel add patch objects to support `/extraInfo/datasetIdentifiers/-` which needs dot notation for mongodb to work e.g. `extraInfo.datasetIdentifiers` #332 ### Changed - - Refactor auth.py package by removing custom OIDC code and replacing it with https://github.com/IdentityPython/JWTConnect-Python-OidcRP. #315 - New mandatory ENV `OIDC_URL` - New optional ENVs `OIDC_SCOPE`, `AUTH_METHOD` diff --git a/docs/specification.yml b/docs/specification.yml index 8860160c9..12869a181 100644 --- a/docs/specification.yml +++ b/docs/specification.yml @@ -21,6 +21,14 @@ paths: tags: - Submission summary: XML submission endpoint, will also trigger validation. + parameters: + - name: folder + in: query + schema: + type: string + description: The folder ID where object belongs to. + required: true + example: "folder=12345" requestBody: content: multipart/form-data: @@ -293,11 +301,6 @@ paths: - Submission summary: Submit data to a specific schema parameters: - - in: query - name: folder - schema: - type: string - description: The folder ID where object belongs to. - name: schema in: path description: Name of the Metadata schema. diff --git a/metadata_backend/api/handlers/submission.py b/metadata_backend/api/handlers/submission.py index ac461ef58..c0a935d15 100644 --- a/metadata_backend/api/handlers/submission.py +++ b/metadata_backend/api/handlers/submission.py @@ -121,10 +121,11 @@ async def _execute_action(self, req: Request, schema: str, content: str, action: Only "add/modify/validate" actions are supported. + :param req: Multipart POST request :param schema: Schema type of the object in question :param content: Metadata object referred to in submission - :param db_client: Database client for database operations :param action: Type of action to be done + :param filename: Name of file being processed :raises: HTTPBadRequest if an incorrect or non-supported action is called :returns: Dict containing specific action that was completed """ @@ -144,14 +145,12 @@ async def _execute_action(self, req: Request, schema: str, content: str, action: raise web.HTTPBadRequest(reason=reason) async def _execute_action_add(self, req: Request, schema: str, content: str, filename: str) -> Dict: - """Complete the command in the action set of the submission file. - - Only "add/modify/validate" actions are supported. + """Complete the add action. + :param req: Multipart POST request :param schema: Schema type of the object in question :param content: Metadata object referred to in submission - :param db_client: Database client for database operations - :param action: Type of action to be done + :param filename: Name of file being processed :raises: HTTPBadRequest if an incorrect or non-supported action is called :returns: Dict containing specific action that was completed """ @@ -193,14 +192,12 @@ async def _execute_action_add(self, req: Request, schema: str, content: str, fil return result async def _execute_action_modify(self, req: Request, schema: str, content: str, filename: str) -> Dict: - """Complete the command in the action set of the submission file. - - Only "add/modify/validate" actions are supported. + """Complete the modify action. + :param req: Multipart POST request :param schema: Schema type of the object in question :param content: Metadata object referred to in submission - :param db_client: Database client for database operations - :param action: Type of action to be done + :param filename: Name of file being processed :raises: HTTPBadRequest if an incorrect or non-supported action is called :returns: Dict containing specific action that was completed """