This commit is contained in:
2025-07-21 22:56:02 +08:00
parent 9bc42496f5
commit d39efbb62f

View File

@@ -2,6 +2,7 @@ import { Request, Response } from 'express';
import { prisma } from '../config/database'; import { prisma } from '../config/database';
import { AuthRequest } from '../middleware/auth'; import { AuthRequest } from '../middleware/auth';
import bcrypt from 'bcryptjs'; import bcrypt from 'bcryptjs';
import { Prisma } from '@prisma/client';
export const userController = { export const userController = {
// 获取所有用户 (管理员) // 获取所有用户 (管理员)
@@ -229,7 +230,7 @@ export const userController = {
} }
// 使用事务来确保数据一致性 // 使用事务来确保数据一致性
await prisma.$transaction(async (tx) => { await prisma.$transaction(async (tx: Prisma.TransactionClient) => {
// 删除用户现有的所有账号分配 // 删除用户现有的所有账号分配
await tx.accountAssignment.deleteMany({ await tx.accountAssignment.deleteMany({
where: { userId: id } where: { userId: id }