Skip to content

Commit

Permalink
feat(tenant-management): add communication email in user data
Browse files Browse the repository at this point in the history
add communication email in user data

gh-0
  • Loading branch information
Tyagi-Sunny committed Jan 6, 2025
1 parent 3f8bde9 commit 5039a71
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- Migration: Update email fields in leads and contacts tables

-- Step 1: Add new columns to main.leads
ALTER TABLE main.leads
ADD COLUMN communication_email varchar(100);

-- Add comments for new columns in main.leads
COMMENT ON COLUMN main.leads.communication_email IS 'Email used for communication purposes.';

-- Step 4: Add new columns to main.contacts
ALTER TABLE main.contacts
ADD COLUMN communication_email varchar(100);

-- Add comments for new columns in main.contacts
COMMENT ON COLUMN main.contacts.communication_email IS 'Email used for communication purposes.';

-- End of migration
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ export class Contact extends UserModifiableEntity {
})
email: string;

@property({
type: 'string',
description: 'communication email id of the contact',
name: 'communication_email',
})
communicationEmail?: string;

@property({
name: 'is_primary',
type: 'boolean',
Expand Down
6 changes: 6 additions & 0 deletions services/tenant-management-service/src/models/lead.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ export class Lead extends UserModifiableEntity {
})
email: string;

@property({
type: 'string',
description: 'communication email id of the contact',
name: 'communication_email',
})
communicationEmail?: string;
@property({
name: 'is_validated',
type: 'boolean',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class OnboardingService {
firstName: lead.firstName,
lastName: lead.lastName,
email: lead.email,
communicationEmail: lead.communicationEmail,
isValidated: false,
addressId,
}),
Expand Down Expand Up @@ -190,6 +191,7 @@ export class OnboardingService {
await this.contactRepository.create(
{
email: dto.contact.email,
communicationEmail: dto.contact.communicationEmail,
firstName: dto.contact.firstName,
lastName: dto.contact.lastName,
tenantId: tenant.id,
Expand Down

0 comments on commit 5039a71

Please sign in to comment.