Event model is currently defined with paranoid: true. This causes a soft deletion to happen when an event is deleted so the deletedAt is set to non-null timestamp and the event is not actually deleted.
checkSlugAvailability doesn't take into account soft deleted events so it returns available to frontend when a slug that is used in a previous soft deleted event is used again. However trying to save the event causes a unique constraint conflict since slug is defined as unique.
Possible fixes would to be actually delete the event completely on deletion, checking also soft deleted events in checkSlugAvailability or upserting the soft deleted event on trying to use the same slug.
Event model is currently defined with
paranoid: true
. This causes a soft deletion to happen when an event is deleted so the deletedAt is set to non-null timestamp and the event is not actually deleted.checkSlugAvailability doesn't take into account soft deleted events so it returns available to frontend when a slug that is used in a previous soft deleted event is used again. However trying to save the event causes a unique constraint conflict since slug is defined as unique.
Possible fixes would to be actually delete the event completely on deletion, checking also soft deleted events in checkSlugAvailability or upserting the soft deleted event on trying to use the same slug.
In FK repo, fixed this with just checking also soft deleted events. https://github.com/fyysikkokilta/ilmomasiina/commit/1e5240757f155d6637c2144f13d90fef224e230d