From 4c4101129988b65eb5bfbf90dd47e977d3225138 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Thu, 26 Aug 2021 10:37:05 -0400 Subject: [PATCH] Add task_spec_name to `add_file` API call --- crc/api.yml | 6 ++++++ crc/api/file.py | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/crc/api.yml b/crc/api.yml index 284a2b28..a63520b0 100755 --- a/crc/api.yml +++ b/crc/api.yml @@ -699,6 +699,12 @@ paths: description: The unique id of a workflow instance schema: type: integer + - name: task_spec_name + in: query + required: false + description: The name of the task spec + schema: + type: string - name: form_field_key in: query required: false diff --git a/crc/api/file.py b/crc/api/file.py index 118dccfc..c4267b7b 100644 --- a/crc/api/file.py +++ b/crc/api/file.py @@ -41,13 +41,17 @@ def get_reference_files(): return FileSchema(many=True).dump(files) -def add_file(workflow_spec_id=None, workflow_id=None, form_field_key=None): +def add_file(workflow_spec_id=None, workflow_id=None, task_spec_name=None, form_field_key=None): file = connexion.request.files['file'] if workflow_id: if form_field_key is None: raise ApiError('invalid_workflow_file', 'When adding a workflow related file, you must specify a form_field_key') + if task_spec_name is None: + raise ApiError('invalid_workflow_file', + 'When adding a workflow related file, you must specify a task_spec_name') file_model = FileService.add_workflow_file(workflow_id=workflow_id, irb_doc_code=form_field_key, + task_spec_name=task_spec_name, name=file.filename, content_type=file.content_type, binary_data=file.stream.read()) elif workflow_spec_id: