elixirlabsinc / endslaverynow

Creating the End Slavery Now project
2 stars 0 forks source link

Data integrity #23

Open pedanticantic opened 5 years ago

pedanticantic commented 5 years ago

I noticed that when when deleting a record, there is no code to deal with other records that might be referencing the one that's being deleted. I imagine in most cases, there should be validation to prevent the delete in the first place.

pedanticantic commented 4 years ago

Thinking about this, I wonder if when transforming the raw firebase data to arrays of models (here), we should build up a list of objects (categories, etc) that have children. Then, the delete buttons in the list screens can just check against that data when validating whether the record can be deleted (it'll be much faster and more efficient to do this). And also, it would be nice to tell the user which record(s) depend on the record in question, in which case the data above would have to include an array of the referenced records, rather than just having the record in the list. We may need to think about what happens when some edits a record, and chooses a different parent - do we need to refresh that data, or can we assume the application will always return the to list screen, in which case it'll be re-created anyway?

pedanticantic commented 4 years ago

In the edit screens, we could show a read-only list of records that are dependants of this record, maybe as links so the user can navigate to them?