Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add UserService and Implementation for register #15

Merged
merged 3 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

@SpringBootApplication
public class BackendApplication {

public static void main(String[] args) {
SpringApplication.run(BackendApplication.class, args);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
*/
@Controller
public class HealthCheckController {
@GetMapping ("/health-check")
@GetMapping("/health-check")
public ResponseEntity<String> healthCheck() {
return new ResponseEntity<>("OK", HttpStatus.OK);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
* Repository to manage {@link User} entities.
*/
public interface UserRepository extends JpaRepository<User, Integer> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.greenfoxacademy.backend.services;

import com.greenfoxacademy.backend.models.User;
import org.springframework.stereotype.Service;

/**
* Service to manage {@link User} related actions.
*/
@Service
public interface UserService {
void register(User newUser);

markkovari marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.greenfoxacademy.backend.services;

import com.greenfoxacademy.backend.models.User;
import com.greenfoxacademy.backend.repositories.UserRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
* Service implementation to manage {@link UserService}.
*/
@Service
@RequiredArgsConstructor
public class UserServiceImpl implements UserService {
private final UserRepository userRepository;

@Override
public void register(User newUser) {
userRepository.save(newUser);
}
}
Loading