I am working on a personal project like social media (Reddit, Instagram) where we can upload image or short videos and I am using cloud storage to upload images and videos ( Cloudinary ) and I am storing the URL in DB.
I am facing an issue while updating the post I want to delete images from the cloud and again I have to upload the new file (image/video) in Cloud storage and update the URL in the DB. So a total of 3 network calls is required while performing the update operation which is very expensive and I want to minimize it.
My Solution: I am thinking of not performing the delete operation which will save a network call but it will waste my storage as those images/videos won't be required.
I am looking for a better solution where I can save the storage in the cloud as well as save a network call.
Thanks in Advance