Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tenant-management): add communication email in user data #57

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -119,6 +120,7 @@ export class OnboardingService {
...dto,
contact: new Contact({
email: existing.email,
communicationEmail: existing.communicationEmail,
type: 'admin',
firstName: existing.firstName,
lastName: existing.lastName,
Expand Down Expand Up @@ -190,6 +192,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
Loading