BootesVoid
BootesVoid
TTCTheo's Typesafe Cult
Created by BootesVoid on 3/17/2024 in #questions
Property 'query' does not exist on type 'DecorateProcedure<QueryProcedure<
import { z } from "zod";

import {
createTRPCRouter,
protectedProcedure,
publicProcedure,
} from "@/server/api/trpc";

export const taskRouter = createTRPCRouter({

create: protectedProcedure
.input(z.object({ name: z.string().min(1), description: z.string().optional()}))
.mutation(async ({ ctx, input }) => {
return ctx.db.task.create({
data: {
name: input.name,
description: input.description,
createdBy: { connect: { id: ctx.session.user.id } },
},
});
}),

getTasks: protectedProcedure.query(async ({ ctx }) => {
return await ctx.db.task.findMany({
where: { createdBy: { id: ctx.session.user.id } },
});
}),
});
import { z } from "zod";

import {
createTRPCRouter,
protectedProcedure,
publicProcedure,
} from "@/server/api/trpc";

export const taskRouter = createTRPCRouter({

create: protectedProcedure
.input(z.object({ name: z.string().min(1), description: z.string().optional()}))
.mutation(async ({ ctx, input }) => {
return ctx.db.task.create({
data: {
name: input.name,
description: input.description,
createdBy: { connect: { id: ctx.session.user.id } },
},
});
}),

getTasks: protectedProcedure.query(async ({ ctx }) => {
return await ctx.db.task.findMany({
where: { createdBy: { id: ctx.session.user.id } },
});
}),
});
4 replies
TTCTheo's Typesafe Cult
Created by BootesVoid on 3/16/2024 in #questions
Error: ENOENT: no such file or directory, stat 'C:\components.json'
works fine in production
8 replies
TTCTheo's Typesafe Cult
Created by BootesVoid on 3/16/2024 in #questions
Error: ENOENT: no such file or directory, stat 'C:\components.json'
doesnt fix it
8 replies
TTCTheo's Typesafe Cult
Created by BootesVoid on 3/16/2024 in #questions
Error: ENOENT: no such file or directory, stat 'C:\components.json'
tried reinstalling node_modules, deleting .next folder
8 replies
TTCTheo's Typesafe Cult
Created by BootesVoid on 3/13/2024 in #questions
any button even when explicitly mentioned as type="button" triggers form submission
well it was a silly problem I wasnt checking the right page for the updates
6 replies
TTCTheo's Typesafe Cult
Created by BootesVoid on 3/13/2024 in #questions
any button even when explicitly mentioned as type="button" triggers form submission
yes it was
6 replies
TTCTheo's Typesafe Cult
Created by BootesVoid on 1/28/2024 in #questions
I have a standard data-table from shadcn
Thanks a lot!
3 replies
TTCTheo's Typesafe Cult
Created by arete on 4/8/2023 in #questions
handle onError mutation
deleteStrategyManagement: protectedProcedure
.input(z.object({ type: z.string(), value: z.string() }))
.mutation(({ ctx, input }) => {
const { value, type } = input
try {
if (type === "tradeentry") {
return ctx.db.entryType.deleteMany({
where: {
value: value,
},
});
} else if (type === "tradeexit") {
return ctx.db.exitType.deleteMany({
where: {
value: value,
},
});
} else if (type === "management") {
return ctx.db.management.deleteMany({
where: {
value: value,
},
});
} else {
throw new TRPCClientError("Invalid type");
}
} catch (error) {
throw new TRPCError({
code: 'BAD_REQUEST',
message: 'Duplicate Value'});
}

}),
deleteStrategyManagement: protectedProcedure
.input(z.object({ type: z.string(), value: z.string() }))
.mutation(({ ctx, input }) => {
const { value, type } = input
try {
if (type === "tradeentry") {
return ctx.db.entryType.deleteMany({
where: {
value: value,
},
});
} else if (type === "tradeexit") {
return ctx.db.exitType.deleteMany({
where: {
value: value,
},
});
} else if (type === "management") {
return ctx.db.management.deleteMany({
where: {
value: value,
},
});
} else {
throw new TRPCClientError("Invalid type");
}
} catch (error) {
throw new TRPCError({
code: 'BAD_REQUEST',
message: 'Duplicate Value'});
}

}),
15 replies
TTCTheo's Typesafe Cult
Created by arete on 4/8/2023 in #questions
handle onError mutation
yeah the callback is not triggering at all. When exactly is the onError triggerred? I've tried throwing errors on the api side but still no luck.
15 replies
TTCTheo's Typesafe Cult
Created by arete on 4/8/2023 in #questions
handle onError mutation
hey did you figure this out?
15 replies
TTCTheo's Typesafe Cult
Created by BootesVoid on 11/7/2023 in #questions
I get TRPCClientError: Unexpected token ; in JSON position 4
Yes you have to turn off vercel authentication
8 replies
TTCTheo's Typesafe Cult
Created by Pavstermeister on 11/5/2023 in #questions
Configuring Clerk on the latest release of t3 with tRPC
Any clerk call from a trpc router rretuns null values. I tried useUser but doesn't work
123 replies