From 8fc900fbf1ae32ce210a4c7133cb3a21e5a03077 Mon Sep 17 00:00:00 2001 From: Michael Dausmann Date: Sun, 2 Apr 2023 17:28:52 +1000 Subject: [PATCH] enable update account name from account page --- README.md | 2 +- lib/services/user.account.service.ts | 9 +++++++++ pages/account.vue | 5 ++++- server/trpc/routers/user.account.router.ts | 10 ++++++++++ stores/app.store.ts | 8 ++++++++ 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 027ae50..e27dda7 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Please don't hitch your wagon to this star just yet... I'm coding this in the op - [x] User roles and permissions (admin, regular user, etc. roles defined in the [Prisma Schema](/prisma/schema.prisma)) - [x] User Email captured on initial login - [x] Initial plan and plan period controled via config to allow either a trial plan or a 'No Plan' for initial users -- [ ] Edit Account Name from Account Page +- [x] Edit Account Name from Account Page ### Schema and DB Management - [x] Prisma based Schema Management diff --git a/lib/services/user.account.service.ts b/lib/services/user.account.service.ts index a6fbcf0..896c4ee 100644 --- a/lib/services/user.account.service.ts +++ b/lib/services/user.account.service.ts @@ -151,6 +151,15 @@ export default class UserAccountService { }); } + async changeAccountName(account_id: number, new_name: string) { + return prisma_client.account.update({ + where: { id: account_id}, + data: { + name: new_name, + } + }); + } + async changeAccountPlan(account_id: number, plan_id: number) { const plan = await prisma_client.plan.findFirstOrThrow({ where: {id: plan_id}}); return prisma_client.account.update({ diff --git a/pages/account.vue b/pages/account.vue index a4cb967..5fd1cba 100644 --- a/pages/account.vue +++ b/pages/account.vue @@ -1,8 +1,11 @@