Files
Krow-workspace/backend/dataconnect/connector/shiftDayCompletion/queries.gql

418 lines
6.6 KiB
GraphQL

# ------------------------------------------------------------
# GET BY ID
# ------------------------------------------------------------
query getShiftDayCompletionById($id: UUID!) @auth(level: USER) {
shiftDayCompletion(id: $id) {
id
shiftId
orderId
businessId
vendorId
dayDate
dayNumber
status
hours
cost
staffSummary
disputeReason
disputeDetails
disputedItems
reviewedBy
reviewedAt
invoiceId
createdAt
updatedAt
createdBy
shift {
id
title
date
startTime
endTime
hours
durationDays
status
}
order {
id
eventName
orderType
poReference
teamHub {
hubName
address
}
}
business {
id
businessName
email
contactName
}
vendor {
id
companyName
email
}
invoice {
id
invoiceNumber
status
issueDate
dueDate
amount
}
}
}
# ------------------------------------------------------------
# LIST ALL COMPLETION RECORDS FOR A SHIFT
# ------------------------------------------------------------
query listShiftDayCompletionsByShift(
$shiftId: UUID!
$offset: Int
$limit: Int
) @auth(level: USER) {
shiftDayCompletions(
where: { shiftId: { eq: $shiftId } }
orderBy: { dayNumber: ASC }
offset: $offset
limit: $limit
) {
id
shiftId
orderId
businessId
vendorId
dayDate
dayNumber
status
hours
cost
staffSummary
disputeReason
disputeDetails
disputedItems
reviewedBy
reviewedAt
invoiceId
createdAt
updatedAt
shift {
id
title
date
startTime
endTime
durationDays
status
}
invoice {
id
invoiceNumber
status
amount
}
}
}
# ------------------------------------------------------------
# LIST ALL COMPLETION RECORDS FOR AN ORDER
# ------------------------------------------------------------
query listShiftDayCompletionsByOrder(
$orderId: UUID!
$offset: Int
$limit: Int
) @auth(level: USER) {
shiftDayCompletions(
where: { orderId: { eq: $orderId } }
orderBy: { dayDate: ASC }
offset: $offset
limit: $limit
) {
id
shiftId
orderId
businessId
vendorId
dayDate
dayNumber
status
hours
cost
staffSummary
disputeReason
disputeDetails
disputedItems
reviewedBy
reviewedAt
invoiceId
createdAt
updatedAt
shift {
id
title
date
startTime
endTime
durationDays
status
}
invoice {
id
invoiceNumber
status
amount
}
}
}
# ------------------------------------------------------------
# LIST PENDING REVIEW RECORDS FOR A BUSINESS (client view)
# ------------------------------------------------------------
query listPendingShiftDayCompletionsByBusiness(
$businessId: UUID!
$offset: Int
$limit: Int
) @auth(level: USER) {
shiftDayCompletions(
where: {
businessId: { eq: $businessId }
status: { eq: PENDING_REVIEW }
}
orderBy: { dayDate: ASC }
offset: $offset
limit: $limit
) {
id
shiftId
orderId
businessId
vendorId
dayDate
dayNumber
status
hours
cost
staffSummary
createdAt
updatedAt
shift {
id
title
date
startTime
endTime
durationDays
status
location
locationAddress
}
order {
id
eventName
orderType
poReference
teamHub {
hubName
address
}
}
vendor {
id
companyName
}
}
}
# ------------------------------------------------------------
# LIST ALL RECORDS FOR A BUSINESS FILTERED BY STATUS
# ------------------------------------------------------------
query listShiftDayCompletionsByBusinessAndStatus(
$businessId: UUID!
$status: ShiftDayCompletionStatus!
$offset: Int
$limit: Int
) @auth(level: USER) {
shiftDayCompletions(
where: {
businessId: { eq: $businessId }
status: { eq: $status }
}
orderBy: { dayDate: DESC }
offset: $offset
limit: $limit
) {
id
shiftId
orderId
businessId
vendorId
dayDate
dayNumber
status
hours
cost
staffSummary
disputeReason
disputeDetails
disputedItems
reviewedBy
reviewedAt
invoiceId
createdAt
updatedAt
shift {
id
title
date
startTime
endTime
durationDays
status
}
order {
id
eventName
orderType
poReference
}
invoice {
id
invoiceNumber
status
amount
}
}
}
# ------------------------------------------------------------
# LIST ALL APPROVED RECORDS FOR A SHIFT (invoice trigger check)
# ------------------------------------------------------------
query listApprovedShiftDayCompletionsByShift(
$shiftId: UUID!
) @auth(level: USER) {
shiftDayCompletions(
where: {
shiftId: { eq: $shiftId }
status: { eq: APPROVED }
}
orderBy: { dayNumber: ASC }
) {
id
shiftId
orderId
businessId
vendorId
dayDate
dayNumber
status
hours
cost
staffSummary
reviewedBy
reviewedAt
invoiceId
createdAt
updatedAt
shift {
id
title
durationDays
hours
cost
status
order {
id
eventName
businessId
vendorId
poReference
teamHub {
hubName
address
}
}
}
}
}
# ------------------------------------------------------------
# LIST ALL RECORDS BY VENDOR FILTERED BY STATUS
# ------------------------------------------------------------
query listShiftDayCompletionsByVendorAndStatus(
$vendorId: UUID!
$status: ShiftDayCompletionStatus!
$offset: Int
$limit: Int
) @auth(level: USER) {
shiftDayCompletions(
where: {
vendorId: { eq: $vendorId }
status: { eq: $status }
}
orderBy: { dayDate: DESC }
offset: $offset
limit: $limit
) {
id
shiftId
orderId
businessId
vendorId
dayDate
dayNumber
status
hours
cost
staffSummary
disputeReason
disputeDetails
reviewedBy
reviewedAt
invoiceId
createdAt
updatedAt
shift {
id
title
date
startTime
endTime
durationDays
status
}
business {
id
businessName
email
}
invoice {
id
invoiceNumber
status
amount
}
}
}