feat(admin): archive users and their profiles permanently
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { FastifyInstance } from "fastify";
|
||||
import { eq, and } from "drizzle-orm";
|
||||
import { eq, and, isNull } from "drizzle-orm";
|
||||
|
||||
import {
|
||||
authProfiles,
|
||||
@@ -57,7 +57,7 @@ export default async function authProfilesRoutes(server: FastifyInstance) {
|
||||
const forbidden = [
|
||||
"id", "user_id", "tenant_id", "created_at", "updated_at",
|
||||
"updatedAt", "updatedBy", "old_profile_id", "full_name",
|
||||
"branch", "calendar_subscription_token",
|
||||
"branch", "archived_at", "calendar_subscription_token",
|
||||
"calendar_subscription_path", "calendar_subscription_url"
|
||||
]
|
||||
forbidden.forEach(f => delete cleaned[f])
|
||||
@@ -135,7 +135,8 @@ export default async function authProfilesRoutes(server: FastifyInstance) {
|
||||
.where(
|
||||
and(
|
||||
eq(authProfiles.id, id),
|
||||
eq(authProfiles.tenant_id, tenantId)
|
||||
eq(authProfiles.tenant_id, tenantId),
|
||||
isNull(authProfiles.archived_at)
|
||||
)
|
||||
)
|
||||
.returning()
|
||||
|
||||
Reference in New Issue
Block a user