639 lines
9.1 KiB
GraphQL
639 lines
9.1 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
|
|
}
|
|
|
|
hubManager {
|
|
id
|
|
role
|
|
title
|
|
user {
|
|
id
|
|
fullName
|
|
email
|
|
photoUrl
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
# ------------------------------------------------------------
|
|
# 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
|
|
}
|
|
|
|
hubManager {
|
|
id
|
|
role
|
|
title
|
|
user {
|
|
id
|
|
fullName
|
|
email
|
|
photoUrl
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
# ------------------------------------------------------------
|
|
# 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
|
|
}
|
|
|
|
hubManager {
|
|
id
|
|
role
|
|
title
|
|
user {
|
|
id
|
|
fullName
|
|
email
|
|
photoUrl
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
# ------------------------------------------------------------
|
|
# 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
|
|
}
|
|
|
|
hubManager {
|
|
id
|
|
role
|
|
title
|
|
user {
|
|
id
|
|
fullName
|
|
email
|
|
photoUrl
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
# ------------------------------------------------------------
|
|
# 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
|
|
}
|
|
|
|
hubManager {
|
|
id
|
|
role
|
|
title
|
|
user {
|
|
id
|
|
fullName
|
|
email
|
|
photoUrl
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
# ------------------------------------------------------------
|
|
# 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
|
|
}
|
|
|
|
hubManager {
|
|
id
|
|
role
|
|
title
|
|
user {
|
|
id
|
|
fullName
|
|
email
|
|
photoUrl
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
# ------------------------------------------------------------
|
|
# 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
|
|
}
|
|
|
|
hubManager {
|
|
id
|
|
role
|
|
title
|
|
user {
|
|
id
|
|
fullName
|
|
email
|
|
photoUrl
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
#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
|
|
}
|
|
}
|
|
|
|
# ------------------------------------------------------------
|
|
# 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
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
# ------------------------------------------------------------
|
|
# GET HUB MANAGER ASSIGNED TO AN ORDER
|
|
# ------------------------------------------------------------
|
|
query getHubManagerByOrderId($orderId: UUID!) @auth(level: USER) {
|
|
order(id: $orderId) {
|
|
id
|
|
hubManagerId
|
|
hubManager {
|
|
id
|
|
role
|
|
title
|
|
department
|
|
teamHubId
|
|
isActive
|
|
user {
|
|
id
|
|
fullName
|
|
email
|
|
photoUrl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|