Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

Repository files navigation

I have chosen a simple layered architecture with controller, service and repository to ensure clear separation of concerns and maintainability. Data is stored in-memory using a Map to keep the solution focused on the core functionality and avoid unnecessary complexity given the limited time.

I use DTOs to separate API input from the internal model. This prevents the client from controlling internal fields such as IDs and makes the API easier to evolve. Mapping is handled in the service layer to keep both DTOs and domain models independent.

IDs are generated in the repository, as this is typically a persistence concern. For updates, the ID is taken from the URL, following REST principles and ensuring consistency between resource identification and operations.

The API follows REST conventions with appropriate HTTP methods and status codes (e.g. 201 for creation, 404 when a resource is not found, and 204 for successful updates and deletes).

Validation is implemented using Bean Validation to ensure correct input from the client. Nested validation is used for owners to validate the entire object graph.

I have intentionally kept the domain model simple by embedding owners inside the company and not exposing separate endpoints for them. This reduces complexity and reflects the scope of the assignment.

AI tools (ChatGPT) were used for sparring on design decisions and clarification of concepts such as REST principles and Bean Validation. The implementation and final design decisions are my own.

Given more time, I would extend the solution with:

  • Persistence using a database (e.g. PostgreSQL with JPA/Hibernate) to ensure data is durable and not lost when the application restarts, and to support real-world use cases with larger datasets and concurrent access.
  • Authentication and authorization (e.g. Spring Security) to protect endpoints and ensure that only authorized users can access or modify data.
  • Global exception handling for consistent error responses, making the API easier to use and debug by returning structured and predictable error messages.
  • More comprehensive test coverage (unit and integration tests) to improve reliability and make the system easier to maintain as it grows.
  • Separate endpoints for owners, including a dedicated OwnerController, OwnerService and OwnerRepository, to allow independent management of owners (e.g. create, update and delete owners without modifying the entire company) and to improve scalability and flexibility of the API design.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages