SSHOC / marketplace-curation

Project to manage scripts and auxiliary data, via Python library and Jupyter notebooks, for the curation of the SSH Open Marketplace
0 stars 0 forks source link

delete actors #31

Open laureD19 opened 6 months ago

laureD19 commented 6 months ago

Currently actors attached to items can't be deleted, even when setting the force parameter to true . DELETE /api/actors{id} returns a 400 with "error": "Cannot delete actors that are contributors of active items!"

List here actors that should nonetheless be deleted:

KlausIllmayer commented 6 months ago

Indeed, very strange: the actor 2196 on production is not connected to an active item based on the database. We need to find out, what prevents the deletion of it. Maybe there is a draft connected to the actor? Will do further research.

laureD19 commented 2 months ago

just checked again, and still running into the same issue. I found work-arounds (not ideal) to get rid of annoying actors I wanted to delete. But I still run into a 400 with, for example, on production:

notify also @mkrzmr

mkrzmr commented 2 months ago

when trying to delete actor 2890: get "Cannot delete actors that are contributors of items!" try again with admin account and force = True, but still fails search for all items by 2890 including drafts = lots of results

I know a workaround would be to edit all items, remove 2890 and then delete the actor. But I wonder why force=True with admin account does not delete the actor

mkrzmr commented 2 months ago

Indeed, very strange: the actor 2196 on production is not connected to an active item based on the database. We need to find out, what prevents the deletion of it. Maybe there is a draft connected to the actor? Will do further research.

I used {{ _.host }}/api/actors/2196 with items=true and got some results. The items seem to be drafts? I could not find them through item-search

Edit: Looks like these items are old versions

laureD19 commented 2 months ago

deletion also needed for:

mkrzmr commented 2 months ago

It's the same with these actors. If you use /api/actors/2196 with items=true you see they are connected to items (I suppose old versions) that do not seem to be affected by a force delete

laureD19 commented 2 months ago

Yes, it is the same. Maybe Tomasz can include the exclusion of drafts cases in the force parameter??

Then, I also get another situation. When trying to delete, I get the following error code "error": "Cannot delete actors that are affiliations of other actors!", although I can't see any affiliations when looking for them.

KlausIllmayer commented 1 month ago

Then, I also get another situation. When trying to delete, I get the following error code "error": "Cannot delete actors that are affiliations of other actors!", although I can't see any affiliations when looking for them.

Indeed, all of the eight mentions actors are affiliations of other actors. I can see this in the database but I'm not sure if we are able to see it by using API calls.

KlausIllmayer commented 1 month ago

I don't find an API call to identify if an actor is an affiliation of other actors - so we currently don't have a single API call to identify which actors belong to an affiliation actor id. This is relevant because for deleting the actor who is an affiliation of other actors these affiliations to the other actors must be deleted beforehand. I now see two options:

  1. force deleting an actor also deletes the affiliations
  2. have an API call to identify the actors that have the affiliation of the concerned actor

I guess, we like to go with (1) - what do you think @laureD19 @mkrzmr - if we agree we can create an issue for backend.

KlausIllmayer commented 1 month ago

The reason why some actors can't be deleted are described here: https://github.com/SSHOC/sshoc-marketplace-backend/issues/468