chore: format

This commit is contained in:
2025-10-10 16:43:21 +02:00
parent f0aabd63b6
commit 75c29e0ba4
551 changed files with 433948 additions and 94145 deletions

View File

@@ -1,46 +1,46 @@
import { z } from "zod"
import { authProcedure } from "../trpc"
import { prisma } from "../utils/prisma"
import { TRPCError } from "@trpc/server"
import { z } from "zod";
import { authProcedure } from "../trpc";
import { prisma } from "../utils/prisma";
import { TRPCError } from "@trpc/server";
export const getOrganizationById = authProcedure
.input(
z.object({
id: z.string(),
})
)
.query(async ({ ctx, input }) => {
const userOrg = await prisma.userOrganization.findFirst({
where: {
userId: ctx.user.id,
organizationId: input.id,
},
})
.input(
z.object({
id: z.string(),
}),
)
.query(async ({ ctx, input }) => {
const userOrg = await prisma.userOrganization.findFirst({
where: {
userId: ctx.user.id,
organizationId: input.id,
},
});
if (!userOrg) {
throw new TRPCError({
code: "UNAUTHORIZED",
message: "You do not have access to this organization.",
})
}
if (!userOrg) {
throw new TRPCError({
code: "UNAUTHORIZED",
message: "You do not have access to this organization.",
});
}
const organization = await prisma.organization.findUnique({
where: { id: input.id },
select: {
id: true,
name: true,
description: true,
createdAt: true,
updatedAt: true,
},
})
const organization = await prisma.organization.findUnique({
where: { id: input.id },
select: {
id: true,
name: true,
description: true,
createdAt: true,
updatedAt: true,
},
});
if (!organization) {
throw new TRPCError({
code: "NOT_FOUND",
message: "Organization not found.",
})
}
if (!organization) {
throw new TRPCError({
code: "NOT_FOUND",
message: "Organization not found.",
});
}
return organization
})
return organization;
});