Phones API service
Regular spring boot app. Running the application -
mvn spring-boot:run
Access the application using the root context - http://localhost:8780/test/api/v1/
Regular Swagger ui api details - http://localhost:8780/test/swagger-ui.html
- 1.1 Only phone numbers generated in the GET requests output.
- Could do phone model attributes as well.
- Provided some basic sorting capability on some phone attributes - region, number etc.
- start -> start record index
- limit -> Max records in the output.
- Max limit(upper limit) is set in application.properties.
- sort -> Sort field
- dir -> ASC / DESC
- To Get by customerId, use the query parameter customerId in /phones.
- 1.2 Get phones by customer id
- Generally, to be more expressive and restful, this data set is retrieved from customers service via the rest path /customers/{customerId}/phones.
- 1.3 Activate phone scenario -
- Will update the activate flag capturing the date of activation.
- Will capture the IMEI as well during the process
- Will not update once a number is already activated.
- Will update the activate flag capturing the date of activation.
- 1.4 DB and static data structure
- Assumed some index capabilities (available in relational/no-sql DBs) for searching, aggregation purposes.For instance, in case of dynamo using a GSI.
- 1.5 Used Java 8 - which is still the most preferred by Enterprise. Could have used 15 as well with some updates to type inference - var, switch, optional etc.
Jacoco coverage attached below - could run using
mvn test jacoco:report