feat: implement POS order management system

- Added CreateOrderDto and CreateOrderItemDto for order creation.
- Developed PosOrdersController to handle order-related endpoints.
- Created PosOrdersService for business logic related to orders.
- Implemented PosOrdersWorkflow for order processing workflows.
- Established Prisma integration for database operations in orders.
- Introduced SalesInvoicesModule and related DTOs for sales invoice management.
- Enhanced SalesInvoicesService and SalesInvoicesWorkflow for invoice processing.
This commit is contained in:
2026-01-07 15:25:59 +03:30
parent b05048e62f
commit 5fd6611aca
37 changed files with 1974 additions and 291 deletions
@@ -0,0 +1,17 @@
CREATE OR REPLACE VIEW Stock_Available_View AS
SELECT
sb.productId,
sb.inventoryId,
sb.quantity AS physicalQuantity,
COALESCE(SUM(sr.quantity), 0) AS reservedQuantity,
(
sb.quantity - COALESCE(SUM(sr.quantity), 0)
) AS availableQuantity
FROM
Stock_Balance sb
LEFT JOIN Stock_Reservations sr ON sr.productId = sb.productId
AND sr.inventoryId = sb.inventoryId
GROUP BY
sb.productId,
sb.inventoryId,
sb.quantity;
@@ -0,0 +1,21 @@
/*
Warnings:
- You are about to drop the column `expiresAt` on the `Stock_Reservations` table. All the data in the column will be lost.
- Added the required column `posAccountId` to the `Orders` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE `Orders` ADD COLUMN `posAccountId` INTEGER NOT NULL;
-- AlterTable
ALTER TABLE `Stock_Reservations` DROP COLUMN `expiresAt`;
-- CreateIndex
CREATE INDEX `Orders_posAccountId_idx` ON `Orders`(`posAccountId`);
-- AddForeignKey
ALTER TABLE `Orders` ADD CONSTRAINT `Orders_posAccountId_fkey` FOREIGN KEY (`posAccountId`) REFERENCES `Pos_Accounts`(`id`) ON DELETE RESTRICT ON UPDATE NO ACTION;
-- AddForeignKey
ALTER TABLE `Stock_Reservations` ADD CONSTRAINT `Stock_Reservations_orderId_fkey` FOREIGN KEY (`orderId`) REFERENCES `Orders`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;