mardi 20 avril 2021

File management in a webapp

I'm working on a CRUD-webapp where certain entities (tasks, orders,...) have multiple linked files. These files can be uploaded, updated and deleted. Many views use the same logic but with differences in the entities linked, capabilities or view. The files are stored on a different server as the metadata and linked entities.

I'm not sure how to manage this. The main goal is this webapp to function well. It should also have clearly readable code. To be sure my question is understood well, I'll give some more concrete questions:

  • I don't know to which degree it is required to handle errors. e.g. a network connection failed while uploading. How to handle this, keep the metadata in sync,... Is it possible to handle every possible error without out of sync data? Is there a degree of incorrectness that is acceptable in general standards. e.g. The upload of the metadata fails. Should I delete the file from the file server again?

  • How do I structure this code? Is it written in a component or a service? Is duplication allowed, because some details are different for each entity and view to avoid to much parameterization.

The application is using the Ember.js framework. Previously I worked on an Angular project where I struggled to get this right as well. I'm more looking for general applicable advice.

I hope this question is clear enough so I don't get downvoted again. If not, just ask questions.




Aucun commentaire:

Enregistrer un commentaire