Skip to content

Feature(CS/2020/007): Order service project initialize - #1

Merged
GLRandula merged 8 commits into
mainfrom
feature/order-service/CS-2020-007
Jun 28, 2026
Merged

GLRandula merged 8 commits into
mainfrom
feature/order-service/CS-2020-007

Conversation

@AminduBhashana

Copy link
Copy Markdown
Contributor

This pull request introduces the initial implementation of the Order Service, including a sample product catalog, REST API endpoints, PostgreSQL integration, and essential supporting infrastructure. The changes add core domain entities, DTOs, controllers, exception handling, and configuration for development and documentation.

Backend and Database Integration

  • Added PostgreSQL support with Docker Compose, .env.example for environment variables, and relevant dependencies (spring-boot-starter-data-jpa, postgresql, spring-dotenv) for database connectivity and configuration. (docker-compose.yml [1] .env.example [2] pom.xml [3] [4]
  • Defined JPA entities for Order, OrderItem, and OrderStatus to represent orders and their items in the database. (Order.java [1] OrderItem.java [2] OrderStatus.java [3]

API Endpoints and Controllers

  • Implemented OrderController for order creation and ProductController for exposing the sample product catalog, both with OpenAPI annotations for documentation. (OrderController.java [1] ProductController.java [2]

Domain and DTO Layer

  • Introduced DTOs for request and response payloads, including CreateOrderRequest, OrderItemRequest, OrderResponse, OrderItemResponse, ProductResponse, and ErrorResponse for consistent API communication. (CreateOrderRequest.java [1] OrderItemRequest.java [2] OrderResponse.java [3] OrderItemResponse.java [4] ProductResponse.java [5] ErrorResponse.java [6]
  • Added a sample in-memory ProductCatalog and its implementation to simulate product lookups. (ProductCatalog.java [1] ProductCatalogSample.java [2]

Supporting Infrastructure

  • Added global exception handling for validation errors and missing products, returning standardized error responses. (GlobalExceptionHandler.java [1] ProductNotFoundException.java [2]
  • Configured OpenAPI/Swagger for API documentation and added a mapper to convert entities to DTOs. (OpenApiConfig.java [1] OrderMapper.java [2]

Dependency and Version Management

  • Downgraded the Spring Boot parent version in pom.xml to 3.5.16 for compatibility with the chosen dependencies. (pom.xml pom.xmlL8-R8)

@AminduBhashana AminduBhashana self-assigned this Jun 28, 2026
@AminduBhashana AminduBhashana added feature new feature CSCI 44092 CSCI 44092 Enterprise Application Development Group Project order-service Handles order creation labels Jun 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds the initial Spring Boot–based Order Service, including persistence (JPA/PostgreSQL), REST endpoints for orders and a sample product catalog, OpenAPI/Swagger documentation, and basic exception handling/configuration to support local development.

Changes:

  • Added core domain model (Order/OrderItem/OrderStatus), repository, service workflow, and mapping to API DTOs.
  • Introduced REST controllers for creating orders and browsing a sample in-memory product catalog, with global exception handling and OpenAPI config.
  • Added PostgreSQL + Spring Data JPA + Springdoc + dotenv dependencies and local dev infra via Docker Compose and environment variable examples.

Reviewed changes

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

Show a summary per file
File Description
src/main/resources/application.yml Adds datasource/JPA and springdoc configuration.
src/main/java/com/example/orderservice/service/OrderServiceImpl.java Implements order creation workflow (catalog lookup → totals → persistence).
src/main/java/com/example/orderservice/service/OrderService.java Defines order creation service contract.
src/main/java/com/example/orderservice/repository/OrderRepository.java Adds JPA repository for Order persistence.
src/main/java/com/example/orderservice/mapper/OrderMapper.java Maps persisted Order entity to OrderResponse DTO.
src/main/java/com/example/orderservice/exception/ProductNotFoundException.java Introduces domain exception for missing products.
src/main/java/com/example/orderservice/exception/GlobalExceptionHandler.java Adds centralized REST exception handling with ErrorResponse.
src/main/java/com/example/orderservice/entity/OrderStatus.java Defines order lifecycle status enum.
src/main/java/com/example/orderservice/entity/OrderItem.java Adds JPA entity for order line items.
src/main/java/com/example/orderservice/entity/Order.java Adds JPA aggregate root for orders with item relationship.
src/main/java/com/example/orderservice/dto/ProductResponse.java DTO for sample product catalog responses.
src/main/java/com/example/orderservice/dto/OrderResponse.java DTO for created order responses.
src/main/java/com/example/orderservice/dto/OrderItemResponse.java DTO for order item response lines.
src/main/java/com/example/orderservice/dto/OrderItemRequest.java DTO + validation for incoming order line requests.
src/main/java/com/example/orderservice/dto/ErrorResponse.java Standardized error payload DTO.
src/main/java/com/example/orderservice/dto/CreateOrderRequest.java DTO + validation for create-order requests.
src/main/java/com/example/orderservice/controller/ProductController.java Adds product catalog REST endpoints.
src/main/java/com/example/orderservice/controller/OrderController.java Adds create-order REST endpoint with OpenAPI annotations.
src/main/java/com/example/orderservice/config/OpenApiConfig.java Configures OpenAPI metadata for the service.
src/main/java/com/example/orderservice/catalog/ProductCatalogSample.java Implements in-memory sample product catalog.
src/main/java/com/example/orderservice/catalog/ProductCatalog.java Defines product catalog abstraction.
pom.xml Adds JPA/PostgreSQL/springdoc/dotenv dependencies and updates Spring Boot parent.
docker-compose.yml Adds local Postgres service with healthcheck/volume.
.env.example Provides example env vars for local Postgres configuration.

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

Comment thread src/main/java/com/example/orderservice/dto/CreateOrderRequest.java
Comment thread src/main/java/com/example/orderservice/dto/OrderItemRequest.java
Comment thread src/main/resources/application.yml
Comment thread src/main/resources/application.yml
Comment thread src/main/java/com/example/orderservice/config/OpenApiConfig.java
Comment thread src/main/resources/application.yml

@GLRandula GLRandula left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Initial code was reviewed

@GLRandula
GLRandula merged commit dc3d96e into main Jun 28, 2026
1 check passed
@PinsaraPerera PinsaraPerera changed the title Feature/order-service/cs-2020-007 Feature(CS/2020/007): Order service project initialize Jun 28, 2026
@PinsaraPerera
PinsaraPerera deleted the feature/order-service/CS-2020-007 branch June 28, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CSCI 44092 CSCI 44092 Enterprise Application Development Group Project feature new feature order-service Handles order creation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants