fix: Update Invoice schema, queries, mutations and remove ShiftDayCompletion related files
This commit is contained in:
@@ -5,6 +5,7 @@ mutation createInvoice(
|
|||||||
$vendorId: UUID!
|
$vendorId: UUID!
|
||||||
$businessId: UUID!
|
$businessId: UUID!
|
||||||
$orderId: UUID!
|
$orderId: UUID!
|
||||||
|
$shiftId: UUID
|
||||||
|
|
||||||
$paymentTerms: InovicePaymentTerms
|
$paymentTerms: InovicePaymentTerms
|
||||||
$invoiceNumber: String!
|
$invoiceNumber: String!
|
||||||
@@ -31,6 +32,7 @@ mutation createInvoice(
|
|||||||
vendorId: $vendorId
|
vendorId: $vendorId
|
||||||
businessId: $businessId
|
businessId: $businessId
|
||||||
orderId: $orderId
|
orderId: $orderId
|
||||||
|
shiftId: $shiftId
|
||||||
|
|
||||||
paymentTerms: $paymentTerms
|
paymentTerms: $paymentTerms
|
||||||
invoiceNumber: $invoiceNumber
|
invoiceNumber: $invoiceNumber
|
||||||
@@ -61,6 +63,7 @@ mutation updateInvoice(
|
|||||||
$vendorId: UUID
|
$vendorId: UUID
|
||||||
$businessId: UUID
|
$businessId: UUID
|
||||||
$orderId: UUID
|
$orderId: UUID
|
||||||
|
$shiftId: UUID
|
||||||
|
|
||||||
$paymentTerms: InovicePaymentTerms
|
$paymentTerms: InovicePaymentTerms
|
||||||
$invoiceNumber: String
|
$invoiceNumber: String
|
||||||
@@ -92,6 +95,7 @@ mutation updateInvoice(
|
|||||||
vendorId: $vendorId
|
vendorId: $vendorId
|
||||||
businessId: $businessId
|
businessId: $businessId
|
||||||
orderId: $orderId
|
orderId: $orderId
|
||||||
|
shiftId: $shiftId
|
||||||
|
|
||||||
paymentTerms: $paymentTerms
|
paymentTerms: $paymentTerms
|
||||||
invoiceNumber: $invoiceNumber
|
invoiceNumber: $invoiceNumber
|
||||||
@@ -121,3 +125,39 @@ mutation updateInvoice(
|
|||||||
mutation deleteInvoice($id: UUID!) @auth(level: USER) {
|
mutation deleteInvoice($id: UUID!) @auth(level: USER) {
|
||||||
invoice_delete(id: $id)
|
invoice_delete(id: $id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# APPROVE INVOICE
|
||||||
|
# Called by the client to approve a shift-day completion record.
|
||||||
|
# Sets status to APPROVED, triggering the invoice-ready state.
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
mutation approveInvoice($id: UUID!) @auth(level: USER) {
|
||||||
|
invoice_update(
|
||||||
|
id: $id
|
||||||
|
data: {
|
||||||
|
status: APPROVED
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# DISPUTE INVOICE
|
||||||
|
# Called by the client to dispute a shift-day completion record.
|
||||||
|
# Sets status to DISPUTED and stores the dispute details.
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
mutation disputeInvoice(
|
||||||
|
$id: UUID!
|
||||||
|
$disputedItems: Any
|
||||||
|
$disputeReason: String!
|
||||||
|
$disputeDetails: String
|
||||||
|
) @auth(level: USER) {
|
||||||
|
invoice_update(
|
||||||
|
id: $id
|
||||||
|
data: {
|
||||||
|
status: DISPUTED
|
||||||
|
disputedItems: $disputedItems
|
||||||
|
disputeReason: $disputeReason
|
||||||
|
disputeDetails: $disputeDetails
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ query listInvoices(
|
|||||||
vendorId
|
vendorId
|
||||||
businessId
|
businessId
|
||||||
orderId
|
orderId
|
||||||
|
shiftId
|
||||||
|
|
||||||
paymentTerms
|
paymentTerms
|
||||||
invoiceNumber
|
invoiceNumber
|
||||||
@@ -74,6 +75,7 @@ query getInvoiceById($id: UUID!) @auth(level: USER) {
|
|||||||
vendorId
|
vendorId
|
||||||
businessId
|
businessId
|
||||||
orderId
|
orderId
|
||||||
|
shiftId
|
||||||
|
|
||||||
paymentTerms
|
paymentTerms
|
||||||
invoiceNumber
|
invoiceNumber
|
||||||
@@ -144,6 +146,7 @@ query listInvoicesByVendorId(
|
|||||||
vendorId
|
vendorId
|
||||||
businessId
|
businessId
|
||||||
orderId
|
orderId
|
||||||
|
shiftId
|
||||||
|
|
||||||
paymentTerms
|
paymentTerms
|
||||||
invoiceNumber
|
invoiceNumber
|
||||||
@@ -214,6 +217,7 @@ query listInvoicesByBusinessId(
|
|||||||
vendorId
|
vendorId
|
||||||
businessId
|
businessId
|
||||||
orderId
|
orderId
|
||||||
|
shiftId
|
||||||
|
|
||||||
paymentTerms
|
paymentTerms
|
||||||
invoiceNumber
|
invoiceNumber
|
||||||
@@ -284,6 +288,7 @@ query listInvoicesByOrderId(
|
|||||||
vendorId
|
vendorId
|
||||||
businessId
|
businessId
|
||||||
orderId
|
orderId
|
||||||
|
shiftId
|
||||||
|
|
||||||
paymentTerms
|
paymentTerms
|
||||||
invoiceNumber
|
invoiceNumber
|
||||||
@@ -354,6 +359,7 @@ query listInvoicesByStatus(
|
|||||||
vendorId
|
vendorId
|
||||||
businessId
|
businessId
|
||||||
orderId
|
orderId
|
||||||
|
shiftId
|
||||||
|
|
||||||
paymentTerms
|
paymentTerms
|
||||||
invoiceNumber
|
invoiceNumber
|
||||||
@@ -407,11 +413,14 @@ query listInvoicesByStatus(
|
|||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# FILTER INVOICES (multi filters)
|
# FILTER INVOICES (multi filters)
|
||||||
# NOTE: Timestamp filters use ge/le (NOT gte/lte)
|
# NOTE: Timestamp filters use ge/le (NOT gte/lte)
|
||||||
|
# Supports shiftId filter — use with status: PENDING_REVIEW to list
|
||||||
|
# shift-day completion records awaiting client approval.
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
query filterInvoices(
|
query filterInvoices(
|
||||||
$vendorId: UUID
|
$vendorId: UUID
|
||||||
$businessId: UUID
|
$businessId: UUID
|
||||||
$orderId: UUID
|
$orderId: UUID
|
||||||
|
$shiftId: UUID
|
||||||
$status: InvoiceStatus
|
$status: InvoiceStatus
|
||||||
|
|
||||||
$issueDateFrom: Timestamp
|
$issueDateFrom: Timestamp
|
||||||
@@ -428,6 +437,7 @@ query filterInvoices(
|
|||||||
vendorId: { eq: $vendorId }
|
vendorId: { eq: $vendorId }
|
||||||
businessId: { eq: $businessId }
|
businessId: { eq: $businessId }
|
||||||
orderId: { eq: $orderId }
|
orderId: { eq: $orderId }
|
||||||
|
shiftId: { eq: $shiftId }
|
||||||
status: { eq: $status }
|
status: { eq: $status }
|
||||||
|
|
||||||
issueDate: { ge: $issueDateFrom, le: $issueDateTo }
|
issueDate: { ge: $issueDateFrom, le: $issueDateTo }
|
||||||
@@ -443,6 +453,7 @@ query filterInvoices(
|
|||||||
vendorId
|
vendorId
|
||||||
businessId
|
businessId
|
||||||
orderId
|
orderId
|
||||||
|
shiftId
|
||||||
|
|
||||||
paymentTerms
|
paymentTerms
|
||||||
invoiceNumber
|
invoiceNumber
|
||||||
@@ -517,6 +528,7 @@ query listOverdueInvoices(
|
|||||||
vendorId
|
vendorId
|
||||||
businessId
|
businessId
|
||||||
orderId
|
orderId
|
||||||
|
shiftId
|
||||||
|
|
||||||
paymentTerms
|
paymentTerms
|
||||||
invoiceNumber
|
invoiceNumber
|
||||||
|
|||||||
@@ -1,129 +0,0 @@
|
|||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# CREATE — called automatically at the end of each shift day
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
mutation createShiftDayCompletion(
|
|
||||||
$shiftId: UUID!
|
|
||||||
$orderId: UUID!
|
|
||||||
$businessId: UUID!
|
|
||||||
$vendorId: UUID!
|
|
||||||
$dayDate: Timestamp!
|
|
||||||
$dayNumber: Int!
|
|
||||||
$hours: Float
|
|
||||||
$cost: Float
|
|
||||||
$staffSummary: Any
|
|
||||||
$createdBy: String
|
|
||||||
) @auth(level: USER) {
|
|
||||||
shiftDayCompletion_insert(
|
|
||||||
data: {
|
|
||||||
shiftId: $shiftId
|
|
||||||
orderId: $orderId
|
|
||||||
businessId: $businessId
|
|
||||||
vendorId: $vendorId
|
|
||||||
dayDate: $dayDate
|
|
||||||
dayNumber: $dayNumber
|
|
||||||
status: PENDING_REVIEW
|
|
||||||
hours: $hours
|
|
||||||
cost: $cost
|
|
||||||
staffSummary: $staffSummary
|
|
||||||
createdBy: $createdBy
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# APPROVE — client approves a daily completion record
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
mutation approveShiftDayCompletion(
|
|
||||||
$id: UUID!
|
|
||||||
$reviewedBy: String!
|
|
||||||
$reviewedAt: Timestamp!
|
|
||||||
) @auth(level: USER) {
|
|
||||||
shiftDayCompletion_update(
|
|
||||||
id: $id
|
|
||||||
data: {
|
|
||||||
status: APPROVED
|
|
||||||
reviewedBy: $reviewedBy
|
|
||||||
reviewedAt: $reviewedAt
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# DISPUTE — client disputes a daily completion record
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
mutation disputeShiftDayCompletion(
|
|
||||||
$id: UUID!
|
|
||||||
$reviewedBy: String!
|
|
||||||
$reviewedAt: Timestamp!
|
|
||||||
$disputeReason: String!
|
|
||||||
$disputeDetails: String
|
|
||||||
$disputedItems: Any
|
|
||||||
) @auth(level: USER) {
|
|
||||||
shiftDayCompletion_update(
|
|
||||||
id: $id
|
|
||||||
data: {
|
|
||||||
status: DISPUTED
|
|
||||||
reviewedBy: $reviewedBy
|
|
||||||
reviewedAt: $reviewedAt
|
|
||||||
disputeReason: $disputeReason
|
|
||||||
disputeDetails: $disputeDetails
|
|
||||||
disputedItems: $disputedItems
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# LINK INVOICE — set once invoice is generated after full approval
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
mutation linkInvoiceToShiftDayCompletion(
|
|
||||||
$id: UUID!
|
|
||||||
$invoiceId: UUID!
|
|
||||||
) @auth(level: USER) {
|
|
||||||
shiftDayCompletion_update(
|
|
||||||
id: $id
|
|
||||||
data: {
|
|
||||||
invoiceId: $invoiceId
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# UPDATE — general-purpose update (admin use)
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
mutation updateShiftDayCompletion(
|
|
||||||
$id: UUID!
|
|
||||||
$status: ShiftDayCompletionStatus
|
|
||||||
$hours: Float
|
|
||||||
$cost: Float
|
|
||||||
$staffSummary: Any
|
|
||||||
$disputeReason: String
|
|
||||||
$disputeDetails: String
|
|
||||||
$disputedItems: Any
|
|
||||||
$reviewedBy: String
|
|
||||||
$reviewedAt: Timestamp
|
|
||||||
$invoiceId: UUID
|
|
||||||
) @auth(level: USER) {
|
|
||||||
shiftDayCompletion_update(
|
|
||||||
id: $id
|
|
||||||
data: {
|
|
||||||
status: $status
|
|
||||||
hours: $hours
|
|
||||||
cost: $cost
|
|
||||||
staffSummary: $staffSummary
|
|
||||||
disputeReason: $disputeReason
|
|
||||||
disputeDetails: $disputeDetails
|
|
||||||
disputedItems: $disputedItems
|
|
||||||
reviewedBy: $reviewedBy
|
|
||||||
reviewedAt: $reviewedAt
|
|
||||||
invoiceId: $invoiceId
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# DELETE
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
mutation deleteShiftDayCompletion($id: UUID!) @auth(level: USER) {
|
|
||||||
shiftDayCompletion_delete(id: $id)
|
|
||||||
}
|
|
||||||
@@ -1,417 +0,0 @@
|
|||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -31,6 +31,9 @@ type Invoice @table(name: "invoices") {
|
|||||||
orderId: UUID!
|
orderId: UUID!
|
||||||
order: Order! @ref(fields: "orderId", references: "id")
|
order: Order! @ref(fields: "orderId", references: "id")
|
||||||
|
|
||||||
|
shiftId: UUID
|
||||||
|
shift: Shift @ref(fields: "shiftId", references: "id")
|
||||||
|
|
||||||
#web
|
#web
|
||||||
paymentTerms: InovicePaymentTerms
|
paymentTerms: InovicePaymentTerms
|
||||||
invoiceNumber: String!
|
invoiceNumber: String!
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
enum ShiftDayCompletionStatus {
|
|
||||||
PENDING_REVIEW
|
|
||||||
APPROVED
|
|
||||||
DISPUTED
|
|
||||||
}
|
|
||||||
|
|
||||||
type ShiftDayCompletion @table(name: "shift_day_completions", key: ["id"]) {
|
|
||||||
id: UUID! @default(expr: "uuidV4()")
|
|
||||||
|
|
||||||
shiftId: UUID!
|
|
||||||
shift: Shift! @ref(fields: "shiftId", references: "id")
|
|
||||||
|
|
||||||
orderId: UUID!
|
|
||||||
order: Order! @ref(fields: "orderId", references: "id")
|
|
||||||
|
|
||||||
businessId: UUID!
|
|
||||||
business: Business! @ref(fields: "businessId", references: "id")
|
|
||||||
|
|
||||||
vendorId: UUID!
|
|
||||||
vendor: Vendor! @ref(fields: "vendorId", references: "id")
|
|
||||||
|
|
||||||
dayDate: Timestamp!
|
|
||||||
dayNumber: Int!
|
|
||||||
|
|
||||||
status: ShiftDayCompletionStatus! @default(expr: "'PENDING_REVIEW'")
|
|
||||||
|
|
||||||
hours: Float
|
|
||||||
cost: Float
|
|
||||||
|
|
||||||
staffSummary: Any @col(dataType: "jsonb")
|
|
||||||
|
|
||||||
disputeReason: String
|
|
||||||
disputeDetails: String
|
|
||||||
disputedItems: Any @col(dataType: "jsonb")
|
|
||||||
|
|
||||||
reviewedBy: String
|
|
||||||
reviewedAt: Timestamp
|
|
||||||
|
|
||||||
invoiceId: UUID
|
|
||||||
invoice: Invoice @ref(fields: "invoiceId", references: "id")
|
|
||||||
|
|
||||||
createdAt: Timestamp @default(expr: "request.time")
|
|
||||||
updatedAt: Timestamp @default(expr: "request.time")
|
|
||||||
createdBy: String
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user