NicoFish
NicoFish
Explore posts from servers
PPrisma
Created by NicoFish on 10/9/2024 in #help-and-questions
Extending client not typesafe
@SHG-TV does it return a typesafe controller? I tried it with $allModels $allOperations and it didn't work
7 replies
PPrisma
Created by NicoFish on 10/9/2024 in #help-and-questions
Extending client not typesafe
Changing return type of query extension does not change the return type when calling the function
7 replies
PPrisma
Created by NicoFish on 10/9/2024 in #help-and-questions
Extending client not typesafe
@Jon Harrell sorry for the ping, do you have any idea?
7 replies
TtRPC
Created by NicoFish on 4/28/2024 in #❓-help
Change db url in ctx with an API call
And this is my prisma def:
import { PrismaClient } from '@prisma/client';

declare global {
// eslint-disable-next-line no-var
var prisma: PrismaClient | undefined;
}

export let prisma =
global.prisma ||
new PrismaClient({
log: process.env.NODE_ENV === 'development' ? ['error', 'warn'] : ['error'],
});

if (process.env.NODE_ENV !== 'production') {
global.prisma = prisma;
}
import { PrismaClient } from '@prisma/client';

declare global {
// eslint-disable-next-line no-var
var prisma: PrismaClient | undefined;
}

export let prisma =
global.prisma ||
new PrismaClient({
log: process.env.NODE_ENV === 'development' ? ['error', 'warn'] : ['error'],
});

if (process.env.NODE_ENV !== 'production') {
global.prisma = prisma;
}
4 replies
TtRPC
Created by NicoFish on 4/28/2024 in #❓-help
Change db url in ctx with an API call
This is how I create the context:
export const createTRPCContext = async (opts: { headers: Headers }) => {
const session = await getServerAuthSession();

return {
session,
prisma,
...opts,
};
};
export const createTRPCContext = async (opts: { headers: Headers }) => {
const session = await getServerAuthSession();

return {
session,
prisma,
...opts,
};
};
4 replies