Skip to content

Commit

Permalink
solved merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Johna91 committed Jan 31, 2024
2 parents 3adfd6c + ca9c2c5 commit b3ff897
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
public class APIController {

@GetMapping("/hello")
@Tag(name = "ex.secured endpoint")
public String hello(Authentication authentication) {
User user = (User) authentication.getPrincipal();
return "Welcome " + user.getName() + " to Secured Endpoint ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ public class AuthController {
private final AuthService authService;
private final ValidationService validationService;

/**
* @param authRequestDTO The authentication request containing user details.
* @param bindingResult The result of the validation process.
* @return ResponseEntity indicating the success or failure of the registration. Returns a 400 Bad
* Request with validation errors (List<String>) if input is invalid. Returns a 200 OK if
* registration is successful.
*/
@PostMapping("/register")
@Tag(name = "Register")
@Operation(
Expand All @@ -41,12 +48,15 @@ public ResponseEntity<?> register(
}
}

@PostMapping("/login")
@Tag(name = "Login")
@Operation(
summary = "Login user",
description = "Login a user by providing their email and username.")
public ResponseEntity<?> login(
/**
* @param authRequestDTO The authentication request containing user credentials.
* @param bindingResult The result of the validation process.
* @return ResponseEntity indicating the success or failure of the authentication. Returns a 400
* Bad Request with validation errors if input is invalid. Returns a 200 OK with
* authentication details if authentication is successful.
*/
@PostMapping("/authenticate")
public ResponseEntity<?> authenticate(
@RequestBody @Valid AuthRequestDTO authRequestDTO, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResponseEntity.badRequest().body(validationService.getAllErrors(bindingResult));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ public SportUserKey(Long userId, Long sportId) {

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof SportUserKey that)) {
return false;
}
if (this == o) return true;
if (!(o instanceof SportUserKey that)) return false;
return Objects.equals(userId, that.userId) && Objects.equals(sportId, that.sportId);
}

Expand Down

0 comments on commit b3ff897

Please sign in to comment.