diff --git a/services/apps/premium/organizations_enrichment_worker/src/repos/tenant.repo.ts b/services/apps/premium/organizations_enrichment_worker/src/repos/tenant.repo.ts index 599abab029..d88cb4ad28 100644 --- a/services/apps/premium/organizations_enrichment_worker/src/repos/tenant.repo.ts +++ b/services/apps/premium/organizations_enrichment_worker/src/repos/tenant.repo.ts @@ -13,35 +13,19 @@ export class TenantRepository extends RepositoryBase { } async getPremiumTenants(perPage: number, lastId?: string): Promise { - if (lastId) { - return await this.db().any( - ` - select id, - plan - from tenants - where plan in ($(plans:csv)) and id > $(lastId) - order by id - limit ${perPage}; - `, - { - plans: [TenantPlans.Enterprise, TenantPlans.Growth, TenantPlans.Scale], - lastId, - }, - ) - } else { - return await this.db().any( - ` - select id, - plan - from tenants - where plan in ($(plans:csv)) - order by id - limit ${perPage}; - `, - { - plans: [TenantPlans.Enterprise, TenantPlans.Growth, TenantPlans.Scale], - }, - ) - } + return await this.db().any( + ` + select id, + plan + from tenants + where plan in ($(plans:csv)) ${lastId ? 'and id > $(lastId)' : ''} + order by id + limit ${perPage}; + `, + { + plans: [TenantPlans.Enterprise, TenantPlans.Growth, TenantPlans.Scale], + lastId, + }, + ) } }