Skip to content

Commit

Permalink
fix(businessportal): fix cp user related cards
Browse files Browse the repository at this point in the history
  • Loading branch information
soyombo-baterdene committed Jan 3, 2024
1 parent b1be746 commit 49e4620
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -58,7 +58,7 @@ export const loadUserCardClass = (models: IModels) => {

public static async getUserIds(contentType: string, contentTypeId: string) {
// aggregate and return array of cpUserId field of ClientPortalUserCards
const userIds = await models.ClientPortalUserCards.aggregate([
const cards = await models.ClientPortalUserCards.aggregate([
{
$match: {
contentType,
Expand All @@ -72,7 +72,7 @@ export const loadUserCardClass = (models: IModels) => {
}
]);

return userIds.map((user: any) => user.cpUserId);
return cards.map((user: any) => user.cpUserId);
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-clientportal-api/src/models/utils.ts
Expand Up @@ -246,7 +246,7 @@ export const createCard = async (subdomain, models, cpUser, doc) => {
subdomain,
action: `${type}s.create`,
data: {
userId: cpUser._id,
userId: cpUser.userId,
name: subject,
description,
priority,
Expand All @@ -269,7 +269,7 @@ export const createCard = async (subdomain, models, cpUser, doc) => {
await models.ClientPortalUserCards.createOrUpdateCard({
contentType: type,
contentTypeId: card._id,
cpUserId: cpUser._id
cpUserId: cpUser.userId
});

return card;
Expand Down

0 comments on commit 49e4620

Please sign in to comment.