@sourceloop/ctrl-plane-tenant-management-service / Exports / OnboardingService
Class: OnboardingService¶
Helper service for onboarding tenants.
Table of contents¶
Constructors¶
Properties¶
Methods¶
Constructors¶
constructor¶
• new OnboardingService(leadRepository, tenantRepository, contactRepository, addressRepository, leadAuthenticator, logger)
Constructs a new instance of the OnboardingService.
Parameters¶
| Name | Type | Description |
|---|---|---|
leadRepository |
LeadRepository<Lead> |
Repository for managing leads. |
tenantRepository |
TenantRepository<Tenant> |
Repository for managing tenants. |
contactRepository |
ContactRepository<Contact> |
Repository for managing contacts. |
addressRepository |
AddressRepository<Address> |
Repository for managing addresses. |
leadAuthenticator |
LeadAuthenticator |
Service for authenticating leads. |
logger |
ILogger |
Logger service for logging messages. |
Defined in¶
services/tenant-management-service/src/services/onboarding.service.ts:33
Properties¶
addressRepository¶
• Private addressRepository: AddressRepository<Address>
Repository for managing addresses.
Defined in¶
services/tenant-management-service/src/services/onboarding.service.ts:41
contactRepository¶
• Private contactRepository: ContactRepository<Contact>
Repository for managing contacts.
Defined in¶
services/tenant-management-service/src/services/onboarding.service.ts:39
leadAuthenticator¶
• Private leadAuthenticator: LeadAuthenticator
Service for authenticating leads.
Defined in¶
services/tenant-management-service/src/services/onboarding.service.ts:43
leadRepository¶
• Private leadRepository: LeadRepository<Lead>
Repository for managing leads.
Defined in¶
services/tenant-management-service/src/services/onboarding.service.ts:35
logger¶
• Private logger: ILogger
Logger service for logging messages.
Defined in¶
services/tenant-management-service/src/services/onboarding.service.ts:45
tenantRepository¶
• Private tenantRepository: TenantRepository<Tenant>
Repository for managing tenants.
Defined in¶
services/tenant-management-service/src/services/onboarding.service.ts:37
Methods¶
addLead¶
▸ addLead(lead): Promise<{ id: string = newLead.id; key: string }>
The addLead function creates a new lead, triggers a validation email, and returns the new lead.
Parameters¶
| Name | Type | Description |
|---|---|---|
lead |
Omit<CreateLeadDTO, "id" | "addressId" | "isValidated"> |
The lead parameter is an object of type Lead with the id property omitted. |
Returns¶
Promise<{ id: string = newLead.id; key: string }>
The addLead function is returning the newly created lead object.
Defined in¶
services/tenant-management-service/src/services/onboarding.service.ts:54
onboard¶
▸ onboard(dto, lead?): Promise<Tenant>
The setupTenant function creates a new tenant with the provided information and an optional lead,
and returns the created tenant.
Parameters¶
| Name | Type | Description |
|---|---|---|
dto |
TenantOnboardDTO |
The dto parameter is an object of type TenantOnboardDTO which contains the necessary information to onboard a new tenant. It includes properties such as key, country, address, city, state, zip, and name. |
lead? |
Lead |
The lead parameter is an optional parameter of type Lead. It represents the lead associated with the tenant being onboarded. If a lead is provided, their information will be used to create a contact for the tenant. If no lead is provided, the contact will not be created. |
Returns¶
Promise<Tenant>
a Promise that resolves to a Tenant object.
Defined in¶
services/tenant-management-service/src/services/onboarding.service.ts:150
onboardForLead¶
▸ onboardForLead(dto, lead, id): Promise<Tenant>
The startOnboarding function checks if a lead user exists and is validated, and if not, updates the lead user's validation status and triggers tenant creation.
Parameters¶
| Name | Type | Description |
|---|---|---|
dto |
Omit<TenantOnboardDTO, "contact"> |
- |
lead |
LeadUser |
The lead parameter is an object of type LeadUser. It represents a lead user who is going through the onboarding process. |
id |
string |
- |
Returns¶
Promise<Tenant>
Defined in¶
services/tenant-management-service/src/services/onboarding.service.ts:96