3. Core Technology Requirements
-
Entity Relationships
One-to-many / many-to-many relationship between entities. Operations:
- Retrieving all child entities for a given parent.
- Creating, updating and deleting child entities associated with a parent.
- Implementing a cascading delete.
-
Use of Date and Time Objects
Handling date-related data.
- Accept and validate date inputs.
- Using a consistent format.
- An endpoint that filters by date range / sorts results based on date fields.
-
Incorporating DTOs (Data Transfer Objects)
Use DTOs to control data exchanged between the client and server.
- Separation of concerns by decoupling the internal data model from the API response format.
- Clean and minimal responses that expose only the required data fields.
-
Error Handling and Validation
Implement structured and meaningful error handling.
- Validating client input.
- Appropriate HTTP status codes and error messages.
- Clear, consistent error responses.
Examples:
- Example:
@Positiveon price ensures inventory values are realistic. - Example:
@PastOrPresenton manufacture dates prevents future entries.
Jakarta Validation is used at the DTO level.
-
Pagination The API supports pagination for endpoints returning collections.
-
Validation Error (400): Triggered by invalid inputs like negative prices.
- Resource Not Found (404): Triggered when a model name does not exist in the database.