Files
Krow-workspace/backend/dataconnect/connector/order/queries.gql
2026-01-29 18:12:16 -05:00

436 lines
6.2 KiB
GraphQL

# ------------------------------------------------------------
# LIST ALL ORDERS
# ------------------------------------------------------------
query listOrders(
$offset: Int
$limit: Int
) @auth(level: USER) {
orders(offset: $offset, limit: $limit) {
id
eventName
vendorId
businessId
orderType
#location
status
date
startDate
endDate
duration
lunchBreak
total
assignedStaff
shifts
requested
recurringDays
permanentDays
poReference
detectedConflicts
notes
createdAt
business {
id
businessName
email
contactName
}
vendor {
id
companyName
}
teamHub {
address
placeId
hubName
}
}
}
# ------------------------------------------------------------
# GET ORDER BY ID
# ------------------------------------------------------------
query getOrderById($id: UUID!) @auth(level: USER) {
order(id: $id) {
id
eventName
vendorId
businessId
orderType
#location
status
date
startDate
endDate
duration
lunchBreak
total
assignedStaff
shifts
requested
recurringDays
permanentDays
poReference
detectedConflicts
notes
createdAt
business {
id
businessName
email
contactName
}
vendor {
id
companyName
}
teamHub {
address
placeId
hubName
}
}
}
# ------------------------------------------------------------
# GET ORDERS BY BUSINESS
# ------------------------------------------------------------
query getOrdersByBusinessId(
$businessId: UUID!
$offset: Int
$limit: Int
) @auth(level: USER) {
orders(
where: { businessId: { eq: $businessId } }
offset: $offset
limit: $limit
) {
id
eventName
vendorId
businessId
orderType
#location
status
date
startDate
endDate
duration
lunchBreak
total
assignedStaff
shifts
requested
recurringDays
permanentDays
poReference
detectedConflicts
notes
createdAt
business {
id
businessName
email
contactName
}
vendor {
id
companyName
}
teamHub {
address
placeId
hubName
}
}
}
# ------------------------------------------------------------
# GET ORDERS BY VENDOR
# ------------------------------------------------------------
query getOrdersByVendorId(
$vendorId: UUID!
$offset: Int
$limit: Int
) @auth(level: USER) {
orders(
where: { vendorId: { eq: $vendorId } }
offset: $offset
limit: $limit
) {
id
eventName
vendorId
businessId
orderType
#location
status
date
startDate
endDate
duration
lunchBreak
total
assignedStaff
shifts
requested
recurringDays
permanentDays
poReference
detectedConflicts
notes
createdAt
business {
id
businessName
email
contactName
}
vendor {
id
companyName
}
teamHub {
address
placeId
hubName
}
}
}
# ------------------------------------------------------------
# GET ORDERS BY STATUS
# ------------------------------------------------------------
query getOrdersByStatus(
$status: OrderStatus!
$offset: Int
$limit: Int
) @auth(level: USER) {
orders(
where: { status: { eq: $status } }
offset: $offset
limit: $limit
) {
id
eventName
vendorId
businessId
orderType
#location
status
date
startDate
endDate
duration
lunchBreak
total
assignedStaff
shifts
requested
recurringDays
permanentDays
poReference
detectedConflicts
notes
createdAt
business {
id
businessName
email
contactName
}
vendor {
id
companyName
}
teamHub {
address
placeId
hubName
}
}
}
# ------------------------------------------------------------
# GET ORDERS BY DATE RANGE
# ------------------------------------------------------------
query getOrdersByDateRange(
$start: Timestamp!
$end: Timestamp!
$offset: Int
$limit: Int
) @auth(level: USER) {
orders(
where: {
date: { ge: $start, le: $end }
}
offset: $offset
limit: $limit
) {
id
eventName
vendorId
businessId
orderType
#location
status
date
startDate
endDate
duration
lunchBreak
total
assignedStaff
shifts
requested
recurringDays
permanentDays
poReference
detectedConflicts
notes
createdAt
business {
id
businessName
email
contactName
}
vendor {
id
companyName
}
teamHub {
address
placeId
hubName
}
}
}
# ------------------------------------------------------------
# GET RAPID ORDERS
# ------------------------------------------------------------
query getRapidOrders(
$offset: Int
$limit: Int
) @auth(level: USER) {
orders(
where: { orderType: { eq: RAPID } }
offset: $offset
limit: $limit
) {
id
eventName
vendorId
businessId
orderType
#location
status
date
startDate
endDate
duration
lunchBreak
total
assignedStaff
shifts
requested
recurringDays
permanentDays
poReference
detectedConflicts
notes
createdAt
business {
id
businessName
email
contactName
}
vendor {
id
companyName
}
teamHub {
address
placeId
hubName
}
}
}
#to validate if an hub has orders before delete
query listOrdersByBusinessAndTeamHub(
$businessId: UUID!
$teamHubId: UUID!
$offset: Int
$limit: Int
) @auth(level: USER) {
orders(
where: {
businessId: { eq: $businessId }
teamHubId: { eq: $teamHubId }
#status: {in: [ DRAFT POSTED FILLED PENDING FULLY_STAFFED PARTIAL_STAFFED ] }
}
offset: $offset
limit: $limit
orderBy: { createdAt: DESC }
) {
id
eventName
orderType
status
duration
businessId
vendorId
teamHubId
date
startDate
endDate
requested
total
notes
createdAt
updatedAt
createdBy
}
}