Closed pirvudoru closed 11 months ago
I created a new table to store image blobs, using the mentioned upload lib.
In order to get the images, I'm thinking we should create a HTTP GET based on the image id - and populate the URLs in Images
table.
E.g. GET /image/f1a019c8-9f52-4a70-919d-d6ccf9fc3d5a
which responds with the stored content type header.
UI admin for images is "choose file or drop image here", so end-to-end upload flow can be:
singleUpload
mutation when they are dropped in the screen
singleUpload(file: $file) { fileBlobId }
<img src="/image/42">
themeCreate(input: { title: "My Theme", fileBlobId: "42"})
fileBlobId: 42
, then persists the actual themeNext steps for backend:
CreatedAt
, to allow UI to select from existing files
singleUpload
mutationNew mutation allowing an image upload (stored in the database). Response returns the upload ID that you can reference later. See #83 for tests and API call.
New endpoint can be used via HTTP GET to retrieve files: <img src="/file/{fileBlobId}" />
. More details in #84.
themeCreate
queryThemes can now be created with a fileBlobId
reference. See #84 for API call.
A new query recentImageUploads
allows getting latest uploaded images. If integrated in UI, this should result in less orphan images and easier catchup if you refresh the page. API call in #84.
Uploads that are not referenced in Images table should be deleted via a nightly cronjob. See tests in #84.
We need to support file upload via https://github.com/jaydenseric/graphql-multipart-request-spec#server to allow clients easy integration.
As it looks, we should be able to use https://github.com/JannikLassahn/graphql-dotnet-upload
If not, what can we do?