add basic resource editing on backend

This commit is contained in:
Brandon Egger 2023-06-06 02:20:45 -05:00
parent 1be8f722b1
commit 3cfa29b5b5
2 changed files with 11 additions and 9 deletions

View File

@ -59,7 +59,6 @@ const EditResourcePage = (
}); });
const onSubmit: SubmitHandler<ResourceUpdateInput> = (data) => { const onSubmit: SubmitHandler<ResourceUpdateInput> = (data) => {
console.log("mutating");
mutate(data); mutate(data);
}; };

View File

@ -60,14 +60,17 @@ export const auditoryResourceRouter = createTRPCRouter({
.optional(), .optional(),
}) })
) )
.mutation(({ input, ctx }) => { .mutation(async ({ input, ctx }) => {
console.log(input); return await ctx.prisma.auditoryResource.update({
// return await ctx.prisma.auditoryResource.update({ where: {
// where: { id: input.id,
// id: input.id, },
// }, data: Object.fromEntries(
// data: { ...input }, Object.entries(input).filter(([key, _value]) => {
// }); return key !== "id";
})
),
});
}), }),
search: publicProcedure search: publicProcedure