GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - developersCradle/code-challange-rest-api: This was for Codemen Oy. REST API with Spring Boot. Challenge and also opportunity to learn more.

BranchesTags
Open more actions menu

Latest commit

 

History

12 Commits
12 Commits

Folders and files

NameName
Last commit message
Last commit date
.mvn/wrapper
.mvn/wrapper
 
 
src
src
 
 
.gitignore
.gitignore
 
 
Codemen_Logo.png
Codemen_Logo.png
 
 
Dockerfile
Dockerfile
 
 
Eng_Flag.PNG
Eng_Flag.PNG
 
 
Feedback_Good_Grade_Eng.PNG
Feedback_Good_Grade_Eng.PNG
 
 
Feedback_Good_Grade_Fin.PNG
Feedback_Good_Grade_Fin.PNG
 
 
Fin_Flag.PNG
Fin_Flag.PNG
 
 
LICENSE
LICENSE
 
 
Orc_Miner.gif
Orc_Miner.gif
 
 
README.md
README.md
 
 
docker-compose.yml
docker-compose.yml
 
 
mvnw
mvnw
 
 
mvnw.cmd
mvnw.cmd
 
 
pom.xml
pom.xml
 
 

Repository files navigation

Orc Miner First! Codemen Logo! Orc Miner Second!
Think. Code. Optimize. Build Powerful APIs.

Backend task Eng.

  • Back End should include API's compliant with REST. It should include following actions:
    • Adding user.
    • Removing user.
    • Modifying user.
    • Returning all users with pagination.
    • Get user by name.
  • Authentication is optional.
  • Database can be free of choice.
  • Description of data from API:
    • https://jsonplaceholder.typicode.com/users

Backend task Fin.

Back Endissä tulisi olla REST rajapinnat käyttäjien lisäämiseen, poistamiseen ja muokkaamiseen, kaikkien käyttäjien hakemiseen siivutettuna sekä vielä käyttäjien hakemiseen nimen perusteella.

  • Autentikaatiota ei välttämättä tarvita.
  • Tietokannaksi voit valita minkä itse koet parhaaksi.
  • Rajapinnan datasta:
    • https://jsonplaceholder.typicode.com/users

Checklist.

  • Spring API documentation. ✔️ Open-API was used, because Swagger current version didn't support the newest Spring Boot. To look documentation, navigate to http://localhost:8080/swagger-ui/index.html.
    • Look for example Swagger.
  • Some database. ✔️ MySQL.
    • Some way to initialize random users. ✔️ @PostConstruct.
      • For example MySQL or Spring Boot initializing way.
        • Creating database startup mechanism. ✔️ Hibernate takes care of creating database and table.
  • Make instructions .md. ✔️
  • CRUD operations. ✔️
    • Add. ✔️ Adding user is done making POST message to /api/v1/users.
    • Remove. ✔️ Removing user is done making DELETE message to /api/v1/users/{userId}.
    • Modify PUT(PUT/POST/PATCH). ✔️ Modifying user is done making PUT message to /api/v1/users.
    • Read. ✔️ Return all users when making GET request to /api/v1/users.
      • Return all as paged. ✔️ Returns wanted amount of users, when perform GET message /api/v1/users?pageSize=10 where pageSize URL parameter is present.
        • Simple paging.
          • Possible paging.
      • Return users based on name. ✔️ Returns all users based on name, when perform GET message to/api/v1/users?name=pekka here name URL parameter is present.
  • Tests. ✔️ Service level tests.
    • Following error were introduced when using plain old Eclipse error java.lang.NoSuchMethodError: 'java.util.Set. ✔️ This was fixed using Spring Tools 4 for Eclipse.
    • Unit tests were not introduced since business logic was fairly simple.
    • Option to add docker to tests, so test db and production db data won't get mixed up. ✔️
  • Other bonuses would be to implement sort, offset and indexes into query logic. (BONUS).
  • For the sake of time authentication was not introduced. If there would be such a time, usage of JWT Bearer Token to Swagger would be an option to go.
  • Get user with specified userId with GET message. (BONUS). ✔️ Do GET request for following address /api/v1/users/{userId}.
  • Add support for saving multiple users at same time. This is for saveAll() BatchInserts (BONUS). ✔️

How to run (Recommended).

Requirements for running locally:

  1. Have Docker. Tested with Docker Desktop 4.25.2.
  1. Pull repository.
  2. Go to the project folder.
  3. Execute with Docker docker-compose up --build.
  4. Go to documentation and start using http://localhost:8080/swagger-ui/index.html.
  • Only starting inside IDE. Starting in Eclipse IDE for debugging purposes. We can start db separately and then start debug version from Eclipse IDE. Starting db from docker independently docker run -d -p 3307:3306 --name mysqldb -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=user_rest_demo mysql.

  • For the future, if there is time, there should be a way to build all in one command and set this process up.

How to run (Optional, old way).

Requirements for running locally.

  1. Java JDK 17 minimum. Tested with OpenJDK21.
  2. MySQL server running. Tested with MySQL 8.x.xx. Server should be running in port 3306 and root password root and root user root.
  3. Docker is needed to run tests.

Maven should not be needed since using Maven wrapper mvnw.

  1. Pull repository.
  2. Go to the project folder and build the .jar file and execute. ./mvnw spring-boot:run.
  3. Go to documentation and start using http://localhost:8080/swagger-ui/index.html.
  • This has been tested. ✔️ For the future, if there is time, there should be a docker image for setting this process up.

Feedback/Grade.

Codemen challange!
Codemen challange!
  1. Palaute on suomeksi. Erinomainen arvosana!
Codemen challange!
Codemen challange!
  1. Feedback in English, with excellent grade! This is translated.

What I Learned.

  • Use Docker in test's.
  • Use pagination in the API calls.
  • Better usage of the Java Optionals.

About

This was for Codemen Oy. REST API with Spring Boot. Challenge and also opportunity to learn more.

www.codemen.fi/

Topics

batchbatch-savedockerfakermaven-wrappermysqlopenapirestrest-apispring-boot

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.