Files
Krow-workspace/apps/web/dataconnect/connector/benefitsData/queries.gql

166 lines
3.0 KiB
GraphQL

# ----------------------------------------------------------
# LIST ALL (admin/debug)
# ----------------------------------------------------------
query listBenefitsData(
$offset: Int
$limit: Int
) @auth(level: USER) {
benefitsDatas(offset: $offset, limit: $limit) {
id
vendorBenefitPlanId
current
staffId
staff {
id
fullName
}
vendorBenefitPlan {
id
vendorId
title
description
requestLabel
total
isActive
}
}
}
# ----------------------------------------------------------
# GET BY KEY (staffId + vendorBenefitPlanId) ✅ (replaces getById in practice)
# ----------------------------------------------------------
query getBenefitsDataByKey(
$staffId: UUID!
$vendorBenefitPlanId: UUID!
) @auth(level: USER) {
benefitsData(key: { staffId: $staffId, vendorBenefitPlanId: $vendorBenefitPlanId }) {
id
vendorBenefitPlanId
current
staffId
staff {
id
fullName
}
vendorBenefitPlan {
id
vendorId
title
description
requestLabel
total
isActive
}
}
}
# ----------------------------------------------------------
# LIST BY STAFF
# ----------------------------------------------------------
query listBenefitsDataByStaffId(
$staffId: UUID!
$offset: Int
$limit: Int
) @auth(level: USER) {
benefitsDatas(
where: { staffId: { eq: $staffId } }
offset: $offset
limit: $limit
) {
id
vendorBenefitPlanId
current
staffId
staff {
id
fullName
}
vendorBenefitPlan {
id
vendorId
title
description
requestLabel
total
isActive
}
}
}
# ----------------------------------------------------------
# LIST BY VENDOR BENEFIT PLAN
# ----------------------------------------------------------
query listBenefitsDataByVendorBenefitPlanId(
$vendorBenefitPlanId: UUID!
$offset: Int
$limit: Int
) @auth(level: USER) {
benefitsDatas(
where: { vendorBenefitPlanId: { eq: $vendorBenefitPlanId } }
offset: $offset
limit: $limit
) {
id
vendorBenefitPlanId
current
staffId
staff {
id
fullName
}
vendorBenefitPlan {
id
vendorId
title
description
requestLabel
total
isActive
}
}
}
# ----------------------------------------------------------
# LIST BY VENDOR (2-step helper: planIds -> benefitsDatas IN)
# ----------------------------------------------------------
query listBenefitsDataByVendorBenefitPlanIds(
$vendorBenefitPlanIds: [UUID!]!
$offset: Int
$limit: Int
) @auth(level: USER) {
benefitsDatas(
where: { vendorBenefitPlanId: { in: $vendorBenefitPlanIds } }
offset: $offset
limit: $limit
) {
id
vendorBenefitPlanId
current
staffId
staff {
id
fullName
}
vendorBenefitPlan {
id
vendorId
title
description
requestLabel
total
isActive
}
}
}