-
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.
Merge pull request #72 from KNU-HAEDAL-Website/feat-create-board-user…
…-role-issue-51 Feat: 게시판 생성시 유저 목록 조회 관련 권한 변경
- Loading branch information
Showing
7 changed files
with
97 additions
and
73 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<ActiveUserDTO>> getUser(@RequestParam(value = "page", defaultValue = "0") int page, | ||
////// @RequestParam(value = "size", defaultValue = "5") int size){ | ||
////// Page<ActiveUserDTO> 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
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
10 changes: 5 additions & 5 deletions
10
...edalweb/dto/response/InActiveUserDTO.java → ...web/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 |
---|---|---|
@@ -1,24 +1,24 @@ | ||
package com.haedal.haedalweb.dto.response; | ||
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; | ||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@Builder | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class InActiveUserDTO { | ||
public class PrivateUserDTO { | ||
@Schema(description = "유저 아이디", example = "haedal12") | ||
private String userId; | ||
|
||
@Schema(description = "유저 학번", example = "2024111234") | ||
private Integer studentNumber; | ||
|
||
@Schema(description = "유저 이름", example = "조대성") | ||
private String userName; | ||
@Schema(description = "가입 날짜") | ||
private LocalDateTime regDate; | ||
} |
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