update account creation fileds

This commit is contained in:
root
2026-05-25 14:05:37 -04:00
parent 813eb5404c
commit 914ae839a7
10 changed files with 448 additions and 50 deletions
@@ -32,12 +32,12 @@ async function generateUniqueSlug(baseName: string) {
}
export async function signup(body: CompanySignupInput) {
if (await repo.findCompanyByEmail(body.email)) {
throw new AppError('A company account with this email already exists', 409, 'email_taken')
if (await repo.findCompanyByEmail(body.companyEmail)) {
throw new AppError('A company account with this contact email already exists', 409, 'company_email_taken')
}
if (await repo.findEmployeeByEmail(body.email)) {
throw new AppError('An employee account with this email already exists', 409, 'email_taken')
throw new AppError('An employee account with this owner email already exists', 409, 'owner_email_taken')
}
const slug = await generateUniqueSlug(body.companyName)
@@ -47,8 +47,10 @@ export async function signup(body: CompanySignupInput) {
const result = await prisma.$transaction((tx) => repo.createCompanySignup(tx, {
companyName: body.companyName,
legalName: body.legalName,
slug,
email: body.email,
ownerEmail: body.email,
companyEmail: body.companyEmail,
companyPhone: body.companyPhone,
streetAddress: body.streetAddress,
city: body.city,
@@ -56,8 +58,21 @@ export async function signup(body: CompanySignupInput) {
zipCode: body.zipCode,
legalForm: body.legalForm,
managerName: `${body.firstName} ${body.lastName}`.trim(),
iceNumber: body.iceNumber,
taxId: body.taxId,
operatingLicenseNumber: body.operatingLicenseNumber,
operatingLicenseIssuedAt: body.operatingLicenseIssuedAt,
operatingLicenseIssuedBy: body.operatingLicenseIssuedBy,
fax: body.fax,
yearsActive: body.yearsActive,
representativeName: body.representativeName,
representativeTitle: body.representativeTitle,
responsibleName: body.responsibleName,
responsibleRole: body.responsibleRole,
responsibleIdentityNumber: body.responsibleIdentityNumber,
responsibleQualification: body.responsibleQualification,
responsiblePhone: body.responsiblePhone,
responsibleEmail: body.responsibleEmail,
currency: body.currency,
registrationNumber: body.registrationNumber,
plan: body.plan,