feat(statistics): implement top alert stocks, top last sales, top supplier debts, and top selling products endpoints with SQL queries
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -57,16 +57,17 @@ export const ModelName = {
|
||||
RefreshToken: 'RefreshToken',
|
||||
BankBranch: 'BankBranch',
|
||||
BankAccount: 'BankAccount',
|
||||
BankAccountTransaction: 'BankAccountTransaction',
|
||||
BankAccountBalance: 'BankAccountBalance',
|
||||
Inventory: 'Inventory',
|
||||
InventoryBankAccount: 'InventoryBankAccount',
|
||||
PosAccount: 'PosAccount',
|
||||
InventoryTransfer: 'InventoryTransfer',
|
||||
InventoryTransferItem: 'InventoryTransferItem',
|
||||
Bank: 'Bank',
|
||||
Customer: 'Customer',
|
||||
Order: 'Order',
|
||||
SalesInvoice: 'SalesInvoice',
|
||||
SalesInvoiceItem: 'SalesInvoiceItem',
|
||||
OrderItem: 'OrderItem',
|
||||
Customer: 'Customer',
|
||||
TriggerLog: 'TriggerLog',
|
||||
ProductVariant: 'ProductVariant',
|
||||
Product: 'Product',
|
||||
@@ -75,9 +76,13 @@ export const ModelName = {
|
||||
PurchaseReceipt: 'PurchaseReceipt',
|
||||
PurchaseReceiptItem: 'PurchaseReceiptItem',
|
||||
PurchaseReceiptPayments: 'PurchaseReceiptPayments',
|
||||
SalesInvoice: 'SalesInvoice',
|
||||
SalesInvoiceItem: 'SalesInvoiceItem',
|
||||
SalesInvoicePayment: 'SalesInvoicePayment',
|
||||
StockMovement: 'StockMovement',
|
||||
StockBalance: 'StockBalance',
|
||||
StockAdjustment: 'StockAdjustment',
|
||||
StockReservation: 'StockReservation',
|
||||
Supplier: 'Supplier',
|
||||
SupplierLedger: 'SupplierLedger'
|
||||
} as const
|
||||
@@ -179,6 +184,30 @@ export const BankAccountScalarFieldEnum = {
|
||||
export type BankAccountScalarFieldEnum = (typeof BankAccountScalarFieldEnum)[keyof typeof BankAccountScalarFieldEnum]
|
||||
|
||||
|
||||
export const BankAccountTransactionScalarFieldEnum = {
|
||||
id: 'id',
|
||||
bankAccountId: 'bankAccountId',
|
||||
type: 'type',
|
||||
amount: 'amount',
|
||||
balanceAfter: 'balanceAfter',
|
||||
referenceId: 'referenceId',
|
||||
referenceType: 'referenceType',
|
||||
description: 'description',
|
||||
createdAt: 'createdAt'
|
||||
} as const
|
||||
|
||||
export type BankAccountTransactionScalarFieldEnum = (typeof BankAccountTransactionScalarFieldEnum)[keyof typeof BankAccountTransactionScalarFieldEnum]
|
||||
|
||||
|
||||
export const BankAccountBalanceScalarFieldEnum = {
|
||||
bankAccountId: 'bankAccountId',
|
||||
balance: 'balance',
|
||||
updatedAt: 'updatedAt'
|
||||
} as const
|
||||
|
||||
export type BankAccountBalanceScalarFieldEnum = (typeof BankAccountBalanceScalarFieldEnum)[keyof typeof BankAccountBalanceScalarFieldEnum]
|
||||
|
||||
|
||||
export const InventoryScalarFieldEnum = {
|
||||
id: 'id',
|
||||
name: 'name',
|
||||
@@ -250,6 +279,34 @@ export const BankScalarFieldEnum = {
|
||||
export type BankScalarFieldEnum = (typeof BankScalarFieldEnum)[keyof typeof BankScalarFieldEnum]
|
||||
|
||||
|
||||
export const OrderScalarFieldEnum = {
|
||||
id: 'id',
|
||||
orderNumber: 'orderNumber',
|
||||
status: 'status',
|
||||
totalAmount: 'totalAmount',
|
||||
description: 'description',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
deletedAt: 'deletedAt',
|
||||
customerId: 'customerId'
|
||||
} as const
|
||||
|
||||
export type OrderScalarFieldEnum = (typeof OrderScalarFieldEnum)[keyof typeof OrderScalarFieldEnum]
|
||||
|
||||
|
||||
export const OrderItemScalarFieldEnum = {
|
||||
id: 'id',
|
||||
quantity: 'quantity',
|
||||
unitPrice: 'unitPrice',
|
||||
totalAmount: 'totalAmount',
|
||||
createdAt: 'createdAt',
|
||||
orderId: 'orderId',
|
||||
productId: 'productId'
|
||||
} as const
|
||||
|
||||
export type OrderItemScalarFieldEnum = (typeof OrderItemScalarFieldEnum)[keyof typeof OrderItemScalarFieldEnum]
|
||||
|
||||
|
||||
export const CustomerScalarFieldEnum = {
|
||||
id: 'id',
|
||||
firstName: 'firstName',
|
||||
@@ -269,49 +326,6 @@ export const CustomerScalarFieldEnum = {
|
||||
export type CustomerScalarFieldEnum = (typeof CustomerScalarFieldEnum)[keyof typeof CustomerScalarFieldEnum]
|
||||
|
||||
|
||||
export const OrderScalarFieldEnum = {
|
||||
id: 'id',
|
||||
orderNumber: 'orderNumber',
|
||||
status: 'status',
|
||||
paymentMethod: 'paymentMethod',
|
||||
totalAmount: 'totalAmount',
|
||||
description: 'description',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
deletedAt: 'deletedAt',
|
||||
customerId: 'customerId'
|
||||
} as const
|
||||
|
||||
export type OrderScalarFieldEnum = (typeof OrderScalarFieldEnum)[keyof typeof OrderScalarFieldEnum]
|
||||
|
||||
|
||||
export const SalesInvoiceScalarFieldEnum = {
|
||||
id: 'id',
|
||||
code: 'code',
|
||||
totalAmount: 'totalAmount',
|
||||
description: 'description',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
customerId: 'customerId',
|
||||
posAccountId: 'posAccountId'
|
||||
} as const
|
||||
|
||||
export type SalesInvoiceScalarFieldEnum = (typeof SalesInvoiceScalarFieldEnum)[keyof typeof SalesInvoiceScalarFieldEnum]
|
||||
|
||||
|
||||
export const SalesInvoiceItemScalarFieldEnum = {
|
||||
id: 'id',
|
||||
count: 'count',
|
||||
fee: 'fee',
|
||||
total: 'total',
|
||||
createdAt: 'createdAt',
|
||||
invoiceId: 'invoiceId',
|
||||
productId: 'productId'
|
||||
} as const
|
||||
|
||||
export type SalesInvoiceItemScalarFieldEnum = (typeof SalesInvoiceItemScalarFieldEnum)[keyof typeof SalesInvoiceItemScalarFieldEnum]
|
||||
|
||||
|
||||
export const TriggerLogScalarFieldEnum = {
|
||||
id: 'id',
|
||||
message: 'message',
|
||||
@@ -407,8 +421,8 @@ export type PurchaseReceiptScalarFieldEnum = (typeof PurchaseReceiptScalarFieldE
|
||||
export const PurchaseReceiptItemScalarFieldEnum = {
|
||||
id: 'id',
|
||||
count: 'count',
|
||||
fee: 'fee',
|
||||
total: 'total',
|
||||
unitPrice: 'unitPrice',
|
||||
totalAmount: 'totalAmount',
|
||||
receiptId: 'receiptId',
|
||||
productId: 'productId',
|
||||
description: 'description',
|
||||
@@ -435,11 +449,50 @@ export const PurchaseReceiptPaymentsScalarFieldEnum = {
|
||||
export type PurchaseReceiptPaymentsScalarFieldEnum = (typeof PurchaseReceiptPaymentsScalarFieldEnum)[keyof typeof PurchaseReceiptPaymentsScalarFieldEnum]
|
||||
|
||||
|
||||
export const SalesInvoiceScalarFieldEnum = {
|
||||
id: 'id',
|
||||
code: 'code',
|
||||
totalAmount: 'totalAmount',
|
||||
description: 'description',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt',
|
||||
customerId: 'customerId',
|
||||
posAccountId: 'posAccountId'
|
||||
} as const
|
||||
|
||||
export type SalesInvoiceScalarFieldEnum = (typeof SalesInvoiceScalarFieldEnum)[keyof typeof SalesInvoiceScalarFieldEnum]
|
||||
|
||||
|
||||
export const SalesInvoiceItemScalarFieldEnum = {
|
||||
id: 'id',
|
||||
count: 'count',
|
||||
unitPrice: 'unitPrice',
|
||||
totalAmount: 'totalAmount',
|
||||
createdAt: 'createdAt',
|
||||
invoiceId: 'invoiceId',
|
||||
productId: 'productId'
|
||||
} as const
|
||||
|
||||
export type SalesInvoiceItemScalarFieldEnum = (typeof SalesInvoiceItemScalarFieldEnum)[keyof typeof SalesInvoiceItemScalarFieldEnum]
|
||||
|
||||
|
||||
export const SalesInvoicePaymentScalarFieldEnum = {
|
||||
id: 'id',
|
||||
invoiceId: 'invoiceId',
|
||||
amount: 'amount',
|
||||
paymentMethod: 'paymentMethod',
|
||||
paidAt: 'paidAt',
|
||||
createdAt: 'createdAt'
|
||||
} as const
|
||||
|
||||
export type SalesInvoicePaymentScalarFieldEnum = (typeof SalesInvoicePaymentScalarFieldEnum)[keyof typeof SalesInvoicePaymentScalarFieldEnum]
|
||||
|
||||
|
||||
export const StockMovementScalarFieldEnum = {
|
||||
id: 'id',
|
||||
type: 'type',
|
||||
quantity: 'quantity',
|
||||
fee: 'fee',
|
||||
unitPrice: 'unitPrice',
|
||||
totalCost: 'totalCost',
|
||||
referenceType: 'referenceType',
|
||||
referenceId: 'referenceId',
|
||||
@@ -481,6 +534,19 @@ export const StockAdjustmentScalarFieldEnum = {
|
||||
export type StockAdjustmentScalarFieldEnum = (typeof StockAdjustmentScalarFieldEnum)[keyof typeof StockAdjustmentScalarFieldEnum]
|
||||
|
||||
|
||||
export const StockReservationScalarFieldEnum = {
|
||||
id: 'id',
|
||||
quantity: 'quantity',
|
||||
expiresAt: 'expiresAt',
|
||||
createdAt: 'createdAt',
|
||||
productId: 'productId',
|
||||
inventoryId: 'inventoryId',
|
||||
orderId: 'orderId'
|
||||
} as const
|
||||
|
||||
export type StockReservationScalarFieldEnum = (typeof StockReservationScalarFieldEnum)[keyof typeof StockReservationScalarFieldEnum]
|
||||
|
||||
|
||||
export const SupplierScalarFieldEnum = {
|
||||
id: 'id',
|
||||
firstName: 'firstName',
|
||||
@@ -608,6 +674,13 @@ export const BankAccountOrderByRelevanceFieldEnum = {
|
||||
export type BankAccountOrderByRelevanceFieldEnum = (typeof BankAccountOrderByRelevanceFieldEnum)[keyof typeof BankAccountOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const BankAccountTransactionOrderByRelevanceFieldEnum = {
|
||||
description: 'description'
|
||||
} as const
|
||||
|
||||
export type BankAccountTransactionOrderByRelevanceFieldEnum = (typeof BankAccountTransactionOrderByRelevanceFieldEnum)[keyof typeof BankAccountTransactionOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const InventoryOrderByRelevanceFieldEnum = {
|
||||
name: 'name',
|
||||
location: 'location'
|
||||
@@ -641,6 +714,14 @@ export const BankOrderByRelevanceFieldEnum = {
|
||||
export type BankOrderByRelevanceFieldEnum = (typeof BankOrderByRelevanceFieldEnum)[keyof typeof BankOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const OrderOrderByRelevanceFieldEnum = {
|
||||
orderNumber: 'orderNumber',
|
||||
description: 'description'
|
||||
} as const
|
||||
|
||||
export type OrderOrderByRelevanceFieldEnum = (typeof OrderOrderByRelevanceFieldEnum)[keyof typeof OrderOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const CustomerOrderByRelevanceFieldEnum = {
|
||||
firstName: 'firstName',
|
||||
lastName: 'lastName',
|
||||
@@ -655,22 +736,6 @@ export const CustomerOrderByRelevanceFieldEnum = {
|
||||
export type CustomerOrderByRelevanceFieldEnum = (typeof CustomerOrderByRelevanceFieldEnum)[keyof typeof CustomerOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const OrderOrderByRelevanceFieldEnum = {
|
||||
orderNumber: 'orderNumber',
|
||||
description: 'description'
|
||||
} as const
|
||||
|
||||
export type OrderOrderByRelevanceFieldEnum = (typeof OrderOrderByRelevanceFieldEnum)[keyof typeof OrderOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const SalesInvoiceOrderByRelevanceFieldEnum = {
|
||||
code: 'code',
|
||||
description: 'description'
|
||||
} as const
|
||||
|
||||
export type SalesInvoiceOrderByRelevanceFieldEnum = (typeof SalesInvoiceOrderByRelevanceFieldEnum)[keyof typeof SalesInvoiceOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const TriggerLogOrderByRelevanceFieldEnum = {
|
||||
message: 'message',
|
||||
name: 'name'
|
||||
@@ -740,6 +805,14 @@ export const PurchaseReceiptPaymentsOrderByRelevanceFieldEnum = {
|
||||
export type PurchaseReceiptPaymentsOrderByRelevanceFieldEnum = (typeof PurchaseReceiptPaymentsOrderByRelevanceFieldEnum)[keyof typeof PurchaseReceiptPaymentsOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const SalesInvoiceOrderByRelevanceFieldEnum = {
|
||||
code: 'code',
|
||||
description: 'description'
|
||||
} as const
|
||||
|
||||
export type SalesInvoiceOrderByRelevanceFieldEnum = (typeof SalesInvoiceOrderByRelevanceFieldEnum)[keyof typeof SalesInvoiceOrderByRelevanceFieldEnum]
|
||||
|
||||
|
||||
export const StockMovementOrderByRelevanceFieldEnum = {
|
||||
referenceId: 'referenceId'
|
||||
} as const
|
||||
|
||||
Reference in New Issue
Block a user