feat: enhance profile data structure by adding phone fields for company and personal profiles
This commit is contained in:
parent
edd32feca3
commit
46b36d7edd
@ -1653,7 +1653,7 @@ exports.previewLatestForMe = async (req, res) => {
|
||||
|
||||
// Replace placeholders
|
||||
Object.entries(vars).forEach(([k, v]) => {
|
||||
html = html.replace(new RegExp(`{{\s*${k}\s*}}`, 'g'), String(v ?? ''));
|
||||
html = html.replace(new RegExp(`{{\\s*${k}\\s*}}`, 'g'), String(v ?? ''));
|
||||
});
|
||||
|
||||
// Show a friendly placeholder for signature in preview (not signed yet)
|
||||
|
||||
@ -149,17 +149,21 @@ class CompanyUserRepository {
|
||||
businessType,
|
||||
iban,
|
||||
accountHolderName,
|
||||
companyName
|
||||
companyName,
|
||||
companyPhone,
|
||||
contactPersonName,
|
||||
contactPersonPhone
|
||||
} = profileData;
|
||||
|
||||
await conn.query(
|
||||
`INSERT INTO company_profiles (
|
||||
user_id, company_name, registration_number, address, zip_code, city, country,
|
||||
branch, number_of_employees, business_type, account_holder_name
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
user_id, company_name, registration_number, phone, address, zip_code, city, country,
|
||||
branch, number_of_employees, business_type, contact_person_name, contact_person_phone, account_holder_name
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
company_name = VALUES(company_name),
|
||||
registration_number = VALUES(registration_number),
|
||||
phone = VALUES(phone),
|
||||
address = VALUES(address),
|
||||
zip_code = VALUES(zip_code),
|
||||
city = VALUES(city),
|
||||
@ -167,11 +171,14 @@ class CompanyUserRepository {
|
||||
branch = VALUES(branch),
|
||||
number_of_employees = VALUES(number_of_employees),
|
||||
business_type = VALUES(business_type),
|
||||
contact_person_name = VALUES(contact_person_name),
|
||||
contact_person_phone = VALUES(contact_person_phone),
|
||||
account_holder_name = VALUES(account_holder_name)`,
|
||||
[
|
||||
userId,
|
||||
companyName,
|
||||
registrationNumber || null,
|
||||
companyPhone || null,
|
||||
address || null,
|
||||
zip_code || null,
|
||||
city || null,
|
||||
@ -179,6 +186,8 @@ class CompanyUserRepository {
|
||||
branch || null,
|
||||
numberOfEmployees || null,
|
||||
businessType || null,
|
||||
contactPersonName || null,
|
||||
contactPersonPhone || null,
|
||||
accountHolderName || null
|
||||
]
|
||||
);
|
||||
|
||||
@ -101,6 +101,7 @@ class PersonalUserRepository {
|
||||
zip_code,
|
||||
city, // Added city
|
||||
country,
|
||||
phone,
|
||||
phoneSecondary,
|
||||
emergencyContactName,
|
||||
emergencyContactPhone,
|
||||
@ -119,10 +120,13 @@ class PersonalUserRepository {
|
||||
|
||||
await conn.query(
|
||||
`INSERT INTO personal_profiles (
|
||||
user_id, first_name, last_name, date_of_birth, nationality, address, zip_code, city, country,
|
||||
user_id, first_name, last_name, phone, date_of_birth, nationality, address, zip_code, city, country,
|
||||
phone_secondary, emergency_contact_name, emergency_contact_phone, account_holder_name
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
first_name = VALUES(first_name),
|
||||
last_name = VALUES(last_name),
|
||||
phone = VALUES(phone),
|
||||
date_of_birth = VALUES(date_of_birth),
|
||||
nationality = VALUES(nationality),
|
||||
address = VALUES(address),
|
||||
@ -137,6 +141,7 @@ class PersonalUserRepository {
|
||||
userId,
|
||||
firstName,
|
||||
lastName,
|
||||
phone || null,
|
||||
dateOfBirth,
|
||||
nationality,
|
||||
address,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user