fix: consider the case when there is no invitations

This commit is contained in:
savvy-bit 2025-03-23 11:52:45 -07:00
parent 367b1f89a6
commit 997ef0d072

View File

@ -41,7 +41,7 @@ export class WorkspaceInvitationService {
@InjectKysely() private readonly db: KyselyDB,
@InjectQueue(QueueName.BILLING_QUEUE) private billingQueue: Queue,
private readonly environmentService: EnvironmentService,
) {}
) { }
async getInvitations(workspaceId: string, pagination: PaginationOptions) {
let query = this.db
@ -141,6 +141,9 @@ export class WorkspaceInvitationService {
groupIds: validGroups?.map((group: Partial<Group>) => group.id),
}));
// When there is nobody to invite
if (invitesToInsert.length < 1) return;
invites = await trx
.insertInto('workspaceInvitations')
.values(invitesToInsert)