Commit Graph

50 Commits

Author SHA1 Message Date
ahasani 816c5ebb50 update switch providers and nama provider. fix original send 2026-05-27 21:55:02 +03:30
ahasani ea6f1bfdd0 feat: add settlement_type to SalesInvoice model and related DTOs
- Added settlement_type field to SalesInvoice model with ENUM values (CASH, CREDIT, MIXED).
- Updated SalesInvoice aggregate types, input types, and where filters to include settlement_type.
- Modified StatisticsService to calculate credit amounts based on settlement_type.
- Enhanced TspProviderOriginalSendPayloadDto to include settlement_type.
- Updated NamaProvider DTOs and utility functions to handle new settlement_type logic.
- Created migration to add settlement_type column to sales_invoices table and backfill existing records.
2026-05-24 19:40:04 +03:30
ahasani fc27b9d616 feat(pos): add favorite functionality for goods
- Implemented PosGoodFavoriteController to handle attaching and detaching favorites for goods.
- Created PosGoodFavoriteService to manage the business logic for favorites, including database operations and cache invalidation.
- Added PosGoodFavoriteModule to encapsulate the controller and service.
2026-05-20 11:42:59 +03:30
ahasani afa83895a2 Refactor code structure for improved readability and maintainability 2026-05-10 09:44:49 +03:30
ahasani 4e61ff618e refactor: remove SalesInvoiceItemsService and update sales invoice handling
- Deleted SalesInvoiceItemsService as it was not implemented.
- Changed variable declaration from `const` to `let` in SalesInvoicesService for sales invoice creation.
- Updated response handling after sending to TSP provider in SalesInvoicesService.
- Renamed payload properties in TspProvider DTOs for clarity.
- Enhanced error handling in SalesInvoiceTspSwitchService for unsupported providers.
- Refactored SalesInvoiceTspService to utilize utility functions for payload building and sending.
- Updated PrismaService to increase connection limit and utilize dynamic options.
- Added new migration scripts to update database schema for sale_invoice_tsp_attempts.
- Introduced utility functions for building payloads and handling responses in sales invoice processing.
2026-05-08 18:09:13 +03:30
ahasani fbe7230865 feat: add stock keeping units management
- Created migration to drop `type` column from `stock_keeping_units` table.
- Added `Guild` model to Prisma schema.
- Implemented `BusinessActivitiesQueryService` for querying business activities.
- Developed `GoodsSharedService` for handling goods creation and updates.
- Introduced DTOs for creating and updating stock keeping units.
- Created controller and service for managing stock keeping units.
- Implemented response DTOs for stock keeping units service.
- Established module for stock keeping units management.
2026-05-07 20:30:24 +03:30
ahasani 658496320b feat: implement correction and original send functionality for Nama provider
- Added new DTOs for correction requests and responses in `nama-provider.dto.ts`.
- Updated `nama-provider.adapter.ts` to include `originalSend` and `correctionSend` methods.
- Enhanced `nama-provider.util.ts` with mapping functions for correction requests.
- Created operational guidelines for agents in `AGENT.md`.
- Updated Prisma migrations to support new invoice types and relationships.
- Introduced new service and DTO for creating sales invoices in `sale-invoice-create.service.ts` and `sale-invoice-create.dto.ts`.
- Added utility for handling Prisma errors in `prisma-error.util.ts`.
2026-05-05 22:42:09 +03:30
ahasani a486127ade feat: implement SalesInvoiceTspSwitchService and SalesInvoiceTspService for handling TSP provider interactions
- Add SalesInvoiceTspSwitchService to manage TSP provider selection and sending invoices.
- Introduce SalesInvoiceTspService for creating, sending, and retrieving sales invoices.
- Implement NamaProviderSwitchAdapter for communication with the NAMA TSP provider API.
- Define DTOs for request and response structures specific to the NAMA provider.
- Enhance error handling and logging for TSP provider interactions.
2026-05-03 16:23:17 +03:30
ahasani ad470d2166 feat: add stock keeping unit management with create, update, and retrieval functionalities
- Implemented CreateStockKeepingUnitDto for creating stock keeping units.
- Added StockKeepingUnitsService for handling business logic related to stock keeping units.
- Created StockKeepingUnitsController to manage HTTP requests for stock keeping units.
- Developed UpdateStockKeepingUnitDto for updating existing stock keeping units.
- Introduced StockKeepingUnitsServiceFindAllResponseDto for response structure.
- Established stock keeping units module for encapsulation of related components.

feat: enhance sales invoice fiscal management with new endpoints

- Created SalesInvoicesFilterDto for filtering sales invoices.
- Implemented PosSalesInvoiceFiscalController for managing fiscal operations on sales invoices.
- Developed PosSalesInvoiceFiscalService to handle fiscal logic and interactions.
- Added methods for sending, retrying, and checking the status of fiscal invoices.
- Integrated error handling and response mapping for fiscal operations.
2026-05-01 19:43:59 +03:30
ahasani a68a7f594d feat: implement tax switch functionality with Nama adapter
- Add DTOs for tax switch operations including payloads and results.
- Create SalesInvoiceFiscalSwitchService to handle sending and retrieving tax data.
- Implement SalesInvoiceFiscalService for managing invoice tax submissions and results persistence.
- Develop NamaTaxSwitchAdapter for interfacing with the external tax service.
- Introduce NamaTaxRequestDto and related classes for structured tax requests.
2026-04-30 16:27:46 +03:30
ahasani 58a7c359d8 feat: add DTOs and services for tax switch integration
- Created SendBulkSaleInvoicesDto for handling bulk sale invoice requests.
- Implemented TaxSwitchSendPayloadDto and related DTOs for tax switch item payloads and results.
- Developed SalesInvoiceTaxSwitchService to manage tax switch operations, including sending and retrieving tax information.
- Added SalesInvoiceTaxService for handling sales invoice tax logic, including bulk sending and persistence of results.
- Introduced NamaTaxSwitchAdapter to interact with the tax switch service, simulating external API responses.
- Created SendBulkSalesInvoicesDto for POS module to handle bulk sales invoice requests.
2026-04-27 22:11:05 +03:30
ahasani dee96b6e91 feat: add response DTOs for various services across modules
- Created response DTOs for ConfigService, AppService, AuthService, CatalogsService, AccountsService, BusinessActivityComplexesService, ComplexPosesService, SalesInvoicesService, BusinessActivitiesService, ConsumerBusinessActivityGoodsService, and others.
- Implemented Create, FindAll, FindOne, and Update response types for services in consumer, partners, and POS modules.
- Added request DTOs for creating and updating goods in the consumer business activities module.
- Introduced filtering DTO for partner licenses.
- Enhanced response mapping for partner license activations.
2026-04-27 10:45:39 +03:30
ahasani b72e6c7194 feat: refactor ComplexPosesService to remove unused defaultInsert method and improve findAll logic
fix: update PartnersService to use 'isNot' instead of 'not' for allocation checks

refactor: enhance BusinessActivityComplexesService to validate license activation before creating a complex

fix: adjust ComplexPosesService to ensure account allocation checks are accurate and handle errors properly

refactor: modify ConsumerMiddleware to set consumerData instead of partnerData for better clarity

feat: expand SaleInvoicesService to include additional fields in the invoice selection

chore: update business-activities module to include accounts-charge module for better organization

fix: ensure ComplexPosesService correctly handles account allocation during POS creation

feat: implement PartnerBusinessActivityAccountsCharge module with create functionality for account charges

refactor: streamline getPartnerBusinessActivityAllocationLimits utility for better clarity and functionality

chore: add migration script to update database schema with necessary constraints and foreign keys

feat: create DTO for accounts charge to validate incoming data
2026-04-25 15:16:59 +03:30
ahasani 12506de863 feat(partners): add utility functions for partner business activity allocation limits and remaining licenses
- Implemented `getPartnerBusinessActivityAllocationLimits` to retrieve allocation limits for a partner's business activity.
- Added `ensurePartnerBusinessActivityHasRemainingAllocation` to validate remaining allocation credits.
- Created `getPartnerRemainingLicenses` to count remaining licenses for a partner.
- Developed `getPartnerFirstRemainingLicense` to fetch the first unused license for a partner.
- Introduced `ensurePartnerHasRemainingLicense` to ensure a partner has at least one unused license.
2026-04-24 23:02:05 +03:30
ahasani 9b652a3603 feat: Refactor accounts service and related DTOs to enhance consumer account management
- Updated AccountsService to filter out OWNER roles in findAll method.
- Removed CreateConsumerAccountDto and its role property from account creation logic.
- Enhanced BusinessActivitiesService to include complex counts in responses.
- Modified ComplexesController and ComplexesService to handle consumer-specific logic.
- Introduced CreateConsumerComplexDto and UpdateConsumerComplexDto for complex management.
- Updated PosesController and PosesService to manage POS creation and updates with consumer context.
- Added utility function to calculate remaining accounts for business activities.
- Updated Prisma migration to add account_id to poses and enforce unique constraints.
2026-04-24 04:27:28 +03:30
ahasani 11488093a7 Refactor Partner and POS models to replace 'serial' with 'serial_number' and update related services and DTOs
- Updated PartnerAccountQuotaAllocation model to change license relation.
- Refactored Pos model to replace 'serial' with 'serial_number' across all references.
- Modified BusinessActivitiesService to include license activation details in responses.
- Adjusted ComplexPosesService to reflect changes in the Pos model.
- Updated PartnerService to include a new method for updating partner profiles.
- Created UpdatePartnerProfileDto for partner profile updates.
- Added migration to drop 'serial' column and add unique 'serial_number' column in poses table.
2026-04-24 02:20:15 +03:30
ahasani a350ec7990 feat: add consumer accounts and business activities management
- Implemented AccountsService for managing consumer accounts including create, update, delete, and find operations.
- Created DTOs for account creation and updates.
- Developed BusinessActivitiesController and BusinessActivitiesService for handling business activities related to consumers.
- Added complexes management with ComplexesController and ComplexesService.
- Introduced POS management with ComplexPosesController and ComplexPosesService.
- Created necessary DTOs for business activities and POS.
- Established Licenses management with LicensesController and LicensesService.
- Integrated consumer management with PartnerConsumersController and PartnerConsumersService.
- Added Prisma module imports and service connections across modules.
2026-04-23 20:59:39 +03:30
ahasani f9e1ad69dc update 2026-04-22 21:55:40 +03:30
ahasani ca494ee82a update license structures and setup file storage services 2026-04-16 22:19:20 +03:30
ahasani 9cef733370 update models and create consumer domain accounts permissions 2026-04-11 14:47:05 +03:30
ahasani 89726c8904 set consumer customers and saleInvoices 2026-04-08 18:15:44 +03:30
ahasani b8c5cb4c80 debug license 2026-04-06 21:12:07 +03:30
ahasani 1160d81cdb create license management 2026-04-06 13:31:40 +03:30
ahasani c870a43e35 update pos consumer module 2026-03-29 18:06:41 +03:30
ahasani 0ad6a3200e refactor user accounts structure 2026-03-16 00:33:40 +03:30
ahasani d2215b9f04 update admin user business 2026-03-14 16:26:44 +03:30
ahasani 007db7f9bd updating 2026-03-11 20:42:34 +03:30
ahasani 8c5f1d4d49 transform core api codes into this project, update modules as admin/pos context modules 2026-03-07 11:25:11 +03:30
ahasani b949500482 feat(customers): add DTOs for individual and legal customer creation
- Created CreateCustomerIndividualDto for individual customer data with fields: first_name, last_name, national_code, postal_code, is_favorite, and economic_code.
- Created CreateCustomerLegalDto for legal customer data with fields: company_name, economic_code, registration_number, and postal_code.
2026-02-24 12:42:10 +03:30
ahasani 55b96d4f79 feat: update validation and exception handling, refactor controller routes, and enhance sales invoice item DTO
- Removed global validation pipe and added a new ValidationExceptionFilter for better error handling.
- Refactored controller routes to use underscores instead of hyphens for consistency.
- Updated CreateSalesInvoiceItemDto to include new fields: quantity, unit_type, and payload.
- Modified CreateSalesInvoiceDto to enforce items as an array with a minimum size.
- Added Enums module to provide gold karat values through a dedicated endpoint.
- Introduced new columns in the database schema for sales invoice items and goods.
2026-02-16 20:51:34 +03:30
ahasani a073af76fe feat: add config module with controller and service
- Implemented ConfigController for handling config-related requests.
- Created ConfigService for business logic related to configurations.
- Added CreateConfigDto for validating configuration data.

feat: add good categories module with controller and service

- Implemented GoodCategoriesController for managing good categories.
- Created GoodCategoriesService for business logic related to good categories.
- Added CreateGoodCategoryDto for validating good category data.

feat: add goods module with controller and service

- Implemented GoodsController for managing goods.
- Created GoodsService for business logic related to goods.
- Added CreateGoodDto for validating good data.

feat: add profile module with controller and service

- Implemented ProfileController for managing user profiles.
- Created ProfileService for business logic related to profiles.
- Added CreateProfileDto for profile data structure.

feat: add sales invoice payments module with controller and service

- Implemented SalesInvoicePaymentsController for managing invoice payments.
- Created SalesInvoicePaymentsService for business logic related to payments.
- Added CreateSalesInvoicePaymentDto for validating payment data.

feat: add service categories module with controller and service

- Implemented ServiceCategoriesController for managing service categories.
- Created ServiceCategoriesService for business logic related to service categories.
- Added CreateServiceCategoryDto for validating service category data.

feat: add services module with controller and service

- Implemented ServicesController for managing services.
- Created ServicesService for business logic related to services.
- Added CreateServiceDto for validating service data.

feat: add trigger logs module with controller and service

- Implemented TriggerLogsController for managing trigger logs.
- Created TriggerLogsService for business logic related to trigger logs.
- Added CreateTriggerLogDto for validating trigger log data.

feat: add uploaders module for handling file uploads

- Implemented UploadersController for managing file uploads.
- Created ImageUploaderService for image upload logic.
- Created UploaderService for file handling and storage.
2026-02-12 20:31:04 +03:30
ahasani de14d531e1 init 2026-02-04 13:49:07 +03:30
ahasani 5fd6611aca 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.
2026-01-07 15:25:59 +03:30
ahasani b05048e62f feat(bank-accounts): add transaction retrieval and update service logic
- Implemented a new endpoint to fetch transactions for a specific bank account.
- Refactored the bank account service to streamline transaction handling and balance calculations.
- Removed the bank account balance table and adjusted related logic in workflows and services.
- Enhanced transaction mapping to include references to sales and purchase records.
2026-01-05 18:35:08 +03:30
ahasani a2db2daa70 feat(statistics): implement top alert stocks, top last sales, top supplier debts, and top selling products endpoints with SQL queries 2026-01-04 13:45:26 +03:30
ahasani eb6e0e7a0d feat(inventories): add cardex retrieval for inventory and product
feat(pos): update sale invoice creation to include customer and item details
feat(pos): enhance POS account service to include today's sales information
feat(pos): refactor order DTO to create sale invoice with detailed item structure
feat(products): add minimum stock alert level to product creation and update DTOs
fix(triggers): implement stock validation and movement logging for sales invoice items
refactor(database): update sales invoices schema to include posAccountId and remove inventoryId
2025-12-30 21:04:01 +03:30
ahasani af9695e23c refactor: restructure suppliers module and update DTOs
- Removed old supplier DTOs and controller, replacing them with new implementations.
- Introduced new CreateSupplierDto and UpdateSupplierDto in the index directory.
- Updated SuppliersController to handle new routes and methods.
- Implemented SuppliersService with updated logic for creating, finding, updating, and removing suppliers.
- Added new invoices module with corresponding controller and service for handling invoice-related operations.
- Created new DTOs for handling receipt payments and updated the service to manage payment creation and retrieval.
- Updated Prisma migrations to reflect changes in the database schema, including dropping unnecessary columns.
2025-12-27 20:34:00 +03:30
ahasani d98507fc1f fix: update SupplierLedger model to use correct enum casing and adjust types
feat: enhance PosAccountsService to include inventoryBankAccount details in responses

refactor: modify PosService to return structured inventory and bank account data

chore: remove isSettled field from CreatePurchaseReceiptDto and adjust related logic

feat: add payments selection in SuppliersService for better payment tracking

chore: apply database migrations to adjust decimal types and enforce constraints

chore: create index on Pos_Accounts for improved query performance

feat: define Supplier and SupplierLedger models in Prisma schema for better data management
2025-12-26 22:09:46 +03:30
ahasani b4f226fb3a refactor(inventories): restructure inventory and pos account modules, remove deprecated DTOs and controllers
- Removed create and update DTOs for inventory.
- Deleted inventories controller and service.
- Introduced new inventory bank accounts module with controller and service.
- Added new pos accounts module with controller and service.
- Updated Prisma models to reflect changes in bank account relationships.
- Adjusted PosAccount and SalesInvoice models for stricter type definitions.
- Implemented new response mapping for inventory and pos account services.
2025-12-26 01:20:03 +03:30
ahasani cbe51b9343 feat: implement bank accounts, branches, and banks modules with CRUD operations
- Added BankAccountsController, BankAccountsService, and related DTOs for managing bank accounts.
- Implemented BankBranchesController, BankBranchesService, and related DTOs for managing bank branches.
- Created BanksController and BanksService for retrieving bank information.
- Integrated Prisma for database operations across all modules.
- Added response mapping for consistent API responses.
2025-12-24 21:24:59 +03:30
ahasani 89c57a69c1 feat(cardex): enhance stock movement retrieval with additional fields and optimized mapping
refactor(migration): update Stock_Movements table to include counterInventoryId and customerId, add foreign key constraints, and implement triggers for inventory management
2025-12-23 20:35:44 +03:30
ahasani c6a86719dd feat(cardex): implement cardex controller, service, and DTO for stock movements
feat(pos): add POS controller and service for order creation and stock retrieval
refactor(pos): enhance stock and product category retrieval with pagination and mapping
2025-12-21 19:09:41 +03:30
ahasani d514267f58 feat: add inventoryId to SalesInvoice and related models; implement createOrder functionality in POS service 2025-12-16 10:03:49 +03:30
ahasani 687c89c3e1 feat: add salePrice field to Product model and update related files
- Added salePrice field to Product model in Prisma schema and generated files.
- Updated Product scalar field enums in both TypeScript files.
- Modified aggregate output types to include salePrice.
- Enhanced input types for creating and updating products to support salePrice.
- Updated migration file to add salePrice column to Products table.
- Created DTOs for inventory management in POS module.
- Implemented POS controller and service with methods for stock and product categories.
2025-12-14 20:34:07 +03:30
ahasani 9d7d94b5f8 Add SQL query for average cost retrieval and generate TriggerLog model 2025-12-14 10:15:57 +03:30
ahasani 41d7dd8802 feat(database): initialize database schema and triggers
- Created initial database schema with tables for Users, Roles, Products, and related entities.
- Added foreign key constraints to maintain data integrity across tables.
- Implemented triggers for managing stock movements on insert, update, and delete operations.
- Developed scripts to dump existing triggers and pull trigger definitions from the database.
2025-12-10 16:54:08 +03:30
ahasani 807f6c2087 feat: implement purchase receipt items management with create, update, find, and delete functionalities
feat: add purchase receipts management with create, update, find, and delete functionalities

feat: implement sales invoice items management with create, update, find, and delete functionalities

feat: add sales invoices management with create, update, find, and delete functionalities

feat: implement stock adjustments management with create, update, find, and delete functionalities

feat: add stock balance retrieval functionality

feat: implement stock movements management with create, update, find, and delete functionalities
2025-12-09 13:59:07 +03:30
ahasani a782d61890 feat: add product variant management functionality
- Implemented CreateProductVariantDto and UpdateProductVariantDto for product variant data transfer.
- Developed ProductVariantsController to handle CRUD operations for product variants.
- Created ProductVariantsService to interact with the database using Prisma.
- Added ProductVariantsModule to encapsulate the product variant feature.
- Included response mapping for consistent API responses.
2025-12-06 17:48:10 +03:30
ahasani 7cb9d7d037 feat: implement supplier management module with create, update, find, and delete functionalities
- Added CreateSupplierDto for supplier creation
- Added UpdateSupplierDto for supplier updates
- Implemented SuppliersController to handle HTTP requests for suppliers
- Created SuppliersService to manage supplier data using Prisma
- Integrated SuppliersModule to encapsulate suppliers-related components
2025-12-05 00:01:44 +03:30
ahasani 621e15dd02 feat: implement inventory, product brand, product category, product info, product, role, store, user, and vendor modules with CRUD operations
- Added Create and Update DTOs for Inventory, Product Brand, Product Category, Product Info, Product, Role, Store, User, and Vendor.
- Implemented InventoriesController, ProductBrandsController, ProductCategoriesController, ProductInfoController, ProductsController, RolesController, StoresController, UsersController, and VendorsController with respective CRUD endpoints.
- Developed InventoriesService, ProductBrandsService, ProductCategoriesService, ProductInfoService, ProductsService, RolesService, StoresService, UsersService, and VendorsService to handle business logic.
- Created PrismaModule and PrismaService for database interactions using Prisma with MariaDB adapter.
- Configured application with Swagger for API documentation and added global interceptors for logging and response mapping.
- Established e2e testing setup with Jest for the application.
2025-12-04 21:05:57 +03:30