feat(db): add deletedAt audit timestamp to soft-deletable models
Add deletedAt DateTime? to User, Client, Role, Resource, and Blueprint models for GDPR-compliant deactivation audit trail. Soft-delete mutations now stamp deletedAt: new Date() on deactivation and clear it on reactivation. Migration and test assertions updated accordingly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -202,7 +202,7 @@ export const resourceMutationProcedures = {
|
||||
const resource = await ctx.db.$transaction(async (tx) => {
|
||||
const result = await tx.resource.update({
|
||||
where: { id: input.id },
|
||||
data: { isActive: false },
|
||||
data: { isActive: false, deletedAt: new Date() },
|
||||
});
|
||||
|
||||
await tx.auditLog.create({
|
||||
@@ -227,7 +227,7 @@ export const resourceMutationProcedures = {
|
||||
const updated = await ctx.db.$transaction(async (tx) => {
|
||||
const results = await Promise.all(
|
||||
input.ids.map((id) =>
|
||||
tx.resource.update({ where: { id }, data: { isActive: false } }),
|
||||
tx.resource.update({ where: { id }, data: { isActive: false, deletedAt: new Date() } }),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user