Skip to main content

Overview

PC Fix features a comprehensive inventory management system that tracks product stock in real-time, alerts users when items are back in stock, notifies customers of price drops, and helps identify slow-moving inventory that needs attention.

Stock Tracking

Product Schema

Products are stored with detailed inventory information:
packages/api/prisma/schema.prisma

Real-Time Stock Updates

Stock is automatically decremented when orders are created and restored when orders are cancelled:
packages/api/src/modules/sales/sales.service.ts
Products with stock >= 90000 are treated as “infinite stock” items (typically services) and aren’t decremented.

Stock Validation

Pre-Order Validation

Before creating an order, the system validates sufficient stock is available:
packages/api/src/modules/sales/sales.service.ts

Cart Quantity Limits

The shopping cart prevents adding more items than available in stock:
packages/web/src/stores/cartStore.ts

Low Stock Alerts

Dashboard Monitoring

The admin dashboard displays a real-time count of low stock products:
packages/api/src/modules/stats/stats.service.ts

Low Stock Filter

Administrators can filter products by low stock status:
packages/api/src/modules/products/products.service.ts

Dashboard KPI

Real-time count of products with stock ≤ 5

Click-Through

Dashboard card links directly to filtered product list

Stock Availability Notifications

Customer Stock Alerts

Customers can subscribe to be notified when out-of-stock products become available:
packages/api/prisma/schema.prisma

Automatic Alert Processing

When stock is updated from 0 to a positive number, all subscribers are notified:
packages/api/src/modules/products/products.service.ts
Stock alerts are automatically deleted after being sent, so customers only receive one notification per subscription.

Price Drop Notifications

Favorite Product Tracking

Customers who have favorited products are notified when prices drop:
packages/api/src/modules/products/products.service.ts

Automatic Price Monitoring

Price drops are detected automatically during product updates:
packages/api/src/modules/products/products.service.ts

Inactive Product Detection

Dead Stock Analysis

The system automatically identifies products that haven’t sold in 90+ days:
packages/api/src/modules/stats/stats.service.ts

Flash Sale Recommendations

The admin dashboard displays inactive products with a “Flash Sale” action button:
packages/web/src/components/admin/dashboard/DashboardIntelligence.tsx
Products are considered “dead stock” if they haven’t sold in 90+ days. The dashboard shows the top 10 worst offenders.

Soft Delete System

Preserving Data Integrity

Products are never permanently deleted to preserve order history:
packages/api/src/modules/products/products.service.ts
All product queries automatically exclude deleted products:

Product Filtering

Advanced Search & Filter

packages/api/src/modules/products/products.service.ts

Best Sellers Tracking

Sales Analytics

The system tracks which products sell the most:
packages/api/src/modules/products/products.service.ts

Inventory Metrics

Total Products

Count of all active products (deletedAt: null)

Low Stock Items

Products with stock ≤ 5 units

Dead Stock

Products without sales in 90+ days

Featured Items

Products marked as featured for homepage

Discounted

Products with precioOriginal set

Best Sellers

Top selling products by quantity

API Endpoints

Use the dead stock report to identify products that need price reductions or promotional campaigns to move inventory.