Calling a trpc endpoint inside of a trpc endpoint

Hey all. I'm wondering how I am able to call these endpoints from within themselves? For example, I'd like to call getBotGuilds and getUserGuilds from within getAllGuilds.
export const guildRouter = createTRPCRouter({
getBotGuilds: protectedProcedure.query(({ ctx }) => {
}),
getUserGuilds: protectedProcedure.query(({ ctx }) => {

return [];
}),
getAllGuilds: protectedProcedure.query(({ ctx }) => {

}),
});
export const guildRouter = createTRPCRouter({
getBotGuilds: protectedProcedure.query(({ ctx }) => {
}),
getUserGuilds: protectedProcedure.query(({ ctx }) => {

return [];
}),
getAllGuilds: protectedProcedure.query(({ ctx }) => {

}),
});
AK
Alex / KATT 🐱440d ago
@cje did a video on this but I'm not on my laptop to find it Tldr don't do it
R
rustclan440d ago
Oh.. okay. If not this, how else?
UU
Unknown User440d ago
AK
Alex / KATT 🐱440d ago
Christopher Ehrlich
YouTube
Advanced tRPC - Callers, functions, and gSSP
Repo for this video: https://github.com/c-ehrlich/you-dont-need-callers If you want to use schema in the frontend, they cannot be imported from the same file as things that run specifically in the backend. One solution would be to put them into a procedureName.schema.ts or similar file. tRPC: https://trpc.io/docs Create T3 App: https://crea...
R
rustclan440d ago
Thanks for the responses guys. 🙂
More Posts
Frozen input paramIs it possible to define a parameter on input schema (zod) that will have a hardcoded/frozen value wtype mismatch between tRPC return (in sveltekit) and defined typei've got this piece of code: ```ts read: async () => { const res = await trpc($page).getCards.querpre fetch serveral prodecures dynamicallyHello!. I'm developing a React Native app which needs an offline mode for some assets that the user procedure input contextIs it possible to accesss context in trpc procedure input validation? I have an aray of values in tIs it normal to separate resolvers from routers?Wondering if it's common and/or whether it's a good idea to attempt to separate procedures from the i have an infinite loop within my hook but apps works as expected.when i console log inside this hook, it repeats non-stop every few seconds, but my app is working astrpc query running twiceHey guys. I have a trpc endpoint which makes a request to the discord api to fetch a list of the usetRPC Call To ServerOn the mobile version of my app, in NextJS, the build has to be static so I have to use my hosted weGet count of stages assigned to user with stage name?Need help in writing prisma query to get stages assigned to user with stage name? this is the schemeTRPC global loading pageHey. With trpc/nextjs I'm wondering if its possible to have a global loading context/state which is Multiple Clients/Services In tRPC ContextI know it's typical to pass around the prisma client in the trpc context, is the same true for otherUse middleware to send responseHello, how can I send a response from the middleware without executing the input, such as making a cdynamic router creationhas anyone been able to create a dynamic router? e.g. i pass in the schema and some metadata and it Type issue react query with enabled.We migrate to trpc and using @tanstack/react-query directly to the trpc syntax of trpc.procedureName