From 2d8a282cec286f0493715fbad96d4168818205e6 Mon Sep 17 00:00:00 2001
From: PxlLoewe <72106766+PxlLoewe@users.noreply.github.com>
Date: Fri, 30 Jan 2026 19:00:01 +0100
Subject: [PATCH] add log for delet account
---
apps/dispatch/next-env.d.ts | 2 +-
apps/hub/app/(app)/admin/user/action.ts | 2 ++
apps/hub/app/(auth)/passwort-reset/action.ts | 1 +
apps/hub/app/(auth)/register/action.ts | 15 +++++++++------
.../migration.sql | 2 ++
5 files changed, 15 insertions(+), 7 deletions(-)
create mode 100644 packages/database/prisma/schema/migrations/20260130175515_add_delete_account_log/migration.sql
diff --git a/apps/dispatch/next-env.d.ts b/apps/dispatch/next-env.d.ts
index 9edff1c7..c4b7818f 100644
--- a/apps/dispatch/next-env.d.ts
+++ b/apps/dispatch/next-env.d.ts
@@ -1,6 +1,6 @@
///
///
-import "./.next/types/routes.d.ts";
+import "./.next/dev/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
diff --git a/apps/hub/app/(app)/admin/user/action.ts b/apps/hub/app/(app)/admin/user/action.ts
index b3b9613e..73a97e4e 100644
--- a/apps/hub/app/(app)/admin/user/action.ts
+++ b/apps/hub/app/(app)/admin/user/action.ts
@@ -3,6 +3,7 @@ import { prisma, Prisma } from "@repo/db";
import bcrypt from "bcryptjs";
import { sendMailByTemplate } from "../../../../helper/mail";
import { getServerSession } from "api/auth/[...nextauth]/auth";
+import { logAction } from "(auth)/login/_components/action";
export const getUser = async (where: Prisma.UserWhereInput) => {
return await prisma.user.findMany({
@@ -58,6 +59,7 @@ export const deletePilotHistory = async (id: number) => {
});
};
export const deleteUser = async (id: string) => {
+ await logAction("ACCOUNT_DELETED");
return await prisma.user.update({
where: {
id: id,
diff --git a/apps/hub/app/(auth)/passwort-reset/action.ts b/apps/hub/app/(auth)/passwort-reset/action.ts
index d4d7b8bb..425623ea 100644
--- a/apps/hub/app/(auth)/passwort-reset/action.ts
+++ b/apps/hub/app/(auth)/passwort-reset/action.ts
@@ -11,6 +11,7 @@ export const resetPassword = async (email: string) => {
let user = await prisma.user.findFirst({
where: {
email,
+ isDeleted: false,
},
});
const oldUser = (v1User as OldUser[]).find((u) => u.email.toLowerCase() === email);
diff --git a/apps/hub/app/(auth)/register/action.ts b/apps/hub/app/(auth)/register/action.ts
index 6ba13948..4a55dfdc 100644
--- a/apps/hub/app/(auth)/register/action.ts
+++ b/apps/hub/app/(auth)/register/action.ts
@@ -24,9 +24,6 @@ export const register = async ({ password, ...user }: Omit