moving dataconnect to dev
This commit is contained in:
123
backend/dataconnect/connector/invoice/mutations.gql
Normal file
123
backend/dataconnect/connector/invoice/mutations.gql
Normal file
@@ -0,0 +1,123 @@
|
||||
|
||||
mutation createInvoice(
|
||||
$status: InvoiceStatus!
|
||||
|
||||
$vendorId: UUID!
|
||||
$businessId: UUID!
|
||||
$orderId: UUID!
|
||||
|
||||
$paymentTerms: InovicePaymentTerms
|
||||
$invoiceNumber: String!
|
||||
$issueDate: Timestamp!
|
||||
$dueDate: Timestamp!
|
||||
$hub: String
|
||||
$managerName: String
|
||||
$vendorNumber: String
|
||||
$roles: Any
|
||||
$charges: Any
|
||||
$otherCharges: Float
|
||||
$subtotal: Float
|
||||
$amount: Float!
|
||||
$notes: String
|
||||
|
||||
$staffCount: Int
|
||||
$chargesCount: Int
|
||||
|
||||
) @auth(level: USER) {
|
||||
invoice_insert(
|
||||
data: {
|
||||
status: $status
|
||||
|
||||
vendorId: $vendorId
|
||||
businessId: $businessId
|
||||
orderId: $orderId
|
||||
|
||||
paymentTerms: $paymentTerms
|
||||
invoiceNumber: $invoiceNumber
|
||||
issueDate: $issueDate
|
||||
dueDate: $dueDate
|
||||
hub: $hub
|
||||
managerName: $managerName
|
||||
vendorNumber: $vendorNumber
|
||||
roles: $roles
|
||||
charges: $charges
|
||||
otherCharges: $otherCharges
|
||||
subtotal: $subtotal
|
||||
amount: $amount
|
||||
notes: $notes
|
||||
|
||||
staffCount: $staffCount
|
||||
chargesCount: $chargesCount
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
mutation updateInvoice(
|
||||
$id: UUID!
|
||||
|
||||
$status: InvoiceStatus
|
||||
|
||||
$vendorId: UUID
|
||||
$businessId: UUID
|
||||
$orderId: UUID
|
||||
|
||||
$paymentTerms: InovicePaymentTerms
|
||||
$invoiceNumber: String
|
||||
$issueDate: Timestamp
|
||||
$dueDate: Timestamp
|
||||
$hub: String
|
||||
$managerName: String
|
||||
$vendorNumber: String
|
||||
$roles: Any
|
||||
$charges: Any
|
||||
$otherCharges: Float
|
||||
$subtotal: Float
|
||||
$amount: Float
|
||||
$notes: String
|
||||
|
||||
$staffCount: Int
|
||||
$chargesCount: Int
|
||||
|
||||
|
||||
$disputedItems: Any
|
||||
$disputeReason: String
|
||||
$disputeDetails: String
|
||||
) @auth(level: USER) {
|
||||
invoice_update(
|
||||
id: $id
|
||||
data: {
|
||||
status: $status
|
||||
|
||||
vendorId: $vendorId
|
||||
businessId: $businessId
|
||||
orderId: $orderId
|
||||
|
||||
paymentTerms: $paymentTerms
|
||||
invoiceNumber: $invoiceNumber
|
||||
issueDate: $issueDate
|
||||
dueDate: $dueDate
|
||||
hub: $hub
|
||||
managerName: $managerName
|
||||
vendorNumber: $vendorNumber
|
||||
roles: $roles
|
||||
charges: $charges
|
||||
otherCharges: $otherCharges
|
||||
subtotal: $subtotal
|
||||
amount: $amount
|
||||
notes: $notes
|
||||
|
||||
staffCount: $staffCount
|
||||
chargesCount: $chargesCount
|
||||
|
||||
disputedItems: $disputedItems
|
||||
disputeReason: $disputeReason
|
||||
disputeDetails: $disputeDetails
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
mutation deleteInvoice($id: UUID!) @auth(level: USER) {
|
||||
invoice_delete(id: $id)
|
||||
}
|
||||
520
backend/dataconnect/connector/invoice/queries.gql
Normal file
520
backend/dataconnect/connector/invoice/queries.gql
Normal file
@@ -0,0 +1,520 @@
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# LIST ALL INVOICES (admin/debug)
|
||||
# ------------------------------------------------------------
|
||||
query listInvoices(
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
invoices(offset: $offset, limit: $limit) {
|
||||
id
|
||||
status
|
||||
|
||||
vendorId
|
||||
businessId
|
||||
orderId
|
||||
|
||||
paymentTerms
|
||||
invoiceNumber
|
||||
issueDate
|
||||
dueDate
|
||||
hub
|
||||
managerName
|
||||
vendorNumber
|
||||
roles
|
||||
charges
|
||||
otherCharges
|
||||
subtotal
|
||||
amount
|
||||
notes
|
||||
|
||||
staffCount
|
||||
chargesCount
|
||||
|
||||
disputedItems
|
||||
disputeReason
|
||||
disputeDetails
|
||||
|
||||
vendor {
|
||||
companyName
|
||||
address
|
||||
email
|
||||
phone
|
||||
}
|
||||
|
||||
business {
|
||||
businessName
|
||||
address
|
||||
phone
|
||||
email
|
||||
}
|
||||
order {
|
||||
eventName
|
||||
hub
|
||||
deparment
|
||||
poReference
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# GET INVOICE BY ID
|
||||
# ------------------------------------------------------------
|
||||
query getInvoiceById($id: UUID!) @auth(level: USER) {
|
||||
invoice(id: $id) {
|
||||
id
|
||||
status
|
||||
|
||||
vendorId
|
||||
businessId
|
||||
orderId
|
||||
|
||||
paymentTerms
|
||||
invoiceNumber
|
||||
issueDate
|
||||
dueDate
|
||||
hub
|
||||
managerName
|
||||
vendorNumber
|
||||
roles
|
||||
charges
|
||||
otherCharges
|
||||
subtotal
|
||||
amount
|
||||
notes
|
||||
|
||||
staffCount
|
||||
chargesCount
|
||||
|
||||
disputedItems
|
||||
disputeReason
|
||||
disputeDetails
|
||||
|
||||
vendor {
|
||||
companyName
|
||||
address
|
||||
email
|
||||
phone
|
||||
}
|
||||
|
||||
business {
|
||||
businessName
|
||||
address
|
||||
phone
|
||||
email
|
||||
}
|
||||
order {
|
||||
eventName
|
||||
hub
|
||||
deparment
|
||||
poReference
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# LIST INVOICES BY VENDOR
|
||||
# ------------------------------------------------------------
|
||||
query listInvoicesByVendorId(
|
||||
$vendorId: UUID!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
invoices(
|
||||
where: { vendorId: { eq: $vendorId } }
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
orderBy: { issueDate: DESC }
|
||||
) {
|
||||
id
|
||||
status
|
||||
|
||||
vendorId
|
||||
businessId
|
||||
orderId
|
||||
|
||||
paymentTerms
|
||||
invoiceNumber
|
||||
issueDate
|
||||
dueDate
|
||||
hub
|
||||
managerName
|
||||
vendorNumber
|
||||
roles
|
||||
charges
|
||||
otherCharges
|
||||
subtotal
|
||||
amount
|
||||
notes
|
||||
|
||||
staffCount
|
||||
chargesCount
|
||||
|
||||
disputedItems
|
||||
disputeReason
|
||||
disputeDetails
|
||||
|
||||
vendor {
|
||||
companyName
|
||||
address
|
||||
email
|
||||
phone
|
||||
}
|
||||
|
||||
business {
|
||||
businessName
|
||||
address
|
||||
phone
|
||||
email
|
||||
}
|
||||
order {
|
||||
eventName
|
||||
hub
|
||||
deparment
|
||||
poReference
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# LIST INVOICES BY BUSINESS
|
||||
# ------------------------------------------------------------
|
||||
query listInvoicesByBusinessId(
|
||||
$businessId: UUID!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
invoices(
|
||||
where: { businessId: { eq: $businessId } }
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
orderBy: { issueDate: DESC }
|
||||
) {
|
||||
id
|
||||
status
|
||||
|
||||
vendorId
|
||||
businessId
|
||||
orderId
|
||||
|
||||
paymentTerms
|
||||
invoiceNumber
|
||||
issueDate
|
||||
dueDate
|
||||
hub
|
||||
managerName
|
||||
vendorNumber
|
||||
roles
|
||||
charges
|
||||
otherCharges
|
||||
subtotal
|
||||
amount
|
||||
notes
|
||||
|
||||
staffCount
|
||||
chargesCount
|
||||
|
||||
disputedItems
|
||||
disputeReason
|
||||
disputeDetails
|
||||
|
||||
vendor {
|
||||
companyName
|
||||
address
|
||||
email
|
||||
phone
|
||||
}
|
||||
|
||||
business {
|
||||
businessName
|
||||
address
|
||||
phone
|
||||
email
|
||||
}
|
||||
order {
|
||||
eventName
|
||||
hub
|
||||
deparment
|
||||
poReference
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# LIST INVOICES BY ORDER
|
||||
# ------------------------------------------------------------
|
||||
query listInvoicesByOrderId(
|
||||
$orderId: UUID!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
invoices(
|
||||
where: { orderId: { eq: $orderId } }
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
orderBy: { issueDate: DESC }
|
||||
) {
|
||||
id
|
||||
status
|
||||
|
||||
vendorId
|
||||
businessId
|
||||
orderId
|
||||
|
||||
paymentTerms
|
||||
invoiceNumber
|
||||
issueDate
|
||||
dueDate
|
||||
hub
|
||||
managerName
|
||||
vendorNumber
|
||||
roles
|
||||
charges
|
||||
otherCharges
|
||||
subtotal
|
||||
amount
|
||||
notes
|
||||
|
||||
staffCount
|
||||
chargesCount
|
||||
|
||||
disputedItems
|
||||
disputeReason
|
||||
disputeDetails
|
||||
|
||||
vendor {
|
||||
companyName
|
||||
address
|
||||
email
|
||||
phone
|
||||
}
|
||||
|
||||
business {
|
||||
businessName
|
||||
address
|
||||
phone
|
||||
email
|
||||
}
|
||||
order {
|
||||
eventName
|
||||
hub
|
||||
deparment
|
||||
poReference
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# LIST INVOICES BY STATUS
|
||||
# ------------------------------------------------------------
|
||||
query listInvoicesByStatus(
|
||||
$status: InvoiceStatus!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
invoices(
|
||||
where: { status: { eq: $status } }
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
orderBy: { dueDate: ASC }
|
||||
) {
|
||||
id
|
||||
status
|
||||
|
||||
vendorId
|
||||
businessId
|
||||
orderId
|
||||
|
||||
paymentTerms
|
||||
invoiceNumber
|
||||
issueDate
|
||||
dueDate
|
||||
hub
|
||||
managerName
|
||||
vendorNumber
|
||||
roles
|
||||
charges
|
||||
otherCharges
|
||||
subtotal
|
||||
amount
|
||||
notes
|
||||
|
||||
staffCount
|
||||
chargesCount
|
||||
|
||||
disputedItems
|
||||
disputeReason
|
||||
disputeDetails
|
||||
|
||||
vendor {
|
||||
companyName
|
||||
address
|
||||
email
|
||||
phone
|
||||
}
|
||||
|
||||
business {
|
||||
businessName
|
||||
address
|
||||
phone
|
||||
email
|
||||
}
|
||||
order {
|
||||
eventName
|
||||
hub
|
||||
deparment
|
||||
poReference
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# FILTER INVOICES (multi filters)
|
||||
# NOTE: Timestamp filters use ge/le (NOT gte/lte)
|
||||
# ------------------------------------------------------------
|
||||
query filterInvoices(
|
||||
$vendorId: UUID
|
||||
$businessId: UUID
|
||||
$orderId: UUID
|
||||
$status: InvoiceStatus
|
||||
|
||||
$issueDateFrom: Timestamp
|
||||
$issueDateTo: Timestamp
|
||||
|
||||
$dueDateFrom: Timestamp
|
||||
$dueDateTo: Timestamp
|
||||
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
invoices(
|
||||
where: {
|
||||
vendorId: { eq: $vendorId }
|
||||
businessId: { eq: $businessId }
|
||||
orderId: { eq: $orderId }
|
||||
status: { eq: $status }
|
||||
|
||||
issueDate: { ge: $issueDateFrom, le: $issueDateTo }
|
||||
dueDate: { ge: $dueDateFrom, le: $dueDateTo }
|
||||
}
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
orderBy: { issueDate: DESC }
|
||||
) {
|
||||
id
|
||||
status
|
||||
|
||||
vendorId
|
||||
businessId
|
||||
orderId
|
||||
|
||||
paymentTerms
|
||||
invoiceNumber
|
||||
issueDate
|
||||
dueDate
|
||||
hub
|
||||
managerName
|
||||
vendorNumber
|
||||
roles
|
||||
charges
|
||||
otherCharges
|
||||
subtotal
|
||||
amount
|
||||
notes
|
||||
|
||||
staffCount
|
||||
chargesCount
|
||||
|
||||
disputedItems
|
||||
disputeReason
|
||||
disputeDetails
|
||||
|
||||
vendor {
|
||||
companyName
|
||||
address
|
||||
email
|
||||
phone
|
||||
}
|
||||
|
||||
business {
|
||||
businessName
|
||||
address
|
||||
phone
|
||||
email
|
||||
}
|
||||
order {
|
||||
eventName
|
||||
hub
|
||||
deparment
|
||||
poReference
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# OVERDUE INVOICES (dueDate < now and not PAID)
|
||||
# NOTE: request.time works in @default; for filters, pass $now from client
|
||||
# ------------------------------------------------------------
|
||||
query listOverdueInvoices(
|
||||
$now: Timestamp!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
invoices(
|
||||
where: {
|
||||
dueDate: { lt: $now }
|
||||
status: { ne: PAID }
|
||||
}
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
orderBy: { dueDate: ASC }
|
||||
) {
|
||||
id
|
||||
status
|
||||
|
||||
vendorId
|
||||
businessId
|
||||
orderId
|
||||
|
||||
paymentTerms
|
||||
invoiceNumber
|
||||
issueDate
|
||||
dueDate
|
||||
hub
|
||||
managerName
|
||||
vendorNumber
|
||||
roles
|
||||
charges
|
||||
otherCharges
|
||||
subtotal
|
||||
amount
|
||||
notes
|
||||
|
||||
staffCount
|
||||
chargesCount
|
||||
|
||||
disputedItems
|
||||
disputeReason
|
||||
disputeDetails
|
||||
|
||||
vendor {
|
||||
companyName
|
||||
address
|
||||
email
|
||||
phone
|
||||
}
|
||||
|
||||
business {
|
||||
businessName
|
||||
address
|
||||
phone
|
||||
email
|
||||
}
|
||||
order {
|
||||
eventName
|
||||
hub
|
||||
deparment
|
||||
poReference
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user