From 78ce0f6cda6aaec167b4ea502281e011277df803 Mon Sep 17 00:00:00 2001 From: dhinesh-m24 Date: Tue, 24 Feb 2026 12:36:17 +0530 Subject: [PATCH] feat:Update benfitsDate query to add retrieve worker benefits query --- .../connector/benefitsData/queries.gql | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/backend/dataconnect/connector/benefitsData/queries.gql b/backend/dataconnect/connector/benefitsData/queries.gql index 2bc60a37..c856fcbf 100644 --- a/backend/dataconnect/connector/benefitsData/queries.gql +++ b/backend/dataconnect/connector/benefitsData/queries.gql @@ -1,4 +1,38 @@ +# ---------------------------------------------------------- +# GET WORKER BENEFIT BALANCES (M4) +# Returns all active benefit plans with balance data for a given worker. +# Supports: Sick Leave (40h), Holidays (24h), Vacation (40h) +# Extensible: any future VendorBenefitPlan will appear automatically. +# +# Fields: +# vendorBenefitPlan.title → benefit type name +# vendorBenefitPlan.total → total entitlement (hours) +# current → used hours +# remaining = total - current → computed client-side +# ---------------------------------------------------------- +query getWorkerBenefitBalances( + $staffId: UUID! +) @auth(level: USER) { + benefitsDatas( + where: { + staffId: { eq: $staffId } + } + ) { + vendorBenefitPlanId + current + + vendorBenefitPlan { + id + title + description + requestLabel + total + isActive + } + } +} + # ---------------------------------------------------------- # LIST ALL (admin/debug) # ----------------------------------------------------------