567 lines
8.3 KiB
GraphQL
567 lines
8.3 KiB
GraphQL
query getShiftRoleById(
|
|
$shiftId: UUID!
|
|
$roleId: UUID!
|
|
) @auth(level: USER) {
|
|
shiftRole(key: { shiftId: $shiftId, roleId: $roleId }) {
|
|
id
|
|
shiftId
|
|
roleId
|
|
count
|
|
assigned
|
|
startTime
|
|
endTime
|
|
hours
|
|
department
|
|
uniform
|
|
breakType
|
|
isBreakPaid
|
|
totalValue
|
|
createdAt
|
|
|
|
role {
|
|
id
|
|
name
|
|
costPerHour
|
|
}
|
|
|
|
shift{
|
|
location
|
|
locationAddress
|
|
description
|
|
latitude
|
|
longitude
|
|
orderId
|
|
|
|
order{
|
|
recurringDays
|
|
permanentDays
|
|
notes
|
|
|
|
business{
|
|
id
|
|
businessName
|
|
companyLogoUrl
|
|
}
|
|
|
|
vendor{
|
|
id
|
|
companyName
|
|
}
|
|
|
|
teamHub{
|
|
hubName
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
query listShiftRolesByShiftId(
|
|
$shiftId: UUID!
|
|
$offset: Int
|
|
$limit: Int
|
|
) @auth(level: USER) {
|
|
shiftRoles(
|
|
where: { shiftId: { eq: $shiftId } }
|
|
offset: $offset
|
|
limit: $limit
|
|
) {
|
|
id
|
|
shiftId
|
|
roleId
|
|
count
|
|
assigned
|
|
startTime
|
|
endTime
|
|
hours
|
|
department
|
|
uniform
|
|
breakType
|
|
isBreakPaid
|
|
totalValue
|
|
createdAt
|
|
|
|
role {
|
|
id
|
|
name
|
|
costPerHour
|
|
}
|
|
|
|
shift{
|
|
location
|
|
locationAddress
|
|
description
|
|
latitude
|
|
longitude
|
|
orderId
|
|
|
|
order{
|
|
recurringDays
|
|
permanentDays
|
|
notes
|
|
|
|
business{
|
|
id
|
|
businessName
|
|
}
|
|
|
|
vendor{
|
|
id
|
|
companyName
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
query listShiftRolesByRoleId(
|
|
$roleId: UUID!
|
|
$offset: Int
|
|
$limit: Int
|
|
) @auth(level: USER) {
|
|
shiftRoles(
|
|
where: { roleId: { eq: $roleId } }
|
|
offset: $offset
|
|
limit: $limit
|
|
) {
|
|
id
|
|
shiftId
|
|
roleId
|
|
count
|
|
assigned
|
|
startTime
|
|
endTime
|
|
hours
|
|
department
|
|
uniform
|
|
breakType
|
|
isBreakPaid
|
|
totalValue
|
|
createdAt
|
|
|
|
role {
|
|
id
|
|
name
|
|
costPerHour
|
|
}
|
|
|
|
shift{
|
|
location
|
|
locationAddress
|
|
description
|
|
latitude
|
|
longitude
|
|
orderId
|
|
|
|
order{
|
|
recurringDays
|
|
permanentDays
|
|
notes
|
|
|
|
business{
|
|
id
|
|
businessName
|
|
}
|
|
|
|
vendor{
|
|
id
|
|
companyName
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
query listShiftRolesByShiftIdAndTimeRange(
|
|
$shiftId: UUID!
|
|
$start: Timestamp!
|
|
$end: Timestamp!
|
|
$offset: Int
|
|
$limit: Int
|
|
) @auth(level: USER) {
|
|
shiftRoles(
|
|
where: {
|
|
shiftId: { eq: $shiftId }
|
|
startTime: { ge: $start }
|
|
endTime: { le: $end }
|
|
}
|
|
offset: $offset
|
|
limit: $limit
|
|
) {
|
|
id
|
|
shiftId
|
|
roleId
|
|
count
|
|
assigned
|
|
startTime
|
|
endTime
|
|
hours
|
|
department
|
|
uniform
|
|
breakType
|
|
isBreakPaid
|
|
totalValue
|
|
createdAt
|
|
|
|
role {
|
|
id
|
|
name
|
|
costPerHour
|
|
}
|
|
|
|
shift{
|
|
location
|
|
locationAddress
|
|
description
|
|
latitude
|
|
longitude
|
|
orderId
|
|
|
|
order{
|
|
recurringDays
|
|
permanentDays
|
|
notes
|
|
|
|
business{
|
|
id
|
|
businessName
|
|
}
|
|
|
|
vendor{
|
|
id
|
|
companyName
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
# ------------------------------------------------------------
|
|
# LIST SHIFT ROLES BY VENDOR (via Shift -> Order)
|
|
# ------------------------------------------------------------
|
|
query listShiftRolesByVendorId(
|
|
$vendorId: UUID!
|
|
|
|
$offset: Int
|
|
$limit: Int
|
|
) @auth(level: USER) {
|
|
shiftRoles(
|
|
where: {
|
|
shift: {
|
|
status: {in: [IN_PROGRESS, ASSIGNED, OPEN]} #IN_PROGRESS?
|
|
order: {
|
|
vendorId: { eq: $vendorId }
|
|
}
|
|
}
|
|
}
|
|
offset: $offset
|
|
limit: $limit
|
|
orderBy: { createdAt: DESC }
|
|
) {
|
|
id
|
|
shiftId
|
|
roleId
|
|
count
|
|
assigned
|
|
startTime
|
|
endTime
|
|
hours
|
|
department
|
|
uniform
|
|
breakType
|
|
isBreakPaid
|
|
totalValue
|
|
createdAt
|
|
|
|
role {
|
|
id
|
|
name
|
|
costPerHour
|
|
}
|
|
|
|
shift {
|
|
id
|
|
title
|
|
date
|
|
location
|
|
locationAddress
|
|
description
|
|
latitude
|
|
longitude
|
|
orderId
|
|
status
|
|
durationDays
|
|
|
|
order {
|
|
id
|
|
eventName
|
|
vendorId
|
|
businessId
|
|
orderType
|
|
status
|
|
date
|
|
startDate
|
|
endDate
|
|
recurringDays
|
|
permanentDays
|
|
notes
|
|
|
|
business { id businessName }
|
|
vendor { id companyName }
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
#orders view client
|
|
query listShiftRolesByBusinessAndDateRange(
|
|
$businessId: UUID!
|
|
$start: Timestamp!
|
|
$end: Timestamp!
|
|
$offset: Int
|
|
$limit: Int
|
|
$status: ShiftStatus
|
|
) @auth(level: USER) {
|
|
shiftRoles(
|
|
where: {
|
|
shift: {
|
|
date: { ge: $start, le: $end }
|
|
order: { businessId: { eq: $businessId } }
|
|
}
|
|
}
|
|
offset: $offset
|
|
limit: $limit
|
|
orderBy: { createdAt: DESC }
|
|
) {
|
|
shiftId
|
|
roleId
|
|
count
|
|
assigned
|
|
hours
|
|
startTime
|
|
endTime
|
|
totalValue
|
|
role { id name }
|
|
shift {
|
|
id
|
|
date
|
|
location
|
|
locationAddress
|
|
title
|
|
status
|
|
order { id eventName orderType }
|
|
}
|
|
}
|
|
}
|
|
|
|
#list shiftsroles for update order in client app
|
|
query listShiftRolesByBusinessAndOrder(
|
|
$businessId: UUID!
|
|
$orderId: UUID!
|
|
$offset: Int
|
|
$limit: Int
|
|
) @auth(level: USER) {
|
|
shiftRoles(
|
|
where: {
|
|
shift: {
|
|
orderId: { eq: $orderId }
|
|
order: { businessId: { eq: $businessId } }
|
|
}
|
|
}
|
|
offset: $offset
|
|
limit: $limit
|
|
orderBy: { createdAt: DESC }
|
|
) {
|
|
id
|
|
shiftId
|
|
roleId
|
|
count
|
|
assigned
|
|
startTime
|
|
endTime
|
|
hours
|
|
breakType
|
|
isBreakPaid
|
|
totalValue
|
|
createdAt
|
|
|
|
role { id name costPerHour }
|
|
|
|
shift {
|
|
id
|
|
title
|
|
date
|
|
orderId
|
|
location
|
|
locationAddress
|
|
|
|
order{
|
|
vendorId
|
|
eventName
|
|
date
|
|
startDate
|
|
endDate
|
|
recurringDays
|
|
permanentDays
|
|
orderType
|
|
#location
|
|
|
|
teamHub {
|
|
id
|
|
address
|
|
placeId
|
|
hubName
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#reorder get list by businessId
|
|
query listShiftRolesByBusinessDateRangeCompletedOrders(
|
|
$businessId: UUID!
|
|
$start: Timestamp!
|
|
$end: Timestamp!
|
|
$offset: Int
|
|
$limit: Int
|
|
) @auth(level: USER) {
|
|
shiftRoles(
|
|
where: {
|
|
shift: {
|
|
date: { ge: $start, le: $end }
|
|
order: {
|
|
businessId: { eq: $businessId }
|
|
status: { eq: COMPLETED }
|
|
}
|
|
}
|
|
}
|
|
offset: $offset
|
|
limit: $limit
|
|
orderBy: { createdAt: DESC }
|
|
) {
|
|
shiftId
|
|
roleId
|
|
count
|
|
assigned
|
|
hours
|
|
startTime
|
|
endTime
|
|
totalValue
|
|
|
|
role {
|
|
id
|
|
name
|
|
costPerHour
|
|
}
|
|
|
|
shift {
|
|
id
|
|
date
|
|
location
|
|
locationAddress
|
|
title
|
|
status
|
|
|
|
order {
|
|
id
|
|
orderType
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#view for billing period
|
|
query listShiftRolesByBusinessAndDatesSummary(
|
|
$businessId: UUID!
|
|
$start: Timestamp!
|
|
$end: Timestamp!
|
|
$offset: Int
|
|
$limit: Int
|
|
) @auth(level: USER) {
|
|
shiftRoles(
|
|
where: {
|
|
shift: {
|
|
date: { ge: $start, le: $end }
|
|
status: { eq: COMPLETED }
|
|
order: { businessId: { eq: $businessId } }
|
|
}
|
|
}
|
|
offset: $offset
|
|
limit: $limit
|
|
orderBy: { createdAt: DESC }
|
|
) {
|
|
roleId
|
|
hours
|
|
totalValue
|
|
role { id name }
|
|
}
|
|
}
|
|
|
|
# ------------------------------------------------------------
|
|
# BUSINESS: GET COMPLETED SHIFTS FOR A BUSINESS (via order.businessId)
|
|
# ------------------------------------------------------------
|
|
#for spending insights in home view
|
|
query getCompletedShiftsByBusinessId(
|
|
$businessId: UUID!
|
|
$dateFrom: Timestamp!
|
|
$dateTo: Timestamp!
|
|
$offset: Int
|
|
$limit: Int
|
|
) @auth(level: USER) {
|
|
shifts(
|
|
where: {
|
|
order: { businessId: { eq: $businessId } }
|
|
status: {in: [IN_PROGRESS, COMPLETED, OPEN]}
|
|
date: { ge: $dateFrom, le: $dateTo }
|
|
}
|
|
offset: $offset
|
|
limit: $limit
|
|
) {
|
|
id
|
|
#title
|
|
|
|
#orderId
|
|
|
|
date
|
|
startTime
|
|
endTime
|
|
hours
|
|
cost
|
|
|
|
#location
|
|
#locationAddress
|
|
#latitude
|
|
#longitude
|
|
#description
|
|
|
|
#status
|
|
workersNeeded
|
|
filled
|
|
#filledAt
|
|
|
|
#managers
|
|
#durationDays
|
|
|
|
createdAt
|
|
|
|
order {
|
|
#id
|
|
#eventName
|
|
status
|
|
#orderType
|
|
#businessId
|
|
#vendorId
|
|
#business { id businessName email contactName }
|
|
#vendor { id companyName }
|
|
}
|
|
}
|
|
}
|