Compare commits

...

2 Commits

Author SHA1 Message Date
Keith Williams 8514d1415b Fixed authProcedure error 2023-11-21 15:07:28 -03:00
Keith Williams 928151efa5 chore: Testing insights 2023-11-21 15:01:44 -03:00
2 changed files with 6 additions and 3 deletions

View File

@ -5,7 +5,7 @@ import { z } from "zod";
import dayjs from "@calcom/dayjs";
import { rawDataInputSchema } from "@calcom/features/insights/server/raw-data.schema";
import { randomString } from "@calcom/lib/random";
import authedProcedure from "@calcom/trpc/server/procedures/authedProcedure";
import publicProcedure from "@calcom/trpc/server/procedures/publicProcedure";
import { router } from "@calcom/trpc/server/trpc";
import { TRPCError } from "@trpc/server";
@ -17,7 +17,7 @@ const UserBelongsToTeamInput = z.object({
isAll: z.boolean().optional(),
});
const userBelongsToTeamProcedure = authedProcedure.use(async ({ ctx, next, rawInput }) => {
const userBelongsToTeamProcedure = publicProcedure.use(async ({ ctx, next, rawInput }) => {
const parse = UserBelongsToTeamInput.safeParse(rawInput);
if (!parse.success) {
throw new TRPCError({ code: "BAD_REQUEST" });
@ -35,6 +35,8 @@ const userBelongsToTeamProcedure = authedProcedure.use(async ({ ctx, next, rawIn
membershipWhereConditional["teamId"] = parse.data.teamId;
}
console.log(ctx.insightsDb);
const membership = await ctx.insightsDb.membership.findFirst({
where: membershipWhereConditional,
});
@ -1134,7 +1136,7 @@ export const insightsRouter = router({
return result;
}),
teamListForUser: authedProcedure.query(async ({ ctx }) => {
teamListForUser: publicProcedure.query(async ({ ctx }) => {
const user = ctx.user;
// Fetch user data

View File

@ -51,6 +51,7 @@ export type GetSessionFn =
* @see https://trpc.io/docs/context#inner-and-outer-context
*/
export async function createContextInner(opts: CreateInnerContextOptions) {
console.log(readonlyPrisma);
return {
prisma,
insightsDb: readonlyPrisma,