Overview
POS Kasir provides comprehensive inventory management with support for product categories, product variants (options), stock tracking with history, and image uploads for both products and variants.Product Management
Create Product
Create a new product with optional variants. Endpoint:POST /products
Required Role: Admin, Manager
internal/products/handler.go:439-482
List Products
Endpoint:GET /products
Required Role: Admin, Manager, Cashier
internal/products/handler.go:390-437
page- Page number (default: 1)limit- Items per page (default: 10, max: 100)search- Search products by namecategory_id- Filter by category ID
Update Product
Endpoint:PATCH /products/{id}
Required Role: Admin, Manager
internal/products/handler.go:301-353
Upload Product Image
Endpoint:POST /products/{id}/image
Required Role: Admin, Manager
internal/products/handler.go:484-547
Product Variants (Options)
Create Product Option
Endpoint:POST /products/{product_id}/options
Required Role: Admin, Manager
internal/products/handler.go:215-264
Update Product Option
Endpoint:PATCH /products/{product_id}/options/{option_id}
Required Role: Admin, Manager
Upload Option Image
Endpoint:POST /products/{product_id}/options/{option_id}/image
Required Role: Admin, Manager
Stock Management
Stock History
The system automatically tracks all stock changes with detailed history. Endpoint:GET /products/{id}/stock-history
Required Role: Admin, Manager
internal/products/handler.go:708-760
Stock Change Types
sale- Stock decreased due to orderrestock- Stock increased from suppliercorrection- Manual stock adjustmentreturn- Stock returned from customerdamage- Stock marked as damaged
Category Management
Create Category
Endpoint:POST /categories
Required Role: Admin, Manager
internal/categories/handler.go:193-245
List Categories
Endpoint:GET /categories
Required Role: Admin, Manager, Cashier
Update Category
Endpoint:PUT /categories/{id}
Required Role: Admin, Manager
Delete Category
Endpoint:DELETE /categories/{id}
Required Role: Admin, Manager
internal/categories/handler.go:33-80
Trash Management
List Deleted Products
Endpoint:GET /products/trash
Required Role: Admin
Restore Product
Endpoint:POST /products/trash/{id}/restore
Required Role: Admin
Bulk Restore Products
Endpoint:POST /products/trash/restore-bulk
Required Role: Admin
Data Transfer Objects
internal/products/dto.go:15-32
Best Practices
- Stock Tracking - Always provide a change_type and note when updating stock
- Category Assignment - Validate category exists before assigning to product
- Image Optimization - Upload optimized images to reduce storage costs
- Variant Pricing - Use product options for size/add-on variations
- Soft Delete - Use trash endpoints for data recovery capabilities
- Pagination - Always use pagination for list endpoints to improve performance