Skip to content

feat(tables): implement real table management APIs#225

Open
Divv1524 wants to merge 5 commits into
rdodiya:gssoc_developfrom
Divv1524:fix/issue-219-table-management-apis
Open

feat(tables): implement real table management APIs#225
Divv1524 wants to merge 5 commits into
rdodiya:gssoc_developfrom
Divv1524:fix/issue-219-table-management-apis

Conversation

@Divv1524
Copy link
Copy Markdown
Contributor

Issue Link

Closes #219

Changes Made

  • Added backend table DTOs, service, and controller for branch-specific table management.
  • Added APIs to fetch, create, update, soft delete, and restore tables.
  • Added duplicate table number validation within the same branch.
  • Extended table persistence with capacity, status, and timestamps.
  • Connected Admin Tables UI to real backend APIs.
  • Updated add/edit/delete/restore table workflows.
  • Updated QR preview URLs to use persisted table IDs and numbers.
  • Added backend service tests for success paths and edge cases.

Type of Change

  • New feature
  • Bug fix
  • Documentation update
  • Code refactor

Testing Performed

Backend Testing

  • Added service tests for table create/update/delete/restore workflows.
  • Added edge-case tests for duplicate table numbers, missing branch/table, default values, and restore conflicts.
  • Unit tests passed locally

Note: Backend tests could not be executed locally because JAVA_HOME is invalid and no Java executable is available on PATH.

Frontend Testing

  • Production build passed with npm.cmd run build.
  • Admin Tables UI now fetches and mutates real backend data.
  • QR preview uses persisted table ID and table number.

Note: npm.cmd run lint could not run because ESLint v9 requires eslint.config.js, which is not present on this branch.

Additional Notes

  • git diff --check passed.
  • Vite build completed successfully with existing bundle-size warnings.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements backend table-management endpoints (branch-scoped listing + create/update/soft-delete/restore with duplicate-number checks) and wires the Admin Tables UI to use these APIs instead of fallback/mock data, including support for capacity/status and QR preview URLs based on persisted table IDs/numbers.

Changes:

  • Added Table DTOs, service layer, controller endpoints, and service-level unit tests for table workflows.
  • Extended Tables persistence with capacity, status, and createdDate/updatedDate timestamps; updated branch mapping to include these fields and count only active tables.
  • Updated Admin Tables UI to fetch/mutate real backend tables, including edit + soft delete/restore flows and updated QR preview URL parameters.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
RestroHub/src/test/java/com/restroly/qrmenu/table/service/TableServiceImplTest.java Adds unit tests covering create/update/delete/restore and duplicate/404 cases.
RestroHub/src/main/java/com/restroly/qrmenu/table/service/TableServiceImpl.java Implements table CRUD/restore logic with branch-scoped duplicate validation and DTO mapping.
RestroHub/src/main/java/com/restroly/qrmenu/table/service/TableService.java Introduces the table service interface used by the controller.
RestroHub/src/main/java/com/restroly/qrmenu/table/repository/TablesRepository.java Extends repository with branch-scoped lookups and duplicate checks.
RestroHub/src/main/java/com/restroly/qrmenu/table/entity/Tables.java Adds capacity/status + created/updated timestamps and lifecycle hooks.
RestroHub/src/main/java/com/restroly/qrmenu/table/dto/TableResponseDTO.java Defines the table API response payload including timestamps.
RestroHub/src/main/java/com/restroly/qrmenu/table/dto/TableRequestDTO.java Defines the table create/update request payload with validation.
RestroHub/src/main/java/com/restroly/qrmenu/table/controller/TableController.java Adds secured endpoints for branch tables and table update/delete/restore.
RestroHub/src/main/java/com/restroly/qrmenu/branch/mapper/BranchMapper.java Includes capacity/status in branch table DTOs and counts only active tables.
RestroHub/src/main/java/com/restroly/qrmenu/branch/dto/BranchResponseDTO.java Extends nested table DTO with capacity/status fields.
RestroHub-FrontEnd/src/components/admin/store/tables/TablesStatusLegend.jsx Updates legend counts to exclude inactive tables.
RestroHub-FrontEnd/src/components/admin/store/tables/TablesGrid.jsx Replaces fallback tables with backend fetch + supports refresh/edit and state updates on delete/restore.
RestroHub-FrontEnd/src/components/admin/store/tables/Tables.jsx Adds edit modal support and refresh key to re-fetch after mutations.
RestroHub-FrontEnd/src/components/admin/store/tables/TableQRModal.jsx Updates QR URL to include persisted tableId and table number params.
RestroHub-FrontEnd/src/components/admin/store/tables/TableFormModal.jsx Connects add/edit modal to real POST/PUT endpoints with error handling.
RestroHub-FrontEnd/src/components/admin/store/tables/TableCard.jsx Connects delete/restore actions to backend APIs and adds inactive-table UI state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread RestroHub/src/main/java/com/restroly/qrmenu/table/service/TableServiceImpl.java Outdated
Comment thread RestroHub/src/main/java/com/restroly/qrmenu/table/service/TableServiceImpl.java Outdated
Comment thread RestroHub/src/main/java/com/restroly/qrmenu/table/dto/TableRequestDTO.java Outdated
Comment thread RestroHub-FrontEnd/src/components/admin/store/tables/TableCard.jsx Outdated
Comment thread RestroHub-FrontEnd/src/components/admin/store/tables/TablesGrid.jsx Outdated
Comment thread RestroHub-FrontEnd/src/components/admin/store/tables/TablesGrid.jsx
@Divv1524
Copy link
Copy Markdown
Contributor Author

Addressed all Copilot review comments in the latest commit:

  • aligned secure API role checks
  • preserved table status on partial update
  • made restore duplicate checks deterministic
  • made status validation case-insensitive
  • extracted shared table normalization helper
  • cleared stale table grid error state

@rdodiya Please review.

@rdodiya
Copy link
Copy Markdown
Owner

rdodiya commented May 30, 2026

Hi @Divv1524 ,
Please resolve conflicts and perform above changes mentioned in comment

  • Perform changes related to ErrorResponse as mentioned in above comment as this changes are recently done in Centralize Exception Handling & Standardize API Error Responses #132.

  • Please use hasAnyAuthority instead of hasAnyRole in SecurityConfig and TableController.

  • In /delete api, we will hard delete table and add a toggle button for active status in EditTable and update it in DB and perform necessary changes in UI for these. Once user delete table it will be remove from DB & UI.

image

@Divv1524
Copy link
Copy Markdown
Contributor Author

Divv1524 commented Jun 1, 2026

@rdodiya Please reveiw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Implement real table management APIs and connect Admin Tables UI

3 participants