From 6bca0ed00bd34018600471fdb2e1dc2f38ed2f36 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Sun, 30 Nov 2025 17:16:30 +0000 Subject: [PATCH] billing skeleton --- .../src/components/inputs/SwitchSettings.tsx | 8 ++++++++ client/src/pages/billing/Billing.tsx | 19 +++++++++++++++++++ client/src/routes/Router.tsx | 2 ++ client/src/types/user.ts | 1 + server/src/db/models/auth/User.ts | 1 + server/src/services/business/AuthService.ts | 4 ++++ 6 files changed, 35 insertions(+) create mode 100644 client/src/pages/billing/Billing.tsx diff --git a/client/src/components/inputs/SwitchSettings.tsx b/client/src/components/inputs/SwitchSettings.tsx index 2936bdaca..8d2dc5d4e 100644 --- a/client/src/components/inputs/SwitchSettings.tsx +++ b/client/src/components/inputs/SwitchSettings.tsx @@ -47,6 +47,9 @@ export const SettingsSwitch = () => { orgPermissions.includes("monitors.read") || orgPermissions.includes("*"); + const hasBilling = + orgPermissions.includes("billing.*") || orgPermissions.includes("*"); + const hasMaster = orgPermissions.includes("master"); return ( @@ -102,6 +105,11 @@ export const SettingsSwitch = () => { Invite )} + {hasBilling && ( + handleClick("billing")}> + Billing + + )} ); diff --git a/client/src/pages/billing/Billing.tsx b/client/src/pages/billing/Billing.tsx new file mode 100644 index 000000000..364ca4760 --- /dev/null +++ b/client/src/pages/billing/Billing.tsx @@ -0,0 +1,19 @@ +import { BasePage, InfoBox } from "@/components/design-elements"; + +import { useAppSelector } from "@/hooks/AppHooks"; + +const BillingPage = () => { + const { user } = useAppSelector((state) => state.auth); + + console.log(user); + return ( + + + + ); +}; + +export default BillingPage; diff --git a/client/src/routes/Router.tsx b/client/src/routes/Router.tsx index 39005bf3a..d5436fb73 100644 --- a/client/src/routes/Router.tsx +++ b/client/src/routes/Router.tsx @@ -53,6 +53,7 @@ import NotFound from "@/pages/errors/NotFound"; import RootLayout from "@/components/layouts/RootLayout"; import { ProtectedRoute } from "@/components/protected-route"; +import BillingPage from "@/pages/billing/Billing"; const Router = () => { return ( @@ -141,6 +142,7 @@ const Router = () => { } /> } /> + } /> } /> } /> diff --git a/client/src/types/user.ts b/client/src/types/user.ts index 3205f2c51..2e501e02d 100644 --- a/client/src/types/user.ts +++ b/client/src/types/user.ts @@ -7,6 +7,7 @@ export interface IUser { lastName: string; org: { name: string; + planKey: string; permissions: string[]; }; teams: { diff --git a/server/src/db/models/auth/User.ts b/server/src/db/models/auth/User.ts index 9e924cccf..30b1abaec 100644 --- a/server/src/db/models/auth/User.ts +++ b/server/src/db/models/auth/User.ts @@ -28,6 +28,7 @@ export interface IUserReturnable { lastName: string; org: { name: string; + planKey: string; permissions: string[]; }; teams: { diff --git a/server/src/services/business/AuthService.ts b/server/src/services/business/AuthService.ts index c3b790db7..624973014 100644 --- a/server/src/services/business/AuthService.ts +++ b/server/src/services/business/AuthService.ts @@ -125,6 +125,7 @@ class AuthService implements IAuthService { lastName: user.lastName, org: { name: org.name, + planKey: org.planKey, permissions: orgRoles?.permissions || [], }, teams: returnableTeams, @@ -261,6 +262,7 @@ class AuthService implements IAuthService { lastName: user.lastName, org: { name: org.name, + planKey: org.planKey, permissions: roles[0]?.permissions || [], }, teams: [returnableTeam], @@ -397,6 +399,7 @@ class AuthService implements IAuthService { lastName: user.lastName, org: { name: org.name, + planKey: org.planKey, permissions: orgPermissions, }, teams: returnableTeams, @@ -503,6 +506,7 @@ class AuthService implements IAuthService { lastName: user.lastName, org: { name: org.name, + planKey: org.planKey, permissions: orgRoles?.permissions || [], }, teams: returnableTeams,