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
|
// Replace placeholders
|
||||||
Object.entries(vars).forEach(([k, v]) => {
|
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)
|
// Show a friendly placeholder for signature in preview (not signed yet)
|
||||||
|
|||||||
@ -149,17 +149,21 @@ class CompanyUserRepository {
|
|||||||
businessType,
|
businessType,
|
||||||
iban,
|
iban,
|
||||||
accountHolderName,
|
accountHolderName,
|
||||||
companyName
|
companyName,
|
||||||
|
companyPhone,
|
||||||
|
contactPersonName,
|
||||||
|
contactPersonPhone
|
||||||
} = profileData;
|
} = profileData;
|
||||||
|
|
||||||
await conn.query(
|
await conn.query(
|
||||||
`INSERT INTO company_profiles (
|
`INSERT INTO company_profiles (
|
||||||
user_id, company_name, registration_number, address, zip_code, city, country,
|
user_id, company_name, registration_number, phone, address, zip_code, city, country,
|
||||||
branch, number_of_employees, business_type, account_holder_name
|
branch, number_of_employees, business_type, contact_person_name, contact_person_phone, account_holder_name
|
||||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
ON DUPLICATE KEY UPDATE
|
ON DUPLICATE KEY UPDATE
|
||||||
company_name = VALUES(company_name),
|
company_name = VALUES(company_name),
|
||||||
registration_number = VALUES(registration_number),
|
registration_number = VALUES(registration_number),
|
||||||
|
phone = VALUES(phone),
|
||||||
address = VALUES(address),
|
address = VALUES(address),
|
||||||
zip_code = VALUES(zip_code),
|
zip_code = VALUES(zip_code),
|
||||||
city = VALUES(city),
|
city = VALUES(city),
|
||||||
@ -167,11 +171,14 @@ class CompanyUserRepository {
|
|||||||
branch = VALUES(branch),
|
branch = VALUES(branch),
|
||||||
number_of_employees = VALUES(number_of_employees),
|
number_of_employees = VALUES(number_of_employees),
|
||||||
business_type = VALUES(business_type),
|
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)`,
|
account_holder_name = VALUES(account_holder_name)`,
|
||||||
[
|
[
|
||||||
userId,
|
userId,
|
||||||
companyName,
|
companyName,
|
||||||
registrationNumber || null,
|
registrationNumber || null,
|
||||||
|
companyPhone || null,
|
||||||
address || null,
|
address || null,
|
||||||
zip_code || null,
|
zip_code || null,
|
||||||
city || null,
|
city || null,
|
||||||
@ -179,6 +186,8 @@ class CompanyUserRepository {
|
|||||||
branch || null,
|
branch || null,
|
||||||
numberOfEmployees || null,
|
numberOfEmployees || null,
|
||||||
businessType || null,
|
businessType || null,
|
||||||
|
contactPersonName || null,
|
||||||
|
contactPersonPhone || null,
|
||||||
accountHolderName || null
|
accountHolderName || null
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|||||||
@ -101,6 +101,7 @@ class PersonalUserRepository {
|
|||||||
zip_code,
|
zip_code,
|
||||||
city, // Added city
|
city, // Added city
|
||||||
country,
|
country,
|
||||||
|
phone,
|
||||||
phoneSecondary,
|
phoneSecondary,
|
||||||
emergencyContactName,
|
emergencyContactName,
|
||||||
emergencyContactPhone,
|
emergencyContactPhone,
|
||||||
@ -119,10 +120,13 @@ class PersonalUserRepository {
|
|||||||
|
|
||||||
await conn.query(
|
await conn.query(
|
||||||
`INSERT INTO personal_profiles (
|
`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
|
phone_secondary, emergency_contact_name, emergency_contact_phone, account_holder_name
|
||||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
ON DUPLICATE KEY UPDATE
|
ON DUPLICATE KEY UPDATE
|
||||||
|
first_name = VALUES(first_name),
|
||||||
|
last_name = VALUES(last_name),
|
||||||
|
phone = VALUES(phone),
|
||||||
date_of_birth = VALUES(date_of_birth),
|
date_of_birth = VALUES(date_of_birth),
|
||||||
nationality = VALUES(nationality),
|
nationality = VALUES(nationality),
|
||||||
address = VALUES(address),
|
address = VALUES(address),
|
||||||
@ -137,6 +141,7 @@ class PersonalUserRepository {
|
|||||||
userId,
|
userId,
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
|
phone || null,
|
||||||
dateOfBirth,
|
dateOfBirth,
|
||||||
nationality,
|
nationality,
|
||||||
address,
|
address,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user