add basic resource editing on backend
This commit is contained in:
parent
1be8f722b1
commit
3cfa29b5b5
@ -59,7 +59,6 @@ const EditResourcePage = (
|
|||||||
});
|
});
|
||||||
|
|
||||||
const onSubmit: SubmitHandler<ResourceUpdateInput> = (data) => {
|
const onSubmit: SubmitHandler<ResourceUpdateInput> = (data) => {
|
||||||
console.log("mutating");
|
|
||||||
mutate(data);
|
mutate(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user