Implementing Row-Level Inventory Overrides in PharmaStock

 I focused on improving how inventory data is edited in PharmaStock by implementing row-level override functionality.

Previously, updating medication details such as generic name or strength would affect all inventory records tied to that medication. To solve this, I introduced override fields directly on the InventoryStock entity. This allows each inventory row to store its own version of medication data without modifying the shared medication record.

On the backend, I created dedicated PATCH endpoints for each override field, including generic name, medication name, NDC, strength, and dosage form. These endpoints update only the targeted inventory record. I also updated the mapping layer to prioritize override values when present, falling back to the base medication data when they are not.

On the frontend, I refactored the Angular save logic to detect which fields were changed and dynamically call the appropriate PATCH endpoints. The save operations are executed sequentially to ensure data consistency, and the UI refreshes automatically after completion.

This implementation aligns the system with real-world inventory workflows, where the same medication can exist in multiple contexts with slight variations. It also improves data safety by preventing unintended global updates. 



Comments

Popular posts from this blog

PharmaStock: Backend Infrastructure & Database Connectivity

PharmaStock Backend Progress Complete all backend endpoints

PharmaStock: Sprint Planning Complete