From 7f7720f201240a6299347f8faf4f3aa23c0cc8a7 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 24 Feb 2026 04:03:19 +0000 Subject: [PATCH] Refactor stock warning magic number to constant Co-authored-by: alfieprojectsdev <11991855+alfieprojectsdev@users.noreply.github.com> --- client/src/App.tsx | 5 +++-- client/src/constants.ts | 1 + client/src/db/schema.ts | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 client/src/constants.ts diff --git a/client/src/App.tsx b/client/src/App.tsx index 2006546..8606376 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -2,6 +2,7 @@ import { useState } from 'react'; import './App.css'; import { useInventory } from './hooks/useInventory'; import { TransactionForm } from './components/TransactionForm'; +import { LOW_STOCK_THRESHOLD } from './constants'; function App() { const [selectedSku, setSelectedSku] = useState('MED-AMOX-500'); @@ -29,12 +30,12 @@ function App() {

{currentStock}

Current Stock

diff --git a/client/src/constants.ts b/client/src/constants.ts new file mode 100644 index 0000000..145f4f4 --- /dev/null +++ b/client/src/constants.ts @@ -0,0 +1 @@ +export const LOW_STOCK_THRESHOLD = 100; diff --git a/client/src/db/schema.ts b/client/src/db/schema.ts index bc4bb84..528d454 100644 --- a/client/src/db/schema.ts +++ b/client/src/db/schema.ts @@ -48,7 +48,7 @@ export const TRANSACTION_SCHEMA_LITERAL = { required: ['id', 'type', 'sku', 'qty', 'timestamp', 'sync_status'] } as const; -const schemaTypedTransaction = toTypedRxJsonSchema(TRANSACTION_SCHEMA_LITERAL); +export const schemaTypedTransaction = toTypedRxJsonSchema(TRANSACTION_SCHEMA_LITERAL); export type TransactionDocType = ExtractDocumentTypeFromTypedRxJsonSchema; export const TransactionSchema: RxJsonSchema = TRANSACTION_SCHEMA_LITERAL; @@ -79,7 +79,7 @@ export const INVENTORY_SCHEMA_LITERAL = { required: ['sku', 'batch_id', 'current_stock'] } as const; -const schemaTypedInventory = toTypedRxJsonSchema(INVENTORY_SCHEMA_LITERAL); +export const schemaTypedInventory = toTypedRxJsonSchema(INVENTORY_SCHEMA_LITERAL); export type InventoryDocType = ExtractDocumentTypeFromTypedRxJsonSchema; export const InventorySchema: RxJsonSchema = INVENTORY_SCHEMA_LITERAL; @@ -110,7 +110,7 @@ export const PATIENT_SCHEMA_LITERAL = { required: ['id', 'name', 'municipality'] } as const; -const schemaTypedPatient = toTypedRxJsonSchema(PATIENT_SCHEMA_LITERAL); +export const schemaTypedPatient = toTypedRxJsonSchema(PATIENT_SCHEMA_LITERAL); export type PatientDocType = ExtractDocumentTypeFromTypedRxJsonSchema; export const PatientSchema: RxJsonSchema = PATIENT_SCHEMA_LITERAL;