-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f1f67e
commit da0eb47
Showing
20 changed files
with
100 additions
and
435 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
43 changes: 0 additions & 43 deletions
43
src/main/java/com/aisip/OnO/backend/Auth/AuthUserController.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
src/main/java/com/aisip/OnO/backend/Auth/UserEntityRepository.java
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
src/main/java/com/aisip/OnO/backend/Dto/User/UserRegisterDto.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 33 additions & 28 deletions
61
src/main/java/com/aisip/OnO/backend/controller/UserController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,45 @@ | ||
package com.aisip.OnO.backend.controller; | ||
|
||
import com.aisip.OnO.backend.Dto.User.UserRegisterDto; | ||
import com.aisip.OnO.backend.Dto.User.UserResponseDto; | ||
import com.aisip.OnO.backend.service.UserService; | ||
import com.google.auth.oauth2.IdToken; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import com.aisip.OnO.backend.service.AuthService; | ||
import com.aisip.OnO.backend.entity.User; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.security.core.Authentication; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RequiredArgsConstructor | ||
@RestController | ||
@RequestMapping("/api/user") | ||
public class UserController { | ||
|
||
private final UserService userService; | ||
@Autowired | ||
private AuthService authService; | ||
|
||
@GetMapping("/{userId}") | ||
public ResponseEntity<UserResponseDto> getUserById(@PathVariable Long userId) { | ||
UserResponseDto userResponseDto = userService.getUserByUserId(userId); | ||
return ResponseEntity.ok().body(userResponseDto); | ||
@GetMapping("/info") | ||
public ResponseEntity<?> getUserInfo(Authentication authentication) { | ||
Long userId = (Long) authentication.getPrincipal(); | ||
User user = authService.getUserById(userId); | ||
if (user != null) { | ||
return ResponseEntity.ok(user); | ||
} else { | ||
return ResponseEntity.status(404).body(new ErrorResponse("User not found")); | ||
} | ||
} | ||
|
||
@PostMapping("/join") | ||
public ResponseEntity<UserResponseDto> saveUser(@RequestBody UserRegisterDto userRegisterDto) { | ||
UserResponseDto userResponseDto = userService.saveUser(userRegisterDto); | ||
return ResponseEntity.ok().body(userResponseDto); | ||
} | ||
public static class ErrorResponse { | ||
private String error; | ||
|
||
public ErrorResponse(String error) { | ||
this.error = error; | ||
} | ||
|
||
// @GetMapping("/autoLogin/{googleId}") | ||
// public ResponseEntity<?> autoLogin(@PathVariable String googleId) { | ||
// try { | ||
// UserResponseDto userResponseDto = userService.getUserByGoogleId(googleId); | ||
// return ResponseEntity.ok().body(userResponseDto); | ||
// } catch (UserNotFoundException e) { | ||
// return ResponseEntity.status(HttpStatus.NOT_FOUND).body(e.getMessage()); | ||
// } | ||
// } | ||
} | ||
public String getError() { | ||
return error; | ||
} | ||
|
||
public void setError(String error) { | ||
this.error = error; | ||
} | ||
} | ||
} |
24 changes: 0 additions & 24 deletions
24
src/main/java/com/aisip/OnO/backend/converter/UserConverter.java
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
src/main/java/com/aisip/OnO/backend/entity/SocialLogin/SocialLogin.java
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
src/main/java/com/aisip/OnO/backend/entity/SocialLogin/SocialLoginType.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.