Skip to content

Commit e82d01a

Browse files
committed
chore: linting and tests
1 parent ea9ecda commit e82d01a

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

controlplane/src/bin/db-cleanup.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,7 @@ async function queueOrganizationsForDeletion({
130130
isNull(schema.organizations.queuedForDeletionAt),
131131
eq(schema.organizations.isDeactivated, false),
132132
lt(schema.organizations.createdAt, inactivityThreshold),
133-
or(
134-
isNull(schema.organizationBilling.plan),
135-
eq(schema.organizationBilling.plan, 'developer'),
136-
),
133+
or(isNull(schema.organizationBilling.plan), eq(schema.organizationBilling.plan, 'developer')),
137134
),
138135
)
139136
.groupBy(schema.organizations.id, schema.organizationBilling.plan)
@@ -209,8 +206,8 @@ async function processChunkOfOrganizations({
209206
// Queue the organization deletion notification job
210207
await notifyOrganizationDeletionQueuedQueue.addJob({
211208
organizationId: org.id,
212-
queuedAt: queuedAt.getTime(),
213-
deletesAt: deletesAt.getTime(),
209+
queuedAt: Number(queuedAt),
210+
deletesAt: Number(deletesAt),
214211
});
215212
}
216213
}

controlplane/src/core/workers/NotifyOrganizationDeletionQueuedWorker.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ class NotifyOrganizationDeletionQueuedWorker implements IWorker {
8585

8686
const organizationMembers = await orgRepo.getMembers({ organizationID: org.id });
8787
const orgAdmins = organizationMembers.filter((m) => m.rbac.isOrganizationAdmin);
88+
if (orgAdmins.length === 0) {
89+
this.input.logger.warn({ organizationId: org.id }, 'No admins found for organization, skipping notification');
90+
return;
91+
}
8892

8993
const intl = Intl.DateTimeFormat(undefined, {
9094
dateStyle: 'medium',

controlplane/test/test-util.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ export const SetupTest = async function ({
416416
deactivateOrganizationQueue,
417417
deleteUserQueue,
418418
reactivateOrganizationQueue,
419+
notifyOrganizationDeletionQueuedQueue,
419420
},
420421
};
421422
};

0 commit comments

Comments
 (0)