feat: unify Person and User creation form with conditional password

This commit is contained in:
2026-06-16 21:48:59 +02:00
parent e5717461cf
commit 1f5a849bf5
21 changed files with 462 additions and 171 deletions
+11 -3
View File
@@ -6,8 +6,8 @@ import type {
UpdatePersonFormType,
} from "@/schemas/person.schema"
import type { UnifiedCreateFormType } from "@/schemas/user.schema"
import { getUserByEmail } from "@/services/user.service"
import { PersonService } from "@/services/person.service"
import { getUserByEmail } from "@/services/user.service"
type FieldErrors = Record<string, string[]>
@@ -134,8 +134,16 @@ export async function updatePersonUseCase(
export async function createPersonUserUseCase(
input: UnifiedCreateFormType,
): Promise<PersonUseCaseResult> {
const { firstName, lastName, department, email, phone, role, password, isActive } =
input
const {
firstName,
lastName,
department,
email,
phone,
role,
password,
isActive,
} = input
try {
return await prisma.$transaction(async (tx) => {