API Docs
High-level reference for the NestJS backend. Describes endpoint behavior, database usage, and how the service queries flow.
Services use TypeORM DataSource/QueryRunner across multiple named MSSQL connections. Transactional writes happen inside QueryRunner, while reads often go through custom repositories with raw parametrized SQL. Controllers branch behavior by barcode type/company/OS before generating PRN/template output.
/auth/login
Local login. Returns access/refresh tokens. Uses LocalGuard.
/auth/refresh
Refresh access token using refresh token. Guard: jwt-refresh.
/auth/logout
Logs the user out and clears the auth cookie.
/auth/permissions
Returns current user permissions plus module constants: ALL_MODULE_NAMES, ALL_AVAILABLE_PERMISSIONS, and grouped view access for printModulesViewAccess, SKUorUPCModulesViewAccess, managementModulesViewAccess.
/autoprint/search-TD
Lookup TD/store details. Query: TDNumber.
/autoprint/recalibrate-price
Recalibrates TD prices using a new effective date. Body: TDNumber, dateEffective.
barcodeDataDB.barcodeDataDB using the provided effective date.RowsAffected; throws if none./autoprint/print
Regular print job. Requires OS as WINDOWS or LINUX. Linux returns binary PRN; Windows returns JSON template + base64.
barcodeDataDB.c_print_flag=Y records for this TD to inactive.CARAVAN, TELSTAR, MIRAGE.R; commits./autoprint/print-sale
Sale sticker print job. Same OS branching as /print with priceType S.
/autoprint/print-sm-both
Prints both regular and sale SM stickers. Uses priceType B for barcode DB inserts. Linux returns base64 buffers in JSON.
B./manualprint/store-details
Get store info by entity code from custom repository queries. Query: entityCode.
/manualprint/stock-number-SKU-details
Resolves stock/SKU details. Supports free-item fallback and requires active price context via dateEffective, entityCode, priceType, s_barcode_type, s_company_code.
Item.repository finds the stock number as Give Aways/free item, returns FREE ITEM with price=0.ERPDB./manualprint/print
Generates regular sticker print. Body includes barcode data, selected items, driver, OS flag, and remarks.
barcodeDataDB.R./manualprint/print-sale
Sale sticker version of manual print. Price type is fixed to S.
/manualprint/print, but inserts with priceType S and generates sale-specific template/data on Windows./manualprint/print-sm-both
Prints regular + sale SM stickers together. Uses priceType B for shared DB insert then generates both outputs.
B in one transaction./sku-masterlist-tools/download-sku-masterlist
Download SKU masterlist. Body payload determines retailer/filters. Returns filename + buffer.
/sku-masterlist-tools/download-no-sku-masterlist
Download no-SKU masterlist. Body payload targets missing-SKU items. Returns filename + buffer.
/sku-masterlist-tools/sku-guide
Returns SKU lookup guide data for a retailer. Query: retailer.
/sku-request-automation/stock-number-details
Fetch stock number details. Query: stockNumber, retailer.
/sku-request-automation/download-excel-sku-request
Generate SKU request Excel from payload rows. Returns filename + buffer.
/user-management/get-users
Paginated user list. Query: username, page, limit. Returns users + pagination metadata. Requires USER_MANAGEMENT_VIEW.
/user-management/get-user-permissions/:username
Get calculated permissions for a user. Query: moduleName. Requires USER_MANAGEMENT_VIEW.
/user-management/toggle-permission
Toggle a user permission. Body: username, accessCode, isAllow. Requires USER_MANAGEMENT_VIEW + USER_MANAGEMENT_TOGGLE.
Local backend module:
/var/www/html/mcjim-nestjs-backend