Add Stock catalog (items/warehouses) and fix session persistence
Stock is scoped to a catalog + cost centers only, per direction that physical GRV/stock-take/recipe transactions belong in an external system (Matrix), not this accounting app. Stock Control/GRN/Variance/ PPV GL accounts are now plain postable accounts rather than locked control accounts. Also fixes session loss on page refresh: auth stores now persist to localStorage, and ProtectedRoute waits for rehydration before deciding to redirect to login. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JWqiUSojMLUoN7mrJqdEbN
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
4acbc03b35
commit
b137176c40
@@ -0,0 +1,34 @@
|
||||
import { Router } from 'express';
|
||||
import { requireAuth } from '../../middleware/auth';
|
||||
import { requirePermission } from '../../middleware/rbac';
|
||||
import { validate } from '../../middleware/validate';
|
||||
import { asyncHandler } from '../../lib/asyncHandler';
|
||||
import {
|
||||
createStockItemHandler,
|
||||
createStockItemSchema,
|
||||
getStockItemHandler,
|
||||
listStockItemsHandler,
|
||||
listStockLevelsHandler,
|
||||
updateStockItemHandler,
|
||||
updateStockItemSchema,
|
||||
} from './stockItems.controller';
|
||||
|
||||
export const stockItemsRouter = Router();
|
||||
|
||||
stockItemsRouter.use(requireAuth);
|
||||
|
||||
stockItemsRouter.get('/', asyncHandler(listStockItemsHandler));
|
||||
stockItemsRouter.get('/levels', asyncHandler(listStockLevelsHandler));
|
||||
stockItemsRouter.get('/:id', asyncHandler(getStockItemHandler));
|
||||
stockItemsRouter.post(
|
||||
'/',
|
||||
requirePermission('stock.item.manage'),
|
||||
validate(createStockItemSchema),
|
||||
asyncHandler(createStockItemHandler),
|
||||
);
|
||||
stockItemsRouter.put(
|
||||
'/:id',
|
||||
requirePermission('stock.item.manage'),
|
||||
validate(updateStockItemSchema),
|
||||
asyncHandler(updateStockItemHandler),
|
||||
);
|
||||
Reference in New Issue
Block a user