#Delete user hook

8 messages · Page 1 of 1 (latest)

undone oakBOT
#

Thanks for posting! This is a community powered server, so you may or may not get an answer based on available help and expertise. To increase your chances of somebody being able to help you, please make sure your question includes the following:

  • An explanation of exactly what you're trying to achieve.
  • Any and all related code or previous attempts.
  • The exact issue or error you are facing.
  • Any screenshots if applicable.

When you're done with this thread, please close it.

(If you have a support agreement and need help, please contact the core team via email.)

warm matrix
#

Thanks in advance!

warm matrix
# warm matrix

UPDATE: I need to know what I have to return in the case that the user have orders or the way to stop this call

tender oasis
#

using users.delete as an action to specifically not delete the user is a bit contradictory, returning a successful result in the last function will delete the user hence making the status irrelevant.

#

i would suggest creating a filter flow you can trigger on the users collection that reads the number of items in orders linked to the user. if the count >=1, updates the user to suspended status, otherwise an action to delete the item in the user collection matching the user id

#

i suppose you COULD make it a users.delete check but you would very specifically want to return a null payload on your success path

warm matrix
#

@tender oasis hello! at first thanks you