membership functions - split and compose router functions - schema changes

This commit is contained in:
Michael Dausmann
2023-02-08 23:14:46 +11:00
parent 087526eb50
commit de976ab43b
10 changed files with 282 additions and 71 deletions

View File

@@ -0,0 +1,14 @@
import NotesService from '~~/lib/services/notes.service';
import { protectedProcedure, router } from '../trpc'
export const notesRouter = router({
getForCurrentUser: protectedProcedure
.query(async ({ ctx }) => {
const notesService = new NotesService(ctx.prisma);
console.log(`fetching notes for account_id: ${ctx.dbUser.memberships[0].account_id}`);
const notes = await notesService.getNotesForAccountId(ctx.dbUser.memberships[0].account_id);
return {
notes,
}
}),
})