mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-17 18:51:14 +01:00
🎨 Improve color scheme logic
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user