Skip to content

Feature/rest for grocery list#64

Merged
timn21 merged 2 commits into
mainfrom
feature/REST-for-grocery-list
Jun 12, 2026
Merged

Feature/rest for grocery list#64
timn21 merged 2 commits into
mainfrom
feature/REST-for-grocery-list

Conversation

@JonathanPschl

Copy link
Copy Markdown
Collaborator

Closes #52

REST API for Grocery Lists

Adds a full CRUD REST API for persisted grocery lists in grocery-service, backed by grocery-db, exposed through the api-gateway and documented via OpenAPI/Swagger.

What's included

Endpoints (/api/grocery-list)

Method Path Description
GET /history 20 most recent grocery lists (summaries), newest first
GET /history/{id} Single grocery list with its items
POST /history Create a grocery list with items → 201 Created + Location
DELETE /history/{id} Delete a grocery list and its items → 204 No Content

Implementation

  • Controller / Service / Repository layering: GroceryListController, GroceryListService, GroceryListRepository.
  • Entities: GroceryList, GroceryItem, GroceryCategory (JPA, mapped to the existing grocery-db schema).
  • DTOs: request/response records (GroceryListCreateRequest, GroceryItemRequestDTO, GroceryListDetailDTO, GroceryListSummaryDTO, GroceryItemResponseDTO) — entities are never exposed directly.
  • Validation: name and userId required (400 otherwise); unknown category400; missing list → 404.

OpenAPI / Swagger

  • Added springdoc-openapi and OpenApiConfig (title, version, bearerAuth JWT scheme).
  • Endpoints annotated with @Operation / @ApiResponse.
  • Aggregated in the gateway's Swagger UI (/v3/api-docs/grocery-service).

Database & gateway

  • grocery-db/init.sql: grocery_category enum type.
  • user-db/init.sql: seeded dev admin (admin@bytebite.dev / password).
  • api-gateway: routes /api/grocery-list/** to grocery-service.

@timn21 timn21 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@timn21 timn21 merged commit a647735 into main Jun 12, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create REST endpoints in grocery service to fetch saved grocery lists.

2 participants