Skip to content

Commit 6d6037b

Browse files
authored
fix: enhance multi-tenant support in notification service (#69)
- Updated tenantId handling in jobData to use params.tenantId if available, falling back to getCurrentTenantId(). - Modified createMilestoneDueNotification method to accept tenantId as a parameter. - Adjusted processor logic to pass tenantId from job data, ensuring proper multi-tenant functionality.
1 parent a7f963a commit 6d6037b

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

testplanit/dist/scheduler.js

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testplanit/dist/workers/forecastWorker.js

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testplanit/lib/services/notificationService.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ interface CreateNotificationParams {
1111
relatedEntityId?: string;
1212
relatedEntityType?: string;
1313
data?: any;
14+
tenantId?: string;
1415
}
1516

1617
export class NotificationService {
@@ -27,7 +28,7 @@ export class NotificationService {
2728
try {
2829
const jobData = {
2930
...params,
30-
tenantId: getCurrentTenantId(),
31+
tenantId: params.tenantId ?? getCurrentTenantId(),
3132
};
3233

3334
const job = await notificationQueue.add(JOB_CREATE_NOTIFICATION, jobData, {
@@ -102,7 +103,8 @@ export class NotificationService {
102103
dueDate: Date,
103104
milestoneId: number,
104105
projectId: number,
105-
isOverdue: boolean
106+
isOverdue: boolean,
107+
tenantId?: string
106108
) {
107109
const title = isOverdue ? "Milestone Overdue" : "Milestone Due Soon";
108110
const message = isOverdue
@@ -116,6 +118,7 @@ export class NotificationService {
116118
message,
117119
relatedEntityId: milestoneId.toString(),
118120
relatedEntityType: "Milestone",
121+
tenantId,
119122
data: {
120123
milestoneName,
121124
projectName,

testplanit/workers/forecastWorker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ const processor = async (job: Job) => {
373373
dueDate,
374374
milestone.id,
375375
milestone.project.id,
376-
isOverdue
376+
isOverdue,
377+
job.data.tenantId
377378
);
378379
successCount++;
379380
} catch (error) {

0 commit comments

Comments
 (0)