Skip to content

Commit b3b9844

Browse files
committed
read replica for the test presenter
1 parent fb81d06 commit b3b9844

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

apps/webapp/app/presenters/v3/TestPresenter.server.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { TestSearchParams } from "~/routes/_app.orgs.$organizationSlug.projects.
44
import { sortEnvironments } from "~/utils/environmentSort";
55
import { createSearchParams } from "~/utils/searchParams";
66
import { findCurrentWorkerDeployment } from "~/v3/models/workerDeployment.server";
7+
import { BasePresenter } from "./basePresenter.server";
78

89
type TaskListOptions = {
910
userId: string;
@@ -15,16 +16,10 @@ export type TaskList = Awaited<ReturnType<TestPresenter["call"]>>;
1516
export type TaskListItem = NonNullable<TaskList["tasks"]>[0];
1617
export type SelectedEnvironment = NonNullable<TaskList["selectedEnvironment"]>;
1718

18-
export class TestPresenter {
19-
#prismaClient: PrismaClient;
20-
21-
constructor(prismaClient: PrismaClient = prisma) {
22-
this.#prismaClient = prismaClient;
23-
}
24-
19+
export class TestPresenter extends BasePresenter {
2520
public async call({ userId, projectSlug, url }: TaskListOptions) {
2621
// Find the project scoped to the organization
27-
const project = await this.#prismaClient.project.findFirstOrThrow({
22+
const project = await this._replica.project.findFirstOrThrow({
2823
select: {
2924
id: true,
3025
environments: {
@@ -107,7 +102,7 @@ export class TestPresenter {
107102

108103
async #getTasks(envId: string, isDev: boolean) {
109104
if (isDev) {
110-
return await this.#prismaClient.$queryRaw<
105+
return await this._replica.$queryRaw<
111106
{
112107
id: string;
113108
version: string;

0 commit comments

Comments
 (0)