Skip to content

Commit

Permalink
Update Application
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhMoraes committed Jul 16, 2023
1 parent 7918cfc commit cdc67cd
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 1 deletion.
Empty file.
Empty file.
Empty file.
11 changes: 11 additions & 0 deletions .idea/sonarlint/issuestore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
Empty file.
Empty file.
11 changes: 11 additions & 0 deletions .idea/sonarlint/securityhotspotstore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions api-gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

</dependencies>
<dependencyManagement>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
@Repository
public interface UserRepository extends JpaRepository<User, Long> {

User createUser(String name, String email, String password, double hourlyPrice);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -14,4 +16,8 @@ public interface UserResource {

@GetMapping
ResponseEntity<List<User>> findAll();

@PostMapping
ResponseEntity<User> createUser(@RequestBody String name, String email, String password, double hourlyPrice);

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -27,4 +29,9 @@ public ResponseEntity<User> findById(Long id) {
public ResponseEntity<List<User>> findAll() {
return ResponseEntity.ok().body(userService.findAll());
}

@Override
public ResponseEntity<User> createUser(@RequestBody String name, String email, String password, double hourlyPrice) {
return ResponseEntity.ok().body(userService.createUser());
}
}
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -9,5 +10,8 @@ public interface UserService {
User findById(Long id);
List<User> findAll();

User createUser();


User createUser(@RequestBody String name, String email, String password, double hourlyPrice);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -31,4 +32,11 @@ public User findById(Long id) {
public List<User> 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);
}

}

0 comments on commit cdc67cd

Please sign in to comment.