digitalfabrik / entitlementcard

App for 'Digitale Berechtigungskarten', generally benefit card for volunteers or socially vulnerable groups in Germany. App for Android & iOS + Backend + Administration Web Portal – 100% Open Source.
MIT License
36 stars 3 forks source link

Add validation to importAcceptingStores mutation in the backend #1644

Open seluianova opened 4 days ago

seluianova commented 4 days ago

Is your feature request related to a problem? Please describe. Follow up for #1571

Currently we have csv validation on the administration side, but no validation on the backend. This means that if the request is sent directly to the backend, our validation rules can be violated.

For example:

In the administration we check that the mandatory fields are not null (name, street, houseNumber, postalCode, location). But with a direct request to the backend I can create a store with a null-name.

Or: We validate in the administration, that the categoryId refers to the current project. But in the backend I can save a store with any existing category id.

Or: In the administration we check duplicates by name & address. But the backend allows to create a store with the same name & address, but with a difference in some other fields (like a different description, for example), because in the backend we only consider 2 records as duplicates if they are completely the same.

Describe the solution you'd like Add csv validation to the importAcceptingStores mutation

Describe alternatives you've considered Alternatively we could move the validation entirely to the backend (in order not to implement validation 2 times). If validation errors occur, they can be returned from the backend in the response and displayed in the administration.