Skip to content

Commit

Permalink
Select only tenants with active paid plan (#2037)
Browse files Browse the repository at this point in the history
  • Loading branch information
loicsaintroch authored Jan 8, 2024
1 parent f909317 commit 08f5004
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ export async function weeklyGetNextEmails(): Promise<InputAnalytics[]> {
try {
rows = await svc.postgres.reader.connection().query(`
SELECT id as "tenantId", name as "tenantName"
FROM tenants WHERE "deletedAt" IS NULL;
FROM tenants
WHERE "deletedAt" IS NULL
AND plan IN ('Scale', 'Growth', 'Essential')
AND ("trialEndsAt" > NOW() OR "trialEndsAt" IS NULL);
`)
} catch (err) {
throw new Error(err)
Expand Down

0 comments on commit 08f5004

Please sign in to comment.