Skip to content

Feat/44 create dtos product management - #55

Merged
LuqueGabriel01 merged 3 commits into
mainfrom
feat/44-create-dtos-product-management
Sep 28, 2026
Merged

LuqueGabriel01 merged 3 commits into
mainfrom
feat/44-create-dtos-product-management

Conversation

@LuqueGabriel01

Copy link
Copy Markdown
Owner

Work performed

  • Menu module (Category → Ingredient/Allergen → Dish): full CRUD (service + controller + tests) for the four entities, using the existing *Translation pattern for multi-language names/descriptions.
  • Orders module (Order/OrderItem): order creation, item add/remove, status transitions (PENDING → IN_PROGRESS → READY → SERVED → CLOSED, with cancellation) and query endpoints, with business-rule guards (session must be open, dish must be available, closed/cancelled orders are no longer modifiable).
  • Kitchen module: new read-only /api/kitchen/queue endpoint — orders still pending preparation (PENDING/IN_PROGRESS), sorted oldest-first, separate from the general "active orders" view.
  • Invoicing module (Invoice): create/read endpoints to close and pay a served order (CASH/CARD/TRANSFER), enforcing one invoice per order.
  • Bug fix: unguarded bidirectional relationship helpers (Order↔OrderItem, Dish↔OrderItem, Invoice↔Order) caused infinite mutual recursion (StackOverflowError) the moment those relations were used; added identity/containment guards, mirroring the existing safe pattern in Category.addDish.
  • Bug fix: SessionController's @PreAuthorize checks used non-existent role literals ('CAJA', 'COCINA') instead of the real RoleName values (CASHIER, KITCHEN), silently locking cashier/kitchen users out of endpoints the security filter chain otherwise allowed them.
  • Bug fix: JwtUtilTest overrode jwt.secret/jwt.expiration, but JwtUtil reads app.jwt.secret/app.jwt.expiration — the test's Spring context never resolved and the test silently failed to start.
  • Security hardening: /error explicitly permitted, so an unmatched route surfaces as a real 404 instead of a misleading 401 from the auth entry point.
  • Environment/config cleanup: separated secrets into .env, injected into application.properties via spring.config.import=optional:file:.env[.properties]; fixed a blanket *.properties/*.yml rule in .gitignore that was silently excluding the (secret-free) application.properties from version control; removed the stale application.properties.example.
  • Dev tooling: DevDataSeeder (profile dev only) bootstraps the roles catalog and a first ADMIN account, so a fresh clone isn't stuck in a chicken-and-egg state (register requires ADMIN, but no ADMIN exists yet); database/test-data.sql seeds a full menu, tables, sessions, orders and one user per role for manual testing.
  • Docker: multi-stage Dockerfile (Maven 21 build → JRE 21 Alpine runtime, non-root user) and root docker-compose.yml (MySQL + app, healthcheck-gated startup); added the missing .mvn/wrapper/maven-wrapper.properties (./mvnw and the Docker build would otherwise fail on a fresh clone).
  • CI: GitHub Actions workflow — compiles and runs the full test suite (including the @SpringBootTest context test) against a MySQL service container, then verifies the Docker image builds.
  • Documentation: docs/ with one file per module (entities, business rules, endpoints), plus updated root README.md and database/README.md.

Files created/modified

Menu (Category/Ingredient/Allergen/Dish)

  • constants/LocaleConstants.java, constants/ApiPaths.java, constants/SecurityConstants.java, constants/ExceptionConstants.java
  • models/entities/{Category,Ingredient,Allergen,Dish}.java (+ translation entities)
  • mappers/{Category,Ingredient,Allergen,Dish}Mapper.java
  • services/{Category,Ingredient,Allergen,Dish}Service.java + services/impl/*ServiceImpl.java
  • controllers/{Category,Ingredient,Allergen,Dish}Controller.java
  • security/SpringSecurityConfig.java
  • Tests: services/impl/*ServiceImplTest.java, controllers/*ControllerTest.java (8 files)
  • docs/{categories,ingredients,allergens,dishes}.md

Orders

  • models/entities/{Order,OrderItem,Dish}.java (recursion fix)
  • models/dto/request/order/*, models/dto/response/order/*
  • mappers/OrderMapper.java, services/OrderService.java + impl/OrderServiceImpl.java, controllers/OrderController.java
  • Tests: services/impl/OrderServiceImplTest.java, controllers/OrderControllerTest.java
  • docs/orders.md

Kitchen

  • constants/ApiPaths.java (KITCHEN_PATH, QUEUE)
  • services/OrderService.java + impl/OrderServiceImpl.java (getKitchenQueue)
  • controllers/KitchenController.java
  • Tests: services/impl/OrderServiceImplTest.java, controllers/KitchenControllerTest.java
  • docs/kitchen.md

Invoicing

  • models/entities/{Invoice,Order}.java (recursion fix)
  • models/dto/request/invoice/*, models/dto/response/invoice/*
  • repositories/InvoiceRepository.java, mappers/InvoiceMapper.java
  • services/InvoiceService.java + impl/InvoiceServiceImpl.java, controllers/InvoiceController.java
  • Tests: services/impl/InvoiceServiceImplTest.java, controllers/InvoiceControllerTest.java
  • docs/invoices.md

Fixes / security

  • controllers/SessionController.java (CAJA/COCINA → CASHIER/KITCHEN)
  • security/SpringSecurityConfig.java (/error permitAll)
  • test/security/JwtUtilTest.java (property key fix)

Environment / Docker / CI

  • .gitignore, .env.example, src/main/resources/application.properties (now tracked), removed application.properties.example
  • .mvn/wrapper/maven-wrapper.properties, Dockerfile, .dockerignore, docker-compose.yml
  • .github/workflows/ci.yml
  • config/DevDataSeeder.java, database/test-data.sql

Docs

  • README.md, database/README.md, docs/README.md (+ per-module files listed above)

@LuqueGabriel01 LuqueGabriel01 added this to the Kitchen Module milestone Sep 28, 2026
@LuqueGabriel01 LuqueGabriel01 self-assigned this Sep 28, 2026
@LuqueGabriel01 LuqueGabriel01 added documentation Improvements or additions to documentation enhancement New feature or request backend Server logic and API endpoints and security. labels Sep 28, 2026
@LuqueGabriel01
LuqueGabriel01 merged commit f41de5f into main Sep 28, 2026
1 check failed
@LuqueGabriel01
LuqueGabriel01 deleted the feat/44-create-dtos-product-management branch September 28, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Server logic and API endpoints and security. documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant