add/delete notes
This commit is contained in:
@@ -11,7 +11,7 @@ export const notesRouter = router({
|
||||
notes,
|
||||
}
|
||||
}),
|
||||
getById: publicProcedure
|
||||
getById: publicProcedure
|
||||
.input(z.object({ note_id: z.number() }))
|
||||
.query(async ({ ctx, input }) => {
|
||||
const notesService = new NotesService();
|
||||
@@ -20,4 +20,22 @@ export const notesRouter = router({
|
||||
note,
|
||||
}
|
||||
}),
|
||||
createNote: protectedProcedure
|
||||
.input(z.object({ note_text: z.string() }))
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
const notesService = new NotesService();
|
||||
const note = (ctx.activeAccountId)?await notesService.createNote(ctx.activeAccountId, input.note_text):null;
|
||||
return {
|
||||
note,
|
||||
}
|
||||
}),
|
||||
deleteNote: protectedProcedure
|
||||
.input(z.object({ note_id: z.number() }))
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
const notesService = new NotesService();
|
||||
const note = (ctx.activeAccountId)?await notesService.deleteNote(input.note_id):null;
|
||||
return {
|
||||
note,
|
||||
}
|
||||
}),
|
||||
})
|
||||
Reference in New Issue
Block a user