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(condo): DOMA-10773 sendB2BAppPushMessage mutation and pass ticket created message #5667

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

nomerdvadcatpyat
Copy link
Member

@nomerdvadcatpyat nomerdvadcatpyat commented Dec 24, 2024

In this pr:

  • Added sendB2BAppPushMessage mutation that allow to send messages from B2BApp. Added canExecuteSendB2BAppPushMessage and canReadOrganizationEmployees to B2BAppAccessRightSet
  • Renamed B2CAppMessageSetting to AppMessageSetting (DROP old table and CREATE new table for recreate all indexes, migrate data from old table to new). Rename app field to b2cApp, added b2bApp to AppMessageSetting.
    Added read accesses for staff user who is employee in organization with b2bApp from AppMessageSetting.b2bApp
  • Added B2B_APP_MESSAGE_PUSH and PASS_TICKET_CREATED message types

Also tasks related to this feature:

},

isBlacklisted: {
schemaDoc: 'Is message type in black list for this B2CApp',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
schemaDoc: 'Is message type in black list for this B2CApp',
schemaDoc: 'Is message type in black list for this miniapp',

b2cApp,
})

const objs = await AppMessageSetting.getAll(admin, {}, { sortBy: ['updatedAt_DESC'] })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better add filter by id

b2cApp,
})

const objs = await AppMessageSetting.getAll(support, {}, { sortBy: ['updatedAt_DESC'] })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^

Comment on lines +178 to +179
test('can\'t read', async () => {
const objs = await AppMessageSetting.getAll(user, {})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better create a new object and filter by id

})

test('can update', async () => {
const [b2cApp] = await createTestB2CApp(admin)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You create a miniapp before each test, this line can be removed

Suggested change
const [b2cApp] = await createTestB2CApp(admin)

Comment on lines +19 to +27
const userEmployees = await find('OrganizationEmployee', {
deletedAt: null,
organization: { deletedAt: null },
role: { deletedAt: null },
user: { id: user.id },
isBlocked: false,
isRejected: false,
})
const organizationIds = uniq(userEmployees.map(employee => employee.organization))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use getEmployedOrganizationsByPermissions?

to: { user: userFilter },
organization: organizationFilter,
type,
lang: get(organization, ['country', 'locale'], conf.DEFAULT_LOCALE),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use the organization locale or the user locale?

organization: organizationFilter,
app: b2bAppFilter,
type,
meta,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will a third party developer know what data needs to be passed to the meta? Is there any documentation?

Comment on lines +77 to +80
mutations: [
{
access: access.canSendB2BAppPushMessage,
schema: 'sendB2BAppPushMessage(data: SendB2BAppPushMessageInput!): SendB2BAppPushMessageOutput',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a few lines of documentation for this mutation?

Comment on lines +192 to +194
await sendB2BAppPushMessageByTestClient(serviceUser, b2bApp, organization, staffClient.user, {
type: TICKET_CREATED_TYPE,
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TICKET_CREATED_TYPE for sendB2BAppPushMessage?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Spanish there shouldn't be all the templates, just the default?

@nomerdvadcatpyat nomerdvadcatpyat force-pushed the feat/condo/DOMA-10773/sendB2BAppPushMessage branch from cc3932b to f176861 Compare January 26, 2025 13:28
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants