326 lines
5.7 KiB
GraphQL
326 lines
5.7 KiB
GraphQL
|
|
# ----------------------------------------------------------
|
|
# LIST ALL (admin/debug)
|
|
# ----------------------------------------------------------
|
|
query listInvoiceTemplates(
|
|
$offset: Int
|
|
$limit: Int
|
|
) @auth(level: USER) {
|
|
invoiceTemplates(offset: $offset, limit: $limit) {
|
|
id
|
|
name
|
|
ownerId
|
|
|
|
vendorId
|
|
businessId
|
|
orderId
|
|
|
|
paymentTerms
|
|
invoiceNumber
|
|
issueDate
|
|
dueDate
|
|
hub
|
|
managerName
|
|
vendorNumber
|
|
roles
|
|
charges
|
|
otherCharges
|
|
subtotal
|
|
amount
|
|
notes
|
|
staffCount
|
|
chargesCount
|
|
|
|
createdAt
|
|
updatedAt
|
|
createdBy
|
|
|
|
vendor { id companyName }
|
|
business { id businessName email contactName }
|
|
order { id eventName status orderType }
|
|
}
|
|
}
|
|
|
|
# ----------------------------------------------------------
|
|
# GET BY ID
|
|
# ----------------------------------------------------------
|
|
query getInvoiceTemplateById($id: UUID!) @auth(level: USER) {
|
|
invoiceTemplate(id: $id) {
|
|
id
|
|
name
|
|
ownerId
|
|
|
|
vendorId
|
|
businessId
|
|
orderId
|
|
|
|
paymentTerms
|
|
invoiceNumber
|
|
issueDate
|
|
dueDate
|
|
hub
|
|
managerName
|
|
vendorNumber
|
|
roles
|
|
charges
|
|
otherCharges
|
|
subtotal
|
|
amount
|
|
notes
|
|
staffCount
|
|
chargesCount
|
|
|
|
createdAt
|
|
updatedAt
|
|
createdBy
|
|
|
|
vendor { id companyName }
|
|
business { id businessName email contactName }
|
|
order { id eventName status orderType }
|
|
}
|
|
}
|
|
|
|
# ----------------------------------------------------------
|
|
# LIST BY OWNER (my templates)
|
|
# ----------------------------------------------------------
|
|
query listInvoiceTemplatesByOwnerId(
|
|
$ownerId: UUID!
|
|
$offset: Int
|
|
$limit: Int
|
|
) @auth(level: USER) {
|
|
invoiceTemplates(
|
|
where: { ownerId: { eq: $ownerId } }
|
|
offset: $offset
|
|
limit: $limit
|
|
orderBy: { updatedAt: DESC }
|
|
) {
|
|
id
|
|
name
|
|
ownerId
|
|
|
|
vendorId
|
|
businessId
|
|
orderId
|
|
|
|
paymentTerms
|
|
invoiceNumber
|
|
issueDate
|
|
dueDate
|
|
hub
|
|
managerName
|
|
vendorNumber
|
|
roles
|
|
charges
|
|
otherCharges
|
|
subtotal
|
|
amount
|
|
notes
|
|
staffCount
|
|
chargesCount
|
|
|
|
createdAt
|
|
updatedAt
|
|
createdBy
|
|
|
|
vendor { id companyName }
|
|
business { id businessName email contactName }
|
|
order { id eventName status orderType }
|
|
}
|
|
}
|
|
|
|
# ----------------------------------------------------------
|
|
# LIST BY VENDOR (templates tied to a vendor)
|
|
# ----------------------------------------------------------
|
|
query listInvoiceTemplatesByVendorId(
|
|
$vendorId: UUID!
|
|
$offset: Int
|
|
$limit: Int
|
|
) @auth(level: USER) {
|
|
invoiceTemplates(
|
|
where: { vendorId: { eq: $vendorId } }
|
|
offset: $offset
|
|
limit: $limit
|
|
orderBy: { updatedAt: DESC }
|
|
) {
|
|
id
|
|
name
|
|
ownerId
|
|
|
|
vendorId
|
|
businessId
|
|
orderId
|
|
|
|
paymentTerms
|
|
invoiceNumber
|
|
issueDate
|
|
dueDate
|
|
hub
|
|
managerName
|
|
vendorNumber
|
|
roles
|
|
charges
|
|
otherCharges
|
|
subtotal
|
|
amount
|
|
notes
|
|
staffCount
|
|
chargesCount
|
|
|
|
createdAt
|
|
updatedAt
|
|
createdBy
|
|
|
|
vendor { id companyName }
|
|
business { id businessName email contactName }
|
|
order { id eventName status orderType }
|
|
}
|
|
}
|
|
|
|
# ----------------------------------------------------------
|
|
# LIST BY BUSINESS (templates tied to a business)
|
|
# ----------------------------------------------------------
|
|
query listInvoiceTemplatesByBusinessId(
|
|
$businessId: UUID!
|
|
$offset: Int
|
|
$limit: Int
|
|
) @auth(level: USER) {
|
|
invoiceTemplates(
|
|
where: { businessId: { eq: $businessId } }
|
|
offset: $offset
|
|
limit: $limit
|
|
orderBy: { updatedAt: DESC }
|
|
) {
|
|
id
|
|
name
|
|
ownerId
|
|
|
|
vendorId
|
|
businessId
|
|
orderId
|
|
|
|
paymentTerms
|
|
invoiceNumber
|
|
issueDate
|
|
dueDate
|
|
hub
|
|
managerName
|
|
vendorNumber
|
|
roles
|
|
charges
|
|
otherCharges
|
|
subtotal
|
|
amount
|
|
notes
|
|
staffCount
|
|
chargesCount
|
|
|
|
createdAt
|
|
updatedAt
|
|
createdBy
|
|
|
|
vendor { id companyName }
|
|
business { id businessName email contactName }
|
|
order { id eventName status orderType }
|
|
}
|
|
}
|
|
|
|
# ----------------------------------------------------------
|
|
# LIST BY ORDER (templates tied to a specific order)
|
|
# ----------------------------------------------------------
|
|
query listInvoiceTemplatesByOrderId(
|
|
$orderId: UUID!
|
|
$offset: Int
|
|
$limit: Int
|
|
) @auth(level: USER) {
|
|
invoiceTemplates(
|
|
where: { orderId: { eq: $orderId } }
|
|
offset: $offset
|
|
limit: $limit
|
|
orderBy: { updatedAt: DESC }
|
|
) {
|
|
id
|
|
name
|
|
ownerId
|
|
|
|
vendorId
|
|
businessId
|
|
orderId
|
|
|
|
paymentTerms
|
|
invoiceNumber
|
|
issueDate
|
|
dueDate
|
|
hub
|
|
managerName
|
|
vendorNumber
|
|
roles
|
|
charges
|
|
otherCharges
|
|
subtotal
|
|
amount
|
|
notes
|
|
staffCount
|
|
chargesCount
|
|
|
|
createdAt
|
|
updatedAt
|
|
createdBy
|
|
|
|
vendor { id companyName }
|
|
business { id businessName email contactName }
|
|
order { id eventName status orderType }
|
|
}
|
|
}
|
|
|
|
# ----------------------------------------------------------
|
|
# SEARCH (by name) within an owner
|
|
# ----------------------------------------------------------
|
|
query searchInvoiceTemplatesByOwnerAndName(
|
|
$ownerId: UUID!
|
|
$name: String!
|
|
$offset: Int
|
|
$limit: Int
|
|
) @auth(level: USER) {
|
|
invoiceTemplates(
|
|
where: {
|
|
ownerId: { eq: $ownerId }
|
|
name: { eq: $name }
|
|
}
|
|
offset: $offset
|
|
limit: $limit
|
|
orderBy: { updatedAt: DESC }
|
|
) {
|
|
id
|
|
name
|
|
ownerId
|
|
|
|
vendorId
|
|
businessId
|
|
orderId
|
|
|
|
paymentTerms
|
|
invoiceNumber
|
|
issueDate
|
|
dueDate
|
|
hub
|
|
managerName
|
|
vendorNumber
|
|
roles
|
|
charges
|
|
otherCharges
|
|
subtotal
|
|
amount
|
|
notes
|
|
staffCount
|
|
chargesCount
|
|
|
|
createdAt
|
|
updatedAt
|
|
createdBy
|
|
|
|
vendor { id companyName }
|
|
business { id businessName email contactName }
|
|
order { id eventName status orderType }
|
|
}
|
|
}
|