user.email account.plan_name - cleanup context and service construction - config for stripe callback - initial plan
This commit is contained in:
@@ -6,7 +6,7 @@ export const notesRouter = router({
|
||||
getForCurrentUser: protectedProcedure
|
||||
.input(z.object({ account_id: z.number() }))
|
||||
.query(async ({ ctx, input }) => {
|
||||
const notesService = new NotesService(ctx.prisma);
|
||||
const notesService = new NotesService();
|
||||
const notes = await notesService.getNotesForAccountId(input.account_id);
|
||||
return {
|
||||
notes,
|
||||
@@ -15,7 +15,7 @@ export const notesRouter = router({
|
||||
getById: publicProcedure
|
||||
.input(z.object({ note_id: z.number() }))
|
||||
.query(async ({ ctx, input }) => {
|
||||
const notesService = new NotesService(ctx.prisma);
|
||||
const notesService = new NotesService();
|
||||
const note = await notesService.getNoteById(input.note_id);
|
||||
return {
|
||||
note,
|
||||
|
||||
@@ -13,7 +13,7 @@ export const userAccountRouter = router({
|
||||
changeAccountPlan: adminProcedure
|
||||
.input(z.object({ account_id: z.number(), plan_id: z.number() }))
|
||||
.query(async ({ ctx, input }) => {
|
||||
const uaService = new UserAccountService(ctx.prisma);
|
||||
const uaService = new UserAccountService();
|
||||
const account = await uaService.changeAccountPlan(input.account_id, input.plan_id);
|
||||
|
||||
return {
|
||||
@@ -23,7 +23,7 @@ export const userAccountRouter = router({
|
||||
joinUserToAccount: adminProcedure
|
||||
.input(z.object({ account_id: z.number(), user_id: z.number() }))
|
||||
.query(async ({ ctx, input }) => {
|
||||
const uaService = new UserAccountService(ctx.prisma);
|
||||
const uaService = new UserAccountService();
|
||||
const membership = (ctx.dbUser?.id)?await uaService.joinUserToAccount(input.user_id, input.account_id):null;
|
||||
return {
|
||||
membership,
|
||||
@@ -32,7 +32,7 @@ export const userAccountRouter = router({
|
||||
changeUserAccessWithinAccount: adminProcedure
|
||||
.input(z.object({ user_id: z.number(), account_id: z.number(), access: z.enum([ACCOUNT_ACCESS.ADMIN, ACCOUNT_ACCESS.OWNER, ACCOUNT_ACCESS.READ_ONLY, ACCOUNT_ACCESS.READ_WRITE]) }))
|
||||
.query(async ({ ctx, input }) => {
|
||||
const uaService = new UserAccountService(ctx.prisma);
|
||||
const uaService = new UserAccountService();
|
||||
const membership = await uaService.changeUserAccessWithinAccount(input.user_id, input.account_id, input.access);
|
||||
|
||||
return {
|
||||
@@ -42,7 +42,7 @@ export const userAccountRouter = router({
|
||||
claimOwnershipOfAccount: adminProcedure
|
||||
.input(z.object({ account_id: z.number() }))
|
||||
.query(async ({ ctx, input }) => {
|
||||
const uaService = new UserAccountService(ctx.prisma);
|
||||
const uaService = new UserAccountService();
|
||||
const membership = await uaService.claimOwnershipOfAccount(ctx.dbUser.id, input.account_id);
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user