🎨 Improve color scheme logic

This commit is contained in:
Meier Lukas
2023-07-29 14:30:19 +02:00
parent c312828c79
commit c165648d5b
10 changed files with 169 additions and 115 deletions

View File

@@ -110,4 +110,27 @@ export const userRouter = createTRPCRouter({
},
});
}),
getWithSettings: protectedProcedure.query(async ({ ctx }) => {
const user = await ctx.prisma.user.findUnique({
where: {
id: ctx.session?.user?.id,
},
include: {
settings: true,
},
});
if (!user || !user.settings) {
throw new TRPCError({
code: 'NOT_FOUND',
message: 'User not found',
});
}
return {
id: user.id,
name: user.name,
settings: user.settings,
};
}),
});

View File

@@ -8,7 +8,7 @@ const globalForPrisma = globalThis as unknown as {
export const prisma =
globalForPrisma.prisma ??
new PrismaClient({
log: env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
log: env.NEXT_PUBLIC_NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
});
if (env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;
if (env.NEXT_PUBLIC_NODE_ENV !== 'production') globalForPrisma.prisma = prisma;