Skip to content

Commit 85b7f0f

Browse files
committed
Switch to read replica: Job list presenter
1 parent 5069ef6 commit 85b7f0f

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

apps/webapp/app/presenters/JobListPresenter.server.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@ import { User } from "~/models/user.server";
1010
import { z } from "zod";
1111
import { projectPath } from "~/utils/pathBuilder";
1212
import { JobRunStatus } from "@trigger.dev/database";
13+
import { BasePresenter } from "./v3/basePresenter.server";
1314

1415
export type ProjectJob = Awaited<ReturnType<JobListPresenter["call"]>>[0];
1516

16-
export class JobListPresenter {
17-
#prismaClient: PrismaClient;
18-
19-
constructor(prismaClient: PrismaClient = prisma) {
20-
this.#prismaClient = prismaClient;
21-
}
17+
export class JobListPresenter extends BasePresenter {
18+
2219

2320
public async call({
2421
userId,
@@ -39,7 +36,7 @@ export class JobListPresenter {
3936
? { some: { integration: { slug: integrationSlug } } }
4037
: {};
4138

42-
const jobs = await this.#prismaClient.job.findMany({
39+
const jobs = await this._replica.job.findMany({
4340
select: {
4441
id: true,
4542
slug: true,
@@ -106,7 +103,7 @@ export class JobListPresenter {
106103
}[];
107104

108105
if (jobs.length > 0) {
109-
latestRuns = await this.#prismaClient.$queryRaw<
106+
latestRuns = await this._replica.$queryRaw<
110107
{
111108
createdAt: Date;
112109
status: JobRunStatus;

0 commit comments

Comments
 (0)