Create uploadBookThumbnail mutation of the book entity (backend)
Context
For the case of POD project we would like to offer the ability to users to upload thumbnails for their created books.
Proposal
Design
Implementation (if applicable)
Extend the existing Book type (graphql schema) with an additional property named thumbnailId: ID and thumbnailURL:String
Extend the actual Book model (db) with an additional property called named thumbnailId -> uuid or null
Create a migration script which will modify Book's table in order to create that new column and patch all the existing book thumbnailId:null
Create the uploadBookThumbnail mutation which will take as argument bookId: ID!, file:File!
Create the controller of that mutation which will be responsible to actually upload the provided image file to the file server, create a file representation and finally pass that file id to the thumbnailId of the book.
Create a custom resolver for the field thumbnailURL in the book.resolvers.js
where if the thumbnailId will exist then the URL of the storedObject
with type
small
should be returned. e.g. https://gitlab.coko.foundation/ketida/server/-/blob/main/api/graphql/file/file.resolvers.js#L163