Content
View differences
Updated by Wieland Lindenthal over 3 years ago
Changes in API behavior:
* Introduce a new endpoint `POST /api/v3/file_links`.
* The request/response signature is similar to `POST /api/v3/work_packages/{id}/file_links`, but there is no work\_package known during the request time. Therefore, we create a file\_link without a container and respond without a container link.
* Implementation notes:
* To to be able to create file\_links without a known container we have to remove not null constraints from the `file_links.container_id` and `file_links.container_type` database columns.
* We we have to cover a case when file\_links were has been created, but the work\_package create form has never been submitted. confirmed. To do it we can introduce a `Cron::CronJob` cron job for cleaning up.
`app/workers/attachments/cleanup_uncontainered_job.rb` - the one for handle a similar case for attachments. attachments.
* Modify `POST` [`https://openproject.local/api/v3/work_packages`](https://openproject.local/api/v3/work_packages)
* It should accept a list of file\_links by analogy to attachments. And respond with them afterwards. afterwards.
* Implementation note: the file\_links have to be bound to a container (work\_package in this case). The logic for attachments bindings is located in `app/services/attachments/set_replacements.rb`
* Introduce a new endpoint `POST /api/v3/file_links`.
* The request/response signature is similar to `POST /api/v3/work_packages/{id}/file_links`, but there is no work\_package known during the request time. Therefore, we create a file\_link without a container and respond without a container link.
* Implementation notes:
* To
* We
`app/workers/attachments/cleanup_uncontainered_job.rb` - the one for handle a similar case for attachments.
* Modify `POST` [`https://openproject.local/api/v3/work_packages`](https://openproject.local/api/v3/work_packages)
* It should accept a list of file\_links by analogy to attachments. And respond with them afterwards.
* Implementation note: the file\_links have to be bound to a container (work\_package in this case). The logic for attachments bindings is located in `app/services/attachments/set_replacements.rb`