feat: Integrate Data Connect and Implement Staff List View Directory
This commit is contained in:
36
backend/dataconnect/example/benefitsData/mutations.gql
Normal file
36
backend/dataconnect/example/benefitsData/mutations.gql
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
mutation createBenefitsData(
|
||||
$vendorBenefitPlanId: UUID!
|
||||
$staffId: UUID!
|
||||
$current: Int!
|
||||
) @auth(level: USER) {
|
||||
benefitsData_insert(
|
||||
data: {
|
||||
vendorBenefitPlanId: $vendorBenefitPlanId
|
||||
staffId: $staffId
|
||||
current: $current
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
mutation updateBenefitsData(
|
||||
$staffId: UUID!
|
||||
$vendorBenefitPlanId: UUID!
|
||||
$current: Int
|
||||
) @auth(level: USER) {
|
||||
benefitsData_update(
|
||||
key: { staffId: $staffId, vendorBenefitPlanId: $vendorBenefitPlanId }
|
||||
data: {
|
||||
current: $current
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
mutation deleteBenefitsData(
|
||||
$staffId: UUID!
|
||||
$vendorBenefitPlanId: UUID!
|
||||
) @auth(level: USER) {
|
||||
benefitsData_delete(
|
||||
key: { staffId: $staffId, vendorBenefitPlanId: $vendorBenefitPlanId }
|
||||
)
|
||||
}
|
||||
165
backend/dataconnect/example/benefitsData/queries.gql
Normal file
165
backend/dataconnect/example/benefitsData/queries.gql
Normal file
@@ -0,0 +1,165 @@
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# 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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user