fix(gdpr): radera user_terms_consents vid kontoradering + klassa i residual-testet
CI / Typecheck, test & build (push) Successful in 11m6s

This commit is contained in:
Sven (AAMOS AI)
2026-08-14 00:45:42 +07:00
parent e96213e907
commit 0d1cc727ae
2 changed files with 13 additions and 0 deletions
+2
View File
@@ -390,6 +390,7 @@ describe("DELETE /v1/me — GDPR residual completeness", () => {
password_reset_tokens: ["user_id"],
refresh_tokens: ["user_id"],
user_consents: ["user_id"],
user_terms_consents: ["user_id"],
user_preferences: ["user_id"],
user_health_profiles: ["user_id"],
user_locale_preferences: ["user_id"],
@@ -446,6 +447,7 @@ describe("DELETE /v1/me — GDPR residual completeness", () => {
["password_reset_tokens", "user_id"],
["refresh_tokens", "user_id"],
["user_consents", "user_id"],
["user_terms_consents", "user_id"],
["user_preferences", "user_id"],
["user_health_profiles", "user_id"],
["user_locale_preferences", "user_id"],
+11
View File
@@ -188,6 +188,17 @@ export async function eraseUser(db: Database, userId: string): Promise<ErasureLo
count: consentsDel.length,
});
const termsConsentsDel = await db
.delete(schema.userTermsConsents)
.where(eq(schema.userTermsConsents.userId, userId))
.returning({ userId: schema.userTermsConsents.userId });
if (termsConsentsDel.length)
log.push({
table: getTableName(schema.userTermsConsents),
action: "delete",
count: termsConsentsDel.length,
});
const idemDel = await db
.delete(schema.idempotencyKeys)
.where(eq(schema.idempotencyKeys.userId, userId))