cr-connect-workflow/crc/api
Dan Funk cd7f67ab48 A major refactor of how we search and store files, as there was a lot of confusing bits in here.
From an API point of view you can do the following (and only the following)

/files?workflow_spec_id=x
* You can find all files associated with a workflow_spec_id, and add a file with a workflow_spec_id
/files?workflow_id=x
* You can find all files associated with a workflow_id, and add a file that is directly associated with the workflow
/files?workflow_id=x&form_field_key=y
* You can find all files associated with a form element on a running workflow, and add a new file.
   Note: you can add multiple files to the same form_field_key, IF they have different file names. If the same name, the original file is archived,
   and the new file takes its place.

The study endpoints always return a list of the file metadata associated with the study.  Removed /studies-files, but there is an
endpoint called

/studies/all  - that returns all the studies in the system, and does include their files.

On a deeper level:
 The File model no longer contains:
  - study_id,
  - task_id,
  - form_field_key

Instead, if the file is associated with workflow - then that is the one way it is connected to the study, and we use this relationship to find files for a study.
A file is never associated with a task_id, as these change when the workflow is reloaded.
The form_field_key must match the irb_doc_code, so when requesting files for a form field, we just look up the irb_doc_code.
2020-05-28 08:27:26 -04:00
..
__init__.py Adding file management. Files are stored in the database along with basic meta data. 2019-12-27 13:50:03 -05:00
approval.py Fixing broken test 2020-05-24 01:22:14 -06:00
common.py Vastly more informative ApiError model that provides details on the underlying task where the error occured. 2020-03-27 08:29:31 -04:00
file.py A major refactor of how we search and store files, as there was a lot of confusing bits in here. 2020-05-28 08:27:26 -04:00
study.py A major refactor of how we search and store files, as there was a lot of confusing bits in here. 2020-05-28 08:27:26 -04:00
tools.py On the tools/render_docx api, allow sending the json data in the body, rather than as a ludicrous long get parameter. Silly Dan. 2020-05-22 15:30:22 -04:00
user.py use redirect, not redirect_url. 2020-05-26 15:09:57 -04:00
workflow.py I absolutely must fix our cascade deletes, but I sort of like the horror such chunks of code cause, we really need to protect these endpoints, and assure they never get called under normal circumstances, and raise some thoughtful errors. 2020-05-26 21:18:09 -04:00