Skip to content

bug: tables GET route ignores active query parameter #33

Description

@khaira777

Description

The frontend calls /tables?active=1 (frontend/src/app/(dashboard)/pos/page.tsx:94,106) but the backend GET route ignores the active query parameter entirely. Soft-deleted tables will appear in the POS.

Code Location

Frontend (pos/page.tsx:94):

const { data } = await api.get('/tables?active=1');

Backend (main/routes/tables.ts:8-39):

router.get('/', (req: Request, res: Response) => {
  let query = 'SELECT * FROM tables WHERE 1=1';
  const params: any[] = [];

  if (req.query.status) { ... }
  if (req.query.floor) { ... }
  if (req.query.section) { ... }
  if (req.query.kitchen_station_id) { ... }
  // ❌ No handling for req.query.active
});

Impact

Currently low — the is_active column exists in the schema but isn't actively used for soft-delete. However:

  • If soft-delete is ever implemented (set is_active = 0 instead of DELETE), deleted tables will still appear in the POS
  • The frontend is already sending active=1, suggesting this was intended behavior
  • Other routes (/categories?active=1, /products?active=1) likely have the same issue

Suggested Fix

if (req.query.active) {
  query += ' AND is_active = ?';
  params.push(req.query.active);
}

Also verify /categories and /products GET routes handle the active parameter consistently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:backendBackend (Express/SQLite)bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions