Giter VIP home page Giter VIP logo

besedo's Introduction

Besedo Candidate Assignment

Besedo Microservice Assignment
Explore the Assignment »

Report Bug Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. Contact
  7. Acknowledgments

About The Project

To build 3 rest points to perform following operations:

  1. One endpoint to ingest an JSON object with the following format. Fields have length constraint on min/max, email is required and only one of title and body is required.
  2. One endpoint to return this data, considering that the dataset will contain a large number of entries. Filtering should also be possible, by a single field, one of id, email, title or body.
  3. One endpoint that returns a CSV file that is a report on the ingested items, composed of two columns, the first one being the id of the item and the second one being the amount of vowels contained in the body.

(back to top)

Built With

Following are the technologies used to build the framework.

  • SpringBoot
  • H2

(back to top)

Getting Started

Clone the repository

git clone https://github.com/veerao05/besedo.git

Setting up the workspace

After cloning the Repository it can be placed anywhere on your local hard drive.

Prerequisites & Installation for SpringBoot

Requirements

For building and running the application you need:

Building the application locally

cd <path_of_backend_repo>
mvn clean install
Ex: <MainPath>/besedo/

Deploying the application

  1. Locally
Run BesedoMainApplication.java file
  1. Docker
To Build the Docker image:  
cd <MainPath>/besedo/ 
docker build  --tag=besedo:latest . 

To Run the springboot application in container: 
docker run --name=besedo -it -e DATABASE_SERVER=jdbc:h2:mem:testdb -dp 8080:8080 -v ${PWD}/logs:/besedo/logs besedo:latest

To see the container logs:
docker logs -f --tail 10 besedo

To enter inside the container: 
docker exec -it besedo  sh

To stop the container:
docker stop besedo

To delete all the stopped container:
docker container rm $(docker ps -a -q)

To delete the image:
docker rmi <image-id>

To obtain image id:
docker images

Rest URL's

Here are some url samples for pagination (with/without filter):

/api/data: using default page and size

/api/data?page=1&size=5: using 1st page and 5 size

/api/data?size=5: using default value for page

/api/data?id=1&page=1&size=3: pagination & filter by id

/api/data?title=Senior Engineer&csv=false: pagination & filter by ‘title’ status

/api/data?csv=true: to generate csv report

Roadmap/Enhancements

. Sorting

. SQL Db

. Error Code Handling

. Additional Junit

. Update and Delete endpoints

  • Add any suggestions

See the open issues for a full list of proposed features (and known issues).

(back to top)

Improvements given:

  1. Exceptions handling using spring
  2. Global exception handling
  3. CSV reader null pointer on getBody()
  4. Load on get mapping can be done using indexing/search DB should be used.
  5. Load on Post mapping can be done through queues/Spring Batch
  6. if (data.charAt(i) == 'a' || data.charAt(i) == 'e' || data.charAt(i) == 'i' || data.charAt(i) == 'o' || data.charAt(i) == 'u') { count++; }. Use lamda expression
  7. Dont try to throw exceptions from Helper class(Bottom class) . How do you handle the exceptions thrown from bottom class in Upper class.
  8. Why Query is used why not getbyId or getByEmail was used? It can be used , to provide pagination all in one method use query here. Alternative is HSQL/getbyId or getByEmail
  9. findDataList(String id, String email, String title, String body, Pageable pageable, boolean csv) - could have used all the paramaters in one class object.
  10. Since @lombok.Data is used , controller could have used controller injection. so use @RequiredArgsConstructor
  11. Unit test cases for Controller and service/business layer
  12. Entity is directly exposed . so use view object instead of exposing Entity.
  13. POST request didnt not return any response message.
  14. countVowels(data.getBody()) - handle Null pointer exception in case of GetBody null.
  15. email is required and only one of title and body is required. - Didnt understand the question properly here.
  16. Exception handling with different codes could have been done better to the clients.
  17. Handling duplicate records.
  18. Why inbuilt CSV library was used?
  19. Why Java8 was used why not JAVA16?

Contributing

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/SampleFeature)
  3. Commit your Changes (git commit -m 'Add some SampleFeature')
  4. Push to the Branch (git push origin feature/SampleFeature)
  5. Open a Pull Request

(back to top)

Contact

Your Name - VeenaRao and Email:[email protected]

Project Link: https://github.com/veerao05/besedo

(back to top)

Acknowledgments

List of resources used for project reference.

(back to top)

besedo's People

Contributors

veerao05 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.