cdp-backend icon indicating copy to clipboard operation
cdp-backend copied to clipboard

Add function for deleting an event (and all it's related information)

Open evamaxfield opened this issue 3 years ago • 3 comments

Feature Description

A clear and concise description of the feature you're requesting.

Add a function and script that will remove all of a single events details

Use Case

Please provide a use case to help us understand your request in context.

If an event processes incorrectly (or just from bad data) it would be useful to remove it easily. An example of where I personally have made a mistake on uploading of events with bad data can be seen here: http://councildataproject.org/self/#/events/8ce513a84175

That event should actually be two events, each with a single session but because I uploaded two meetings with the same body name and the exact same datetime, the second event was added to the first event as a second session.

Solution

Please describe your ideal solution.

A function (and bin script) that will delete a provided event id and all related info under conditions:

  • for each session related to the event
    • delete the transcripts for each session (and the files in storage)
  • delete the event body (if it isn't used by any other event)
  • delete thumbnail file references (and the files in storage)
  • for each event minutes items related to the event
    • delete the referenced minutes item if it isn't used in any other event
    • delete the referenced matter if it isn't used in any other event
    • delete all the matter files if matter / minutes item was used in any other event
    • delete all event minutes item files
    • delete any matter status updates that are referenced to the event minutes item
    • for each vote related to the event minutes item:
      • delete any people (and their roles) that do not have votes on any other event
      • delete the picture file in db and the stored picture file
      • for each role:
        • delete the seat if it is not used by any other person
        • delete the seat image ref and the store image file from storage
      • delete any votes that link to the event / event minutes item
    • delete the event minutes item itself
  • delete any indexed event grams linked to event
  • delete any matter sponsers for matter refs OR people that no longer exist after all of the above
  • delete the event itself

I think I got everything??? schema here

Alternatives

Please describe any alternatives you've considered, even if you've dismissed them.

evamaxfield avatar Feb 17 '22 19:02 evamaxfield