❔ How to best upload images to an entity that doesn't yet exist
Not sure if the title makes sense. When you create an accomodation, you can also upload images. But uploading images to blob storage is a different endpoint and it takes in the id of the accomodation... which doesn't yet exist.
All the solutions I've come up with seem long-winded and overly complex.
8 Replies
Basically, the problem is, you need an identifier to associate with the uploaded file but that identifier doesn't exist yet since the db record isn't yet created
partial class?
@Predanot sure it solves the problem. The problem is that I dont want accomodations created without a photo. It's easy to disjoint the process of creating an accomodation and uploading images, but i'm not sure a partial class will allow me to require photo uploads during hte creation of an accomodation
You can always try
@Preda Whayt about just queueing the endpoint calls on the frontend?
or a conditional trigger
trigger first endpoint 1 to create listing and if it succeeds and returns id uploda photo
You didn t mention anything about a website
Don't make it a separate endpoint, handle it all in the same one
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.