110 lines
2.7 KiB
GraphQL
110 lines
2.7 KiB
GraphQL
# ==========================================================
|
|
# StaffAvailabilityStats - QUERIES
|
|
# ==========================================================
|
|
# Notes:
|
|
# - Entity key is composite: key: ["staffId"]
|
|
# - So the single-record lookup is: staffAvailabilityStats(key: { staffId: ... })
|
|
# - There is no Query.staffAvailabilityStat(id: ...) unless you defined id as the key.
|
|
# ==========================================================
|
|
|
|
# ----------------------------------------------------------
|
|
# LIST ALL (admin/debug)
|
|
# ----------------------------------------------------------
|
|
query listStaffAvailabilityStats(
|
|
$offset: Int
|
|
$limit: Int
|
|
) @auth(level: USER) {
|
|
staffAvailabilityStatss(offset: $offset, limit: $limit) {
|
|
id
|
|
staffId
|
|
needWorkIndex
|
|
utilizationPercentage
|
|
predictedAvailabilityScore
|
|
scheduledHoursThisPeriod
|
|
desiredHoursThisPeriod
|
|
lastShiftDate
|
|
acceptanceRate
|
|
createdAt
|
|
updatedAt
|
|
createdBy
|
|
|
|
staff {
|
|
id
|
|
fullName
|
|
}
|
|
}
|
|
}
|
|
|
|
# ----------------------------------------------------------
|
|
# GET BY KEY (staffId)
|
|
# ----------------------------------------------------------
|
|
query getStaffAvailabilityStatsByStaffId(
|
|
$staffId: UUID!
|
|
) @auth(level: USER) {
|
|
staffAvailabilityStats(key: { staffId: $staffId }) {
|
|
id
|
|
staffId
|
|
needWorkIndex
|
|
utilizationPercentage
|
|
predictedAvailabilityScore
|
|
scheduledHoursThisPeriod
|
|
desiredHoursThisPeriod
|
|
lastShiftDate
|
|
acceptanceRate
|
|
createdAt
|
|
updatedAt
|
|
createdBy
|
|
|
|
staff {
|
|
id
|
|
fullName
|
|
}
|
|
}
|
|
}
|
|
|
|
# ----------------------------------------------------------
|
|
# FILTER (optional) - useful for dashboards
|
|
# NOTE: Data Connect filter ops are typically: eq, ne, gt, ge, lt, le, in, isNull
|
|
# ----------------------------------------------------------
|
|
query filterStaffAvailabilityStats(
|
|
$needWorkIndexMin: Int
|
|
$needWorkIndexMax: Int
|
|
$utilizationMin: Int
|
|
$utilizationMax: Int
|
|
$acceptanceRateMin: Int
|
|
$acceptanceRateMax: Int
|
|
$lastShiftAfter: Timestamp
|
|
$lastShiftBefore: Timestamp
|
|
$offset: Int
|
|
$limit: Int
|
|
) @auth(level: USER) {
|
|
staffAvailabilityStatss(
|
|
where: {
|
|
needWorkIndex: { ge: $needWorkIndexMin, le: $needWorkIndexMax }
|
|
utilizationPercentage: { ge: $utilizationMin, le: $utilizationMax }
|
|
acceptanceRate: { ge: $acceptanceRateMin, le: $acceptanceRateMax }
|
|
lastShiftDate: { ge: $lastShiftAfter, le: $lastShiftBefore }
|
|
}
|
|
offset: $offset
|
|
limit: $limit
|
|
) {
|
|
id
|
|
staffId
|
|
needWorkIndex
|
|
utilizationPercentage
|
|
predictedAvailabilityScore
|
|
scheduledHoursThisPeriod
|
|
desiredHoursThisPeriod
|
|
lastShiftDate
|
|
acceptanceRate
|
|
createdAt
|
|
updatedAt
|
|
createdBy
|
|
|
|
staff {
|
|
id
|
|
fullName
|
|
}
|
|
}
|
|
}
|