Switch to Coko's server file server implementation
Currently, Ketida has its own implementation when it comes to interacting with a file server. This implementation became the foundation of the corresponding feature of the Coko server.
However, things improved on Coko's server side and it is now time for Ketida to take advantage of these enhancements as well as to increase its use of common code.
Modifications should be needed in all the places where files are uploaded/downloaded/deleted etc and also a migration script should be created as the File
model of Ketida is a bit different from the File
model of Coko's server.
Coko Server:
- https://gitlab.coko.foundation/cokoapps/server/-/blob/master/src/models/file/file.model.js
- https://gitlab.coko.foundation/cokoapps/server/-/blob/master/src/services/fileStorage.js
Ketida:
- https://gitlab.coko.foundation/ketida/ketida/-/blob/master/server/data-model/src/file/file.js
- https://gitlab.coko.foundation/ketida/ketida/-/blob/master/server/api/useCases/objectStorage.js
Remaining:
- https://gitlab.coko.foundation/ketida/ketida/-/blob/master/server/api/useCases/file.js
- https://gitlab.coko.foundation/ketida/ketida/-/blob/master/server/api/useCases/utils/gatherImages.js
- https://gitlab.coko.foundation/ketida/ketida/-/blob/master/server/api/helpers/utils.js
- https://gitlab.coko.foundation/ketida/ketida/-/blob/master/server/common/fileStorageObjectKeyExtractor.js
- https://gitlab.coko.foundation/ketida/ketida/-/blob/master/server/data-model/src/template/template.js
- https://gitlab.coko.foundation/ketida/ketida/-/blob/master/server/api/template/template.resolvers.js
- https://gitlab.coko.foundation/ketida/ketida/-/blob/master/server/api/useCases/template.js
- https://gitlab.coko.foundation/ketida/ketida/-/tree/master/app/components/asset-manager
- https://gitlab.coko.foundation/ketida/ketida/-/blob/master/app/components/wax/src/queries/uploadFile.js
- https://gitlab.coko.foundation/ketida/ketida/-/blob/master/app/components/wax/src/ConnectedWax.js
- https://gitlab.coko.foundation/ketida/ketida/-/tree/master/app/components/templates
Steps to follow:
- identify diff between two models
- identify diff between two services (fileStorage, objectStorage)
- replacement of Ketida's file model with Coko's server's file model (imports and
components.js
) - replacement of all the functions exported from
objectStorage
with the corresponding fromfileStorage
(imports) - modify the remaining files presented in the list above in order to comply with file model giving special attention to the new concept of
storedObjects
https://gitlab.coko.foundation/cokoapps/server/-/blob/master/src/models/file/file.model.js#L74 introduced in Coko's server which replaces the existing handling of asset'sURL
- migration script