You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using typeorm and want to leverage its support for soft delete.
Additionally, I want to store the date at which a record has been created / updated / deleted, as well as the id of the user which made the change. So my entity looks somewhat like this:
The dates will all automatically be set by typeorm.
To set createdByUserId and updatedByUserId, I'm using the corresponding hooks (@BeforeCreateOne / @BeforeUpdateOne) and this works fairly well.
The @BeforeDeleteOne however doesn't seem to support altering data in case of a soft delete.
Am I missing something or does anybody have a solution for this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm using typeorm and want to leverage its support for soft delete.
Additionally, I want to store the date at which a record has been created / updated / deleted, as well as the id of the user which made the change. So my entity looks somewhat like this:
The dates will all automatically be set by typeorm.
To set
createdByUserId
andupdatedByUserId
, I'm using the corresponding hooks (@BeforeCreateOne
/@BeforeUpdateOne
) and this works fairly well.The
@BeforeDeleteOne
however doesn't seem to support altering data in case of a soft delete.Am I missing something or does anybody have a solution for this?
Beta Was this translation helpful? Give feedback.
All reactions