@prisma-extensions/soft-delete
Version:
Soft Delete can be used to hide records instead of deleting them, making them recoverable later.
33 lines (32 loc) • 602 B
JavaScript
export function softDelete(args) {
return this.update({
...args,
data: {
deletedAt: new Date(),
},
});
}
export function softDeleteMany(args) {
return this.updateMany({
...args,
data: {
deletedAt: new Date(),
},
});
}
export function softRestore(args) {
return this.update({
...args,
data: {
deletedAt: null,
},
});
}
export function softRestoreMany(args) {
return this.updateMany({
...args,
data: {
deletedAt: null,
},
});
}