-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix event cover upload flow #190
Comments
Maybe instead of combining the routes, we can do #36, allow NULL event covers, and only allow the event to be published once it has a cover. |
Or instead of persisting the event at creation time, we keep it in-memory, and then persist it in the |
(Just throwing out ideas.) |
Retry uploads, max 3 times? |
It's definitely not great that the API has this hole in it though. Combining the routes is probably the best solution, but we should still be able to upload covers after creating the event. |
Are you talking about being able to edit an existing event? If so, we can also update the editEvent route to follow a similar idea where it can optionally take in a new event cover and upload it to AWS. |
Add option to create event with existing cover url |
Right now, the way event uploads happen is by the following order:
The issue with this is that when an event is created, the
cover
field is required, but in order for a cover URL to exist, the event has to exist, so there's a dependency loop. The way frontend handles this right now is by sending two requests, the first one with a gibberishcover
field that gets immediately updated by the second request. The issue with this, however, is that the requests aren't transacted, so if the upload fails then the event is still created but with a blank cover photo.Since the both our API and the portal frontend require a cover to exist when the event is created, a proposed solution is to combine uploading and event creation in the same route (i.e.
createEvent
andeditEvent
both callStorageService::upload
) so that only 1 call is needed, and so that we can transact those calls.I haven't looked too much into
multipart/form-data
handling withrouting-controllers
, but one thing we need to do is change validation since I don't thinkmultipart/form-data
can have nested objects/fields, so we would have to do:instead of
The text was updated successfully, but these errors were encountered: