feat: unify Person and User creation form with conditional password
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user