Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.
Open
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
13 changes: 12 additions & 1 deletion packages/plugin-cards-api/src/messageBroker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,20 @@ export const initBroker = async cl => {
consumeRPCQueue('cards:deals.create', async ({ subdomain, data }) => {
const models = await generateModels(subdomain);

const deals = await models.Deals.create(data);

const { customerId = '' } = data;

if (customerId) {
await createConformity(subdomain, {
customerIds: [customerId],
mainType: 'deal',
mainTypeId: deals._id
});
}
return {
status: 'success',
data: await models.Deals.create(data)
data: deals
};
});

Expand Down