You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+48-49Lines changed: 48 additions & 49 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
<img id="codemen" src="codemen.png">
4
4
</p>
5
5
6
-
## Backend task Eng
6
+
## Backend task Eng.
7
7
8
8
Back End should include API's compliant with REST. It should include following actions:
9
9
Adding user,
@@ -19,7 +19,7 @@ Description of data from API:
19
19
20
20
https://jsonplaceholder.typicode.com/users
21
21
22
-
## Backend task Fin
22
+
## Backend task Fin.
23
23
24
24
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.
25
25
@@ -30,73 +30,72 @@ Rajapinnan datasta:
30
30
31
31
https://jsonplaceholder.typicode.com/users
32
32
33
-
### Checklist
33
+
### Checklist.
34
34
35
35
-~~Spring API documentation.~~ ✔️
36
-
[Open-API](https://springdoc.org/#getting-started) 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`
37
-
- ~~Look for example [Swagger](https://www.baeldung.com/swagger-2-documentation-for-spring-rest-api)~~
38
-
-~~Some database~~ ✔️
39
-
MySQL
36
+
[Open-API](https://springdoc.org/#getting-started) 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`.
37
+
- ~~Look for example [Swagger](https://www.baeldung.com/swagger-2-documentation-for-spring-rest-api)~~.
38
+
-~~Some database~~. ✔️
39
+
MySQL.
40
40
- ~~Some way to initialize random users.~~ ✔️
41
-
`@PostConstruct`
42
-
- ~~For example MySQL or Spring Boot initializing way~~
43
-
- ~~Creating database startup mechanism~~ ✔️
44
-
Hibernate takes care of creating database and table
45
-
-~~Make instructions `.md`~~ ✔️
46
-
-~~CRUD operations~~ ✔️
47
-
-~~Add~~ ✔️
41
+
`@PostConstruct`.
42
+
- ~~For example MySQL or Spring Boot initializing way~~.
43
+
- ~~Creating database startup mechanism~~. ✔️
44
+
Hibernate takes care of creating database and table.
45
+
-~~Make instructions `.md`~~. ✔️
46
+
-~~CRUD operations~~. ✔️
47
+
-~~Add~~. ✔️
48
48
Adding user is done making **POST** message to `/api/v1/users`.
49
-
-~~Remove~~ ✔️
50
-
Removing user is done making **DELETE** message to `/api/v1/users/{userId}`
51
-
-~~Modify **PUT**(PUT/POST/PATCH)~~ ✔️
52
-
Modifying user is done making **PUT** message to `/api/v1/users`
53
-
-~~Read~~ ✔️
54
-
Return all users when making **GET** request to `/api/v1/users`
55
-
- ~~Return all as paged~~ ✔️
49
+
-~~Remove~~. ✔️
50
+
Removing user is done making **DELETE** message to `/api/v1/users/{userId}`.
51
+
-~~Modify **PUT**(PUT/POST/PATCH)~~. ✔️
52
+
Modifying user is done making **PUT** message to `/api/v1/users`.
53
+
-~~Read~~. ✔️
54
+
Return all users when making **GET** request to `/api/v1/users`.
55
+
- ~~Return all as paged~~. ✔️
56
56
Returns wanted amount of users, when perform **GET** message `/api/v1/users?pageSize=10` where `pageSize` URL parameter is present.
Returns all users based on name, when perform **GET** message to`/api/v1/users?name=pekka` here `name` URL parameter is present.
61
-
-~~Tests~~ ✔️
61
+
-~~Tests~~. ✔️
62
62
Service level tests.
63
63
- ~~Following error were introduced when using plain old Eclipse `error java.lang.NoSuchMethodError: 'java.util.Set`.~~ ✔️
64
-
This was fixed using `Spring Tools 4 for Eclipse`
64
+
This was fixed using `Spring Tools 4 for Eclipse`.
65
65
- Unit tests were not introduced since business logic was fairly simple.
66
66
- ~~Option to add docker to tests, so test db and production db data won't get mixed up.~~ ✔️
67
-
- Other bonuses would be to implement sort, offset and indexes into query logic. (BONUS)
67
+
- Other bonuses would be to implement sort, offset and indexes into query logic. (BONUS).
68
68
- 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.
69
-
-~~Get user with specified userId with GET message. (BONUS)~~ ✔️
70
-
Do **GET** request for following address `/api/v1/users/{userId}`
71
-
-~~Add support for saving multiple users at same time. This is for `saveAll()`.[BatchInserts](https://www.baeldung.com/spring-data-jpa-batch-inserts) (BONUS)~~ ✔️
69
+
-~~Get user with specified userId with GET message. (BONUS)~~. ✔️
70
+
Do **GET** request for following address `/api/v1/users/{userId}`.
71
+
-~~Add support for saving multiple users at same time. This is for `saveAll()`[BatchInserts](https://www.baeldung.com/spring-data-jpa-batch-inserts) (BONUS)~~. ✔️
72
72
73
-
# How to run (Recommended)
73
+
# How to run (Recommended).
74
74
75
-
> Requirements for running locally
76
-
> 1. Have Docker. Tested with [Docker Desktop 4.25.2](https://www.docker.com/)
75
+
> Requirements for running locally:
76
+
> 1. Have Docker. Tested with [Docker Desktop 4.25.2](https://www.docker.com/).
77
77
78
-
1. Pull repository
79
-
2. Go to the project folder
80
-
3. Execute `./mvnw package` to build `.jar` file
81
-
4. Execute with Docker `docker-compose up --build`
82
-
5. Go to documentation and start using `http://localhost:8080/swagger-ui/index.html`
78
+
1. Pull repository.
79
+
2. Go to the project folder.
80
+
3. Execute with Docker `docker-compose up --build`.
81
+
4. Go to documentation and start using `http://localhost:8080/swagger-ui/index.html`.
83
82
84
-
-**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`
83
+
-**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`.
85
84
86
-
- For the future, if there is time, there should be a way to build all in one command and set this process up.
85
+
-~~For the future, if there is time, there should be a way to build all in one command and set this process up.~~
87
86
88
-
# How to run (Optional, old way)
87
+
# How to run (Optional, old way).
89
88
90
-
> Requirements for running locally
91
-
> 1. Java JDK 17 minimum. Tested with [OpenJDK21](https://jdk.java.net/21/)
92
-
> 2. MySQL server running. Tested with [MySQL 8.x.xx](https://dev.mysql.com/downloads/installer/). Server should be running in port `3306` and root password **root** and root user **root**
89
+
> Requirements for running locally.
90
+
> 1. Java JDK 17 minimum. Tested with [OpenJDK21](https://jdk.java.net/21/).
91
+
> 2. MySQL server running. Tested with [MySQL 8.x.xx](https://dev.mysql.com/downloads/installer/). Server should be running in port `3306` and root password **root** and root user **root**.
93
92
94
-
> Maven should not be needed since using Maven wrapper `mvnw`
95
-
> Docker is needed to run tests
93
+
> Maven should not be needed since using Maven wrapper `mvnw`.
94
+
> Docker is needed to run tests.
96
95
97
-
1. Pull repository
98
-
2. Go to the project folder and build the `.jar` file and execute. `./mvnw spring-boot:run`
99
-
3. Go to documentation and start using `http://localhost:8080/swagger-ui/index.html`
96
+
1. Pull repository.
97
+
2. Go to the project folder and build the `.jar` file and execute. `./mvnw spring-boot:run`.
98
+
3. Go to documentation and start using `http://localhost:8080/swagger-ui/index.html`.
100
99
101
100
- This has been tested. ✔️
102
101
~~For the future, if there is time, there should be a docker image for setting this process up.~~
0 commit comments