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) => {
|
||||
console.log("mutating");
|
||||
mutate(data);
|
||||
};
|
||||
|
||||
|
@ -60,14 +60,17 @@ export const auditoryResourceRouter = createTRPCRouter({
|
||||
.optional(),
|
||||
})
|
||||
)
|
||||
.mutation(({ input, ctx }) => {
|
||||
console.log(input);
|
||||
// return await ctx.prisma.auditoryResource.update({
|
||||
// where: {
|
||||
// id: input.id,
|
||||
// },
|
||||
// data: { ...input },
|
||||
// });
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
return await ctx.prisma.auditoryResource.update({
|
||||
where: {
|
||||
id: input.id,
|
||||
},
|
||||
data: Object.fromEntries(
|
||||
Object.entries(input).filter(([key, _value]) => {
|
||||
return key !== "id";
|
||||
})
|
||||
),
|
||||
});
|
||||
}),
|
||||
|
||||
search: publicProcedure
|
||||
|
Loading…
x
Reference in New Issue
Block a user