From ad0bae79e8f561ddd517d0b09aa65885a03153a4 Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev Date: Sat, 4 Apr 2026 09:41:36 +0700 Subject: [PATCH] Support super manager access --- app/components/ui/AppHeader.vue | 3 +- app/composables/graphql/generated.ts | 71 ++++++++++++++++++- app/middleware/manager-only.ts | 3 +- app/pages/bonus-system/index.vue | 22 +++--- app/pages/bonus-system/withdrawals/[id].vue | 18 +++-- app/utils/roles.ts | 5 ++ .../manager-withdrawal-requests.graphql | 15 ++++ graphql/schema.graphql | 16 +++++ 8 files changed, 136 insertions(+), 17 deletions(-) create mode 100644 app/utils/roles.ts create mode 100644 graphql/operations/manager/manager-withdrawal-requests.graphql diff --git a/app/components/ui/AppHeader.vue b/app/components/ui/AppHeader.vue index fe6dae3..4164761 100644 --- a/app/components/ui/AppHeader.vue +++ b/app/components/ui/AppHeader.vue @@ -1,6 +1,7 @@ @@ -45,7 +49,7 @@ async function reviewWithdrawal() {
← Назад к бонусам -
+
Загружаем заявку на вывод...
@@ -57,7 +61,9 @@ async function reviewWithdrawal() {

Вывод

Проверка заявки на вывод

-

Пользователь: {{ currentWithdrawal.requesterId }} · Сумма: {{ currentWithdrawal.amount }}

+

+ {{ currentWithdrawal.requesterFullName }} · {{ currentWithdrawal.requesterEmail }} · Сумма: {{ currentWithdrawal.amount }} +

diff --git a/app/utils/roles.ts b/app/utils/roles.ts new file mode 100644 index 0000000..edc6ab9 --- /dev/null +++ b/app/utils/roles.ts @@ -0,0 +1,5 @@ +import { UserRole } from '~/composables/graphql/generated'; + +export function hasManagerAccess(role?: UserRole | null) { + return role === UserRole.Manager || role === UserRole.SuperManager; +} diff --git a/graphql/operations/manager/manager-withdrawal-requests.graphql b/graphql/operations/manager/manager-withdrawal-requests.graphql new file mode 100644 index 0000000..5b12b65 --- /dev/null +++ b/graphql/operations/manager/manager-withdrawal-requests.graphql @@ -0,0 +1,15 @@ +query ManagerWithdrawalRequests($status: WithdrawalStatus) { + managerWithdrawalRequests(status: $status) { + id + requesterId + requesterEmail + requesterFullName + companyName + amount + status + reviewedById + reviewComment + createdAt + updatedAt + } +} diff --git a/graphql/schema.graphql b/graphql/schema.graphql index f8a8e87..957163f 100644 --- a/graphql/schema.graphql +++ b/graphql/schema.graphql @@ -4,6 +4,7 @@ scalar JSON enum UserRole { CLIENT MANAGER + SUPER_MANAGER } enum MessengerType { @@ -306,6 +307,20 @@ type ManagerBonusBalance { transactionsCount: Int! } +type ManagerWithdrawalRequest { + id: ID! + requesterId: ID! + requesterEmail: String! + requesterFullName: String! + companyName: String + amount: Float! + status: WithdrawalStatus! + reviewedById: ID + reviewComment: String + createdAt: DateTime! + updatedAt: DateTime! +} + type Query { healthcheck: String! me: User @@ -321,6 +336,7 @@ type Query { managerUsers: [ManagerUser!]! managerOrders(status: OrderStatus): [Order!]! managerBonusBalances: [ManagerBonusBalance!]! + managerWithdrawalRequests(status: WithdrawalStatus): [ManagerWithdrawalRequest!]! registrationRequests(status: RegistrationStatus): [RegistrationRequest!]! referralStats: ReferralStats! }