Skip to content

Commit

Permalink
feat(engage): introduce client portal notification type in engage plu…
Browse files Browse the repository at this point in the history
…gin (#4915)

* Added notification, cpId to engages

* Updated push notification in campaign

* Update engageUtils.ts

---------

Co-authored-by: soyombo <e11iot.soko@gmail.com>
  • Loading branch information
Daarii and soyombo-baterdene committed Jan 23, 2024
1 parent 433630d commit c7999e8
Show file tree
Hide file tree
Showing 19 changed files with 725 additions and 101 deletions.
12 changes: 12 additions & 0 deletions packages/plugin-clientportal-api/src/messageBroker.ts
Expand Up @@ -50,6 +50,18 @@ export const initBroker = async () => {
},
);

consumeRPCQueue(
'clientportal:clientPortalUsers.getIds',
async ({ subdomain, data }) => {
const models = await generateModels(subdomain);

return {
status: 'success',
data: await models.ClientPortalUsers.find(data).distinct('_id'),
};
},
);

consumeRPCQueue(
'clientportal:clientPortalUsers.create',
async ({ subdomain, data }) => {
Expand Down
2 changes: 0 additions & 2 deletions packages/plugin-contacts-api/src/utils.ts
Expand Up @@ -30,7 +30,6 @@ import { companySchema } from './models/definitions/companies';
import { ICustomField, ILink } from '@erxes/api-utils/src/types';
import { fetchEs } from '@erxes/api-utils/src/elasticsearch';
import { customFieldsDataByFieldCode } from '@erxes/api-utils/src/fieldUtils';
import { sendCommonMessage } from './messageBroker';

const EXTEND_FIELDS = {
CUSTOMER: [
Expand Down Expand Up @@ -535,7 +534,6 @@ export const prepareEngageCustomers = async (
await editorAttributeUtil.getCustomerFields(emailContent);

const exists = { $exists: true, $nin: [null, '', undefined] };

// make sure email & phone are valid
if (engageMessage.method === 'email') {
customersSelector.primaryEmail = exists;
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-engages-api/src/constants.ts
Expand Up @@ -133,7 +133,8 @@ export const CAMPAIGN_METHODS = {
MESSENGER: 'messenger',
EMAIL: 'email',
SMS: 'sms',
ALL: ['messenger', 'email', 'sms']
NOTIFICATION: 'notification',
ALL: ['messenger', 'email', 'sms', 'notification']
};

export const MESSENGER_KINDS = {
Expand Down

0 comments on commit c7999e8

Please sign in to comment.