-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
7 changed files
with
89 additions
and
31 deletions.
There are no files selected for viewing
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
66 changes: 40 additions & 26 deletions
66
src/main/java/com/haedal/haedalweb/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,27 +1,41 @@ | ||
//package com.haedal.haedalweb.controller; | ||
package com.haedal.haedalweb.controller; | ||
|
||
import com.haedal.haedalweb.dto.response.user.PrivateUserDTO; | ||
import com.haedal.haedalweb.service.UserService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameters; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
|
||
@Tag(name = "유저 API") | ||
@RequiredArgsConstructor | ||
@RestController | ||
public class UserController { | ||
private final UserService userService; | ||
// @Operation(summary = "User 목록") | ||
// @Parameters({ | ||
// @Parameter(name = "page", description = "현재 페이지"), | ||
// @Parameter(name = "size", description = "한 페이지에 노출할 데이터 수") | ||
// }) | ||
// @GetMapping | ||
// public ResponseEntity<Page<AdminUserDTO>> getUser(@RequestParam(value = "page", defaultValue = "0") int page, | ||
// @RequestParam(value = "size", defaultValue = "5") int size){ | ||
// Page<AdminUserDTO> activeUsers; | ||
// activeUsers = userService.getUsers(PageRequest.of(page, size, Sort.by(Order.asc("role"), Order.asc("name")))); | ||
// | ||
//import io.swagger.v3.oas.annotations.tags.Tag; | ||
//import lombok.RequiredArgsConstructor; | ||
//import org.springframework.web.bind.annotation.RequestMapping; | ||
//import org.springframework.web.bind.annotation.RestController; | ||
//// | ||
////@Tag(name = "User API") | ||
////@RequestMapping("/users") | ||
////@RequiredArgsConstructor | ||
////@RestController | ||
////public class UserController { | ||
//// | ||
////// @Operation(summary = "User 목록") | ||
////// @Parameters({ | ||
////// @Parameter(name = "page", description = "현재 페이지"), | ||
////// @Parameter(name = "size", description = "한 페이지에 노출할 데이터 수") | ||
////// }) | ||
////// @GetMapping | ||
////// public ResponseEntity<Page<AdminUserDTO>> getUser(@RequestParam(value = "page", defaultValue = "0") int page, | ||
////// @RequestParam(value = "size", defaultValue = "5") int size){ | ||
////// Page<AdminUserDTO> activeUsers; | ||
////// activeUsers = userService.getUsers(PageRequest.of(page, size, Sort.by(Order.asc("role"), Order.asc("name")))); | ||
////// | ||
////// return ResponseEntity.ok(activeUsers); | ||
////// } | ||
////} | ||
// return ResponseEntity.ok(activeUsers); | ||
// } | ||
|
||
@Operation(summary = "User 목록 (학번 포함)") | ||
@GetMapping("/private/users") | ||
public ResponseEntity<List<PrivateUserDTO>> getUser(){ | ||
List<PrivateUserDTO> users = userService.getUsers(); | ||
|
||
return ResponseEntity.ok(users); | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
.../haedalweb/dto/response/AdminUserDTO.java → ...alweb/dto/response/user/AdminUserDTO.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
24 changes: 24 additions & 0 deletions
24
src/main/java/com/haedal/haedalweb/dto/response/user/PrivateUserDTO.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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.haedal.haedalweb.dto.response.user; | ||
|
||
import java.time.LocalDateTime; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@Builder | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class PrivateUserDTO { | ||
@Schema(description = "유저 아이디", example = "haedal12") | ||
private String userId; | ||
|
||
@Schema(description = "유저 학번", example = "2024111234") | ||
private Integer studentNumber; | ||
|
||
@Schema(description = "유저 이름", example = "조대성") | ||
private String userName; | ||
} |
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