mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 21:08:12 +00:00
configer the stamp
This commit is contained in:
@@ -13,9 +13,8 @@ import { ExternalProfileRepository } from "../companies/external-profile.reposit
|
||||
* - `companyId` → all portal users linked to the company (external_profiles).
|
||||
* - `companyProfileId` → resolved to its company, then to that company's users.
|
||||
* - `organizationId` → all current employees of the org (backoffice staff).
|
||||
*
|
||||
* NOTE: permission-scoped staff targeting is intentionally unsupported — freight
|
||||
* has no "users-by-permission" lookup. Target explicit userIds or an org instead.
|
||||
* - `permissionKeys` → current employees (any org) holding any of these
|
||||
* permission keys (e.g. department/role-scoped targeting).
|
||||
*/
|
||||
@Injectable()
|
||||
export class NotificationRecipientsService {
|
||||
@@ -82,6 +81,20 @@ export class NotificationRecipientsService {
|
||||
}
|
||||
}
|
||||
|
||||
if (recipients.permissionKeys?.length) {
|
||||
try {
|
||||
for (const uid of await this.backoffice.getEmployeeUserIdsByPermission(
|
||||
recipients.permissionKeys,
|
||||
)) {
|
||||
ids.add(uid);
|
||||
}
|
||||
} catch (err) {
|
||||
this.logger.warn(
|
||||
`Failed to resolve permissionKeys recipients: ${(err as Error).message}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return [...ids];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user