Skip to content

gargnipungarg/todo-app

Repository files navigation

Todo-App

This API offers CRUD operations on managing TODO items. You can add, list, update via various endpoints exposed. Following operations are supported:

  • Add an item to persistence layer.
  • Update status as Done, completion date is automatically updated as current date.
  • Update status as Not Done, completion date is automatically reset.
  • Update description of an existing TODO item.
  • List all todo items with "Not Done" status, caching is placed on this endpoint for 30 seconds to handle multiple incoming request.
  • List all todo items, caching is placed on this endpoint for 30 seconds to handle multiple incoming request. This endpoint uses the same endpoint as in point above. Providing an option request parameter boolean "notDone", you can choose either to list all statues or only "Not Done".

Tech Stack

  • JDK 11
  • SpringBoot 2.5
  • Swagger for writing API contract
  • Open API 3 for contract standard
  • Mapstruct as Mapper Utility between FrontEnd and Persistence layer POJO models
  • Gradle as dependency management tool
  • PMD for code quality analysis. Report is generated at build/reports/pmd with errors if any, after building the project.
  • Jacoco for Junit Test coverage report. Report is generated at build/reports/jacoco after building the project. Sample coverage has been shown here.
  • Junit 5 for unit tests. Report is generated at build/reports/tests after building the project.
  • WebMvcTest for integration testing
  • Docker for containerizing the application. More info in screenshots.
  • H2 as in memory database
  • Lombok for annotation processor
  • SpringBoot cache starter library for in memory cache of todo items
  • Postman for integration testing

Build & Run

  • To build project on Linux/MacOS, use build.sh file, for windows - use build.bat
  • To run project on Linux/MacOS, use run.sh, for windows - use run.bat
  • docker-commands.txt shows all docker related operations
  • Postman collection for hitting endpoints with request body - TODO.postman_collection.json
  • Automated tests are part of build process. Passing test is mandatory step for successful build.

API Contract

Contract is published in api.yml file.

Assumptions

If a TODO item is past its due date, we are only updating its status as 'Past Due', after a new event has come for that particular todo. For example - An item is added today and is due by tomorrow. If an update comes for this event(like udpate description or update status) after its due date, then we will update the status as 'Past Due'. For automatic update of Todo item without this scenario, we can use 'expiryAt' feature of DynamoDB. Whenever an item is expiring, we can run a lambda that puts back the expired item with 'Past Due' status.