i need to change an attribute archived when my object is deleted, there are any ways to stop my DeleteHook from processing the delete itself?
what was the solution? beforeDelete?
beforeDelete: [
async ({ req, id }) => {
await req.payload.db.collections.messages.updateOne(
{ _id: id },
{ $set: { status: 'deleted' } },
)
throw new APIError('Soft-delete', 200)
},
],
Star
Discord
online
Get dedicated engineering support directly from the Payload team.