Skip to content

Commit 7d05490

Browse files
committed
Switch to read replica: OrgBillingPlanPresenter
1 parent 06a05dc commit 7d05490

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

apps/webapp/app/presenters/OrgBillingPlanPresenter.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
import { PrismaClient, prisma } from "~/db.server";
2-
import { logger } from "~/services/logger.server";
31
import { BillingService } from "../services/billing.server";
2+
import { BasePresenter } from "./v3/basePresenter.server";
43

5-
export class OrgBillingPlanPresenter {
6-
#prismaClient: PrismaClient;
7-
8-
constructor(prismaClient: PrismaClient = prisma) {
9-
this.#prismaClient = prismaClient;
10-
}
11-
4+
export class OrgBillingPlanPresenter extends BasePresenter {
125
public async call({ slug, isManagedCloud }: { slug: string; isManagedCloud: boolean }) {
136
const billingPresenter = new BillingService(isManagedCloud);
147
const plans = await billingPresenter.getPlans();
@@ -17,7 +10,7 @@ export class OrgBillingPlanPresenter {
1710
return;
1811
}
1912

20-
const organization = await this.#prismaClient.organization.findFirst({
13+
const organization = await this._replica.organization.findFirst({
2114
where: {
2215
slug,
2316
},
@@ -27,7 +20,7 @@ export class OrgBillingPlanPresenter {
2720
return;
2821
}
2922

30-
const maxConcurrency = await this.#prismaClient.$queryRaw<
23+
const maxConcurrency = await this._replica.$queryRaw<
3124
{ organization_id: string; max_concurrent_runs: BigInt }[]
3225
>`WITH events AS (
3326
SELECT

0 commit comments

Comments
 (0)