culturecreates / footlight-aggregator

A tool to inject entities from Artsdata to footlight
0 stars 0 forks source link

Enhancement to Aggregator workflow (delete) #77

Closed troughc closed 5 months ago

troughc commented 7 months ago

If an event has been deleted by the Admin, does the aggregator import it during the next scheduled import?

cc @saumier

sahalali commented 7 months ago

Current flow If the event is deleted from the CMS, then during the next import that event will be recreated. Not to import the deleted event during the next import, The user flow should be updated. Currently, we delete the event and its metadata. So we can't track whether it was deleted before or not during the next import.

Impact This needs discussion and will have an impact on GET and POST Event APIs.

Suggestion One idea is to mark the Event as Obsolete rather than deleting it. And the obsolete events can be filtered out while listing events. When an event is updated with at least one change, then the obsolete tag can be removed after the update. So that the event will appear after an update in the source.

Change: Create a new API to obsolete an event. The CMS uses the obsolete event API instead of deleting events.

cc @saumier @troughc

troughc commented 7 months ago

@SuhailAliyar I find your suggestion about marking events 'obsolete' interesting. We should investigate further. cc @saumier

troughc commented 6 months ago

Note for future development - we are planning a notification feature for events that are changed. When that happens we can consider adding an indicator in the UI that shows this event is coming back after deletion because it was changed at the source (this is part of another issue/feature flow).

Please proceed with the backend work described above, i.e. if the user deletes an event from the aggregator, it is set to obsolete so it doesn't come back every week.

After we implement the update feature, when obsolete events change at the source, they can be re-added to the event list.

cc @sahalali @saumier

saumier commented 6 months ago

@troughc Looks good.

sahalali commented 6 months ago

Backend estimation:

  1. Update DELETE /events/id API - mark events type to ARCHIVED (eventState) and change state to DRAFT. This should be added to entity metadata.
  2. POST /events/id - skip updating an event if the event is ARCHIVED (eventState).
  3. Update GET /events - Exclude obsolete classes from listing ARCHIVED (eventState).
  4. Peer review
  5. Unit testing

Estimation: 20 Hours

sahalali commented 6 months ago

@troughc This issue is ready to schedule. Unfortunately, I cant find a tag in aggregator issues 'to be scheduled'.

saumier commented 6 months ago

@troughc How will a user recover if they make a mistake deleting an event by mistake? Maybe a way to view the archived/deleted events and bring them back manually? UX consideration.

dev-aravind commented 6 months ago

@troughc The backend changes are up in staging, the events are now marked as obsolete instead of being deleted from the database.

troughc commented 5 months ago

@dev-aravind is there a way for me to test this?

@saumier regarding: "How will a user recover if they make a mistake deleting an event by mistake? Maybe a way to view the archived/deleted events and bring them back manually? UX consideration." We already warn the user that they are deleting the event permanently. I will think about whether we need another safeguard step to protect users from those kinds of mistakes. This would apply to ANY event they delete (not just ones that were imported via an aggregator). Note: Food for thought - Google uses Trash, and then permanently deletes after 30 days (or when a user manually empties the trash). At that point, the email/photo/document is no longer recoverable. Maybe we could use the same approach if we find it necessary to add another layer.

dev-aravind commented 5 months ago

@troughc The way to test this is by deleting an event created by Aggregator and re running it to check if the event is getting added back to the CMS. PASS condition: The event should not get added back to the CMS.

troughc commented 5 months ago

I am deleting some in staging now :) Can someone run the aggregator for staging to see if they show up again? @sahalali or @dev-aravind ?

In Tout Culture I deleted 2 events added by the salle odyssee aggregator (still draft):

Christophe Dupéré: https://staging.cms.footlight.io/dashboard/6308ef4a7f771f00431d939a/events/add-event/64af64743c19fa0064e77498 Maude landry: https://staging.cms.footlight.io/dashboard/6308ef4a7f771f00431d939a/events/add-event/64a2d1d73c19fa0064e60f57

Question: why do these links work even though I deleted the events? Is it because these events are archived, not truly deleted? so you can find them if you have their id?

thanks. :)

sahalali commented 5 months ago

@dev-aravind I've run the aggregator for all sources today. Can you please verify the events show up again?

dev-aravind commented 5 months ago

@troughc @sahalali I tested staging and the events are not appearing in the event listing page in staging. The links are working because we kept the events in the get events by id API as a failsafe and for future considerations when we are introducing trash and other functionalities mentioned in this comment :)

troughc commented 5 months ago

Tested: PASSED