feat: billing sync (cloud) (#899)

* Set page history to 5 minutes interval

* * Configure default queue options

* sync

* * stripe seats sync (cloud)
This commit is contained in:
Philip Okugbe
2025-03-17 11:00:23 +00:00
committed by GitHub
parent 21c3ad0ecc
commit f45bdddb23
8 changed files with 44 additions and 14 deletions

View File

@ -24,6 +24,10 @@ import { nanoIdGen } from '../../../common/helpers';
import { PaginationOptions } from '@docmost/db/pagination/pagination-options';
import { executeWithPagination } from '@docmost/db/pagination/pagination';
import { DomainService } from 'src/integrations/environment/domain.service';
import { InjectQueue } from '@nestjs/bullmq';
import { QueueJob, QueueName } from '../../../integrations/queue/constants';
import { Queue } from 'bullmq';
import { EnvironmentService } from '../../../integrations/environment/environment.service';
@Injectable()
export class WorkspaceInvitationService {
@ -35,6 +39,8 @@ export class WorkspaceInvitationService {
private domainService: DomainService,
private tokenService: TokenService,
@InjectKysely() private readonly db: KyselyDB,
@InjectQueue(QueueName.BILLING_QUEUE) private billingQueue: Queue,
private readonly environmentService: EnvironmentService,
) {}
async getInvitations(workspaceId: string, pagination: PaginationOptions) {
@ -266,6 +272,10 @@ export class WorkspaceInvitationService {
});
}
if (this.environmentService.isCloud()) {
await this.billingQueue.add(QueueJob.STRIPE_SEATS_SYNC, { workspaceId });
}
return this.tokenService.generateAccessToken(newUser);
}