SSHOC / sshoc-marketplace-backend

Code for the backend
Apache License 2.0
2 stars 0 forks source link

Delete actors by force should cover deprecated items #468

Open KlausIllmayer opened 1 month ago

KlausIllmayer commented 1 month ago

When deleting an actor by force, then sometimes it is still not possible to delete an actor even if this actor does not have any visible items. The corresponding call in the source is https://github.com/SSHOC/sshoc-marketplace-backend/blob/f34b26ac9bd8a79b0140bb610856bfece7fe195c/src/main/java/eu/sshopencloud/marketplace/services/actors/ActorService.java#L121-L122 From there you get to https://github.com/SSHOC/sshoc-marketplace-backend/blob/f34b26ac9bd8a79b0140bb610856bfece7fe195c/src/main/java/eu/sshopencloud/marketplace/services/items/ItemsService.java#L312-L314 which then runs this query https://github.com/SSHOC/sshoc-marketplace-backend/blob/f34b26ac9bd8a79b0140bb610856bfece7fe195c/src/main/java/eu/sshopencloud/marketplace/repositories/items/ItemRepository.java#L83-L86 But this query does not differ between the status of the items. Unfortunately, we sometimes have the situation that a DEPRECATED item is still set to active. I'm not sure, why this is the case but this examples exist. Either items with the status DEPRECATED are always set to active=false or when calling the delete actor with force=true it does the deletion also for items that have the status DEPRECATED even if they are active=true. I guess the second option is easier to implement but I'm not aware about side effects. @tparkola is there a reason why DEPRECATED items do have active=true and why they prevent an actor to be deleted even with force=true? Additionally, when looking into the other states that an item can have, we may extend the deletion also on items with status DISAPPROVED. And maybe also to DRAFT as there is otherwise no possibility to delete a DRAFT item. For the other states: APPROVED should block deletion, INGESTED and SUGGESTED also, because they can then be edited or DISAPPROVED.

Discussion and examples to be found in this issue: https://github.com/SSHOC/marketplace-curation/issues/31 - adding @mkrzmr and @laureD19 as watchers.