refactor: Update reorder suggestions to fetch and display completed orders with aggregated totals instead of individual shift roles.
This commit is contained in:
@@ -433,3 +433,98 @@ query listOrdersByBusinessAndTeamHub(
|
||||
createdBy
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# GET COMPLETED ORDERS BY BUSINESS AND DATE RANGE
|
||||
# ------------------------------------------------------------
|
||||
query listCompletedOrdersByBusinessAndDateRange(
|
||||
$businessId: UUID!
|
||||
$start: Timestamp!
|
||||
$end: Timestamp!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
orders(
|
||||
where: {
|
||||
businessId: { eq: $businessId }
|
||||
status: { eq: COMPLETED }
|
||||
date: { ge: $start, le: $end }
|
||||
}
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
orderBy: { createdAt: DESC }
|
||||
) {
|
||||
id
|
||||
eventName
|
||||
|
||||
vendorId
|
||||
businessId
|
||||
orderType
|
||||
status
|
||||
date
|
||||
startDate
|
||||
endDate
|
||||
duration
|
||||
lunchBreak
|
||||
total
|
||||
assignedStaff
|
||||
requested
|
||||
recurringDays
|
||||
permanentDays
|
||||
poReference
|
||||
notes
|
||||
createdAt
|
||||
|
||||
business {
|
||||
id
|
||||
businessName
|
||||
email
|
||||
contactName
|
||||
}
|
||||
|
||||
vendor {
|
||||
id
|
||||
companyName
|
||||
}
|
||||
|
||||
teamHub {
|
||||
address
|
||||
placeId
|
||||
hubName
|
||||
}
|
||||
|
||||
# Assigned shifts and their roles
|
||||
shifts_on_order {
|
||||
id
|
||||
title
|
||||
date
|
||||
startTime
|
||||
endTime
|
||||
hours
|
||||
cost
|
||||
location
|
||||
locationAddress
|
||||
status
|
||||
workersNeeded
|
||||
filled
|
||||
|
||||
shiftRoles_on_shift {
|
||||
id
|
||||
roleId
|
||||
count
|
||||
assigned
|
||||
startTime
|
||||
endTime
|
||||
hours
|
||||
totalValue
|
||||
|
||||
role {
|
||||
id
|
||||
name
|
||||
costPerHour
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user