Skip to content

Commit 8647f22

Browse files
committed
Project queries moved to the read replica too
1 parent f9cca9f commit 8647f22

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

apps/webapp/app/models/project.server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { nanoid, customAlphabet } from "nanoid";
22
import slug from "slug";
3-
import { prisma } from "~/db.server";
3+
import { $replica, prisma } from "~/db.server";
44
import type { Project } from "@trigger.dev/database";
55
import { Organization, createEnvironment } from "./organization.server";
66
import { env } from "~/env.server";
@@ -135,7 +135,7 @@ export async function createProject(
135135

136136
export async function findProjectBySlug(orgSlug: string, projectSlug: string, userId: string) {
137137
// Find the project scoped to the organization, making sure the user belongs to that org
138-
return await prisma.project.findFirst({
138+
return await $replica.project.findFirst({
139139
where: {
140140
slug: projectSlug,
141141
organization: {
@@ -148,7 +148,7 @@ export async function findProjectBySlug(orgSlug: string, projectSlug: string, us
148148

149149
export async function findProjectByRef(externalRef: string, userId: string) {
150150
// Find the project scoped to the organization, making sure the user belongs to that org
151-
return await prisma.project.findFirst({
151+
return await $replica.project.findFirst({
152152
where: {
153153
externalRef,
154154
organization: {

0 commit comments

Comments
 (0)