membership functions - split and compose router functions - schema changes
This commit is contained in:
14
server/trpc/routers/notes.router.ts
Normal file
14
server/trpc/routers/notes.router.ts
Normal 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,
|
||||
}
|
||||
}),
|
||||
})
|
||||
Reference in New Issue
Block a user