Files
triggerdotdev--trigger.dev/apps/webapp/app/services/org.server.ts
Chris Arderne 4fde283e76 chore: format and lint webapp also (#4056)
#3977 added formatting and linting everywhere else.

This extends it to the webapp.
2026-06-26 13:02:53 +01:00

21 lines
535 B
TypeScript

import { prisma } from "~/db.server";
import { requireUserId } from "./session.server";
export async function requireOrganization(request: Request, organizationSlug: string) {
const userId = await requireUserId(request);
const organization = await prisma.organization.findFirst({
where: {
slug: organizationSlug,
members: { some: { userId } },
deletedAt: null,
},
});
if (!organization) {
throw new Response("Organization not found", { status: 404 });
}
return { organization, userId };
}