diff --git a/.idea/sonarlint/issuestore/0/3/03c2115c4d35579d325705cedecbc57d3f97bb3f b/.idea/sonarlint/issuestore/0/3/03c2115c4d35579d325705cedecbc57d3f97bb3f deleted file mode 100644 index e69de29..0000000 diff --git a/.idea/sonarlint/issuestore/8/7/8708b6ef2779ff8c9cfef64ef98aa34c3fb0ca89 b/.idea/sonarlint/issuestore/8/7/8708b6ef2779ff8c9cfef64ef98aa34c3fb0ca89 deleted file mode 100644 index e69de29..0000000 diff --git a/.idea/sonarlint/issuestore/e/9/e959ec00b45d61a6e5c22b67d8b2bb7d81912700 b/.idea/sonarlint/issuestore/e/9/e959ec00b45d61a6e5c22b67d8b2bb7d81912700 deleted file mode 100644 index e69de29..0000000 diff --git a/.idea/sonarlint/issuestore/index.pb b/.idea/sonarlint/issuestore/index.pb index e69de29..7ff4ef3 100644 --- a/.idea/sonarlint/issuestore/index.pb +++ b/.idea/sonarlint/issuestore/index.pb @@ -0,0 +1,11 @@ + +9 + README.md,8\e\8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d +… +Ueureka-seerver/src/main/java/com/hrsystem/eurekaseerver/EurekaSeerverApplication.java,3\c\3cb260d15f0094a086bec8f0d47332df1992bba2 +ˆ +Xpayroll-api/src/main/java/com/hrsystem/payrollapi/payrollapi/feignClients/UserFeign.java,0\e\0ef88ac507aa28031236903226949a1e0aeac529 += + user-api/mvnw,b\5\b5e21858311809d07412e8b1545592e8f4b61e79 +} +Muser-api/src/main/java/com/hrsystem/userapi/service/impl/UserServiceImpl.java,a\d\ad872f8ae43f9960e6c72dcab54565ad0ce86a9c \ No newline at end of file diff --git a/.idea/sonarlint/securityhotspotstore/0/3/03c2115c4d35579d325705cedecbc57d3f97bb3f b/.idea/sonarlint/securityhotspotstore/0/3/03c2115c4d35579d325705cedecbc57d3f97bb3f deleted file mode 100644 index e69de29..0000000 diff --git a/.idea/sonarlint/securityhotspotstore/8/7/8708b6ef2779ff8c9cfef64ef98aa34c3fb0ca89 b/.idea/sonarlint/securityhotspotstore/8/7/8708b6ef2779ff8c9cfef64ef98aa34c3fb0ca89 deleted file mode 100644 index e69de29..0000000 diff --git a/.idea/sonarlint/securityhotspotstore/e/9/e959ec00b45d61a6e5c22b67d8b2bb7d81912700 b/.idea/sonarlint/securityhotspotstore/e/9/e959ec00b45d61a6e5c22b67d8b2bb7d81912700 deleted file mode 100644 index e69de29..0000000 diff --git a/.idea/sonarlint/securityhotspotstore/index.pb b/.idea/sonarlint/securityhotspotstore/index.pb index e69de29..93d0a00 100644 --- a/.idea/sonarlint/securityhotspotstore/index.pb +++ b/.idea/sonarlint/securityhotspotstore/index.pb @@ -0,0 +1,11 @@ + +9 + README.md,8\e\8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d +… +Ueureka-seerver/src/main/java/com/hrsystem/eurekaseerver/EurekaSeerverApplication.java,3\c\3cb260d15f0094a086bec8f0d47332df1992bba2 +ˆ +Xpayroll-api/src/main/java/com/hrsystem/payrollapi/payrollapi/feignClients/UserFeign.java,0\e\0ef88ac507aa28031236903226949a1e0aeac529 +} +Muser-api/src/main/java/com/hrsystem/userapi/service/impl/UserServiceImpl.java,a\d\ad872f8ae43f9960e6c72dcab54565ad0ce86a9c += + user-api/mvnw,b\5\b5e21858311809d07412e8b1545592e8f4b61e79 \ No newline at end of file diff --git a/api-gateway/pom.xml b/api-gateway/pom.xml index 2168d9b..3e9d174 100644 --- a/api-gateway/pom.xml +++ b/api-gateway/pom.xml @@ -32,6 +32,11 @@ spring-boot-starter-test test + + org.springframework.boot + spring-boot-starter-web + + diff --git a/user-api/src/main/java/com/hrsystem/userapi/repository/UserRepository.java b/user-api/src/main/java/com/hrsystem/userapi/repository/UserRepository.java index e2ae176..bf772ae 100644 --- a/user-api/src/main/java/com/hrsystem/userapi/repository/UserRepository.java +++ b/user-api/src/main/java/com/hrsystem/userapi/repository/UserRepository.java @@ -7,4 +7,5 @@ @Repository public interface UserRepository extends JpaRepository { + User createUser(String name, String email, String password, double hourlyPrice); } diff --git a/user-api/src/main/java/com/hrsystem/userapi/resources/UserResource.java b/user-api/src/main/java/com/hrsystem/userapi/resources/UserResource.java index 9cc7ad8..2e5894c 100644 --- a/user-api/src/main/java/com/hrsystem/userapi/resources/UserResource.java +++ b/user-api/src/main/java/com/hrsystem/userapi/resources/UserResource.java @@ -4,6 +4,8 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import java.util.List; @@ -14,4 +16,8 @@ public interface UserResource { @GetMapping ResponseEntity> findAll(); + + @PostMapping + ResponseEntity createUser(@RequestBody String name, String email, String password, double hourlyPrice); + } diff --git a/user-api/src/main/java/com/hrsystem/userapi/resources/impl/UserResourceImpl.java b/user-api/src/main/java/com/hrsystem/userapi/resources/impl/UserResourceImpl.java index b4fa55b..14eef79 100644 --- a/user-api/src/main/java/com/hrsystem/userapi/resources/impl/UserResourceImpl.java +++ b/user-api/src/main/java/com/hrsystem/userapi/resources/impl/UserResourceImpl.java @@ -5,6 +5,8 @@ import com.hrsystem.userapi.service.UserService; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -27,4 +29,9 @@ public ResponseEntity findById(Long id) { public ResponseEntity> findAll() { return ResponseEntity.ok().body(userService.findAll()); } + + @Override + public ResponseEntity createUser(@RequestBody String name, String email, String password, double hourlyPrice) { + return ResponseEntity.ok().body(userService.createUser()); + } } diff --git a/user-api/src/main/java/com/hrsystem/userapi/service/UserService.java b/user-api/src/main/java/com/hrsystem/userapi/service/UserService.java index 223e62b..a1236cb 100644 --- a/user-api/src/main/java/com/hrsystem/userapi/service/UserService.java +++ b/user-api/src/main/java/com/hrsystem/userapi/service/UserService.java @@ -1,6 +1,7 @@ package com.hrsystem.userapi.service; import com.hrsystem.userapi.domain.User; +import org.springframework.web.bind.annotation.RequestBody; import java.util.List; @@ -9,5 +10,8 @@ public interface UserService { User findById(Long id); List findAll(); + User createUser(); + + User createUser(@RequestBody String name, String email, String password, double hourlyPrice); } diff --git a/user-api/src/main/java/com/hrsystem/userapi/service/impl/UserServiceImpl.java b/user-api/src/main/java/com/hrsystem/userapi/service/impl/UserServiceImpl.java index 0e005f5..bc58abf 100644 --- a/user-api/src/main/java/com/hrsystem/userapi/service/impl/UserServiceImpl.java +++ b/user-api/src/main/java/com/hrsystem/userapi/service/impl/UserServiceImpl.java @@ -9,13 +9,14 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.RequestBody; import java.util.List; @RequiredArgsConstructor @Service @Slf4j -public class UserServiceImpl implements UserService { +public abstract class UserServiceImpl implements UserService { @Autowired private UserRepository userRepository; @@ -31,4 +32,11 @@ public User findById(Long id) { public List findAll() { return userRepository.findAll(); } + + @Override + public User createUser(@RequestBody String name, String email, String password, double hourlyPrice) { + log.info("USER_SERVICE ::: Created User "); + return userRepository.createUser(name, email, password, hourlyPrice); + } + }