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

docs: admin member api 문서화 #46

Merged
merged 2 commits into from
Feb 11, 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 @@ -4,6 +4,8 @@
import com.gdschongik.gdsc.domain.member.dto.request.MemberQueryRequest;
import com.gdschongik.gdsc.domain.member.dto.request.MemberUpdateRequest;
import com.gdschongik.gdsc.domain.member.dto.response.MemberFindAllResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
Expand All @@ -17,25 +19,29 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "Admin Member", description = "어드민 회원 관리 API입니다.")
@RestController
@RequestMapping("/admin/members")
@RequiredArgsConstructor
public class AdminMemberController {

private final MemberService memberService;

@Operation(summary = "전체 회원 목록 조회", description = "전체 회원 목록을 조회합니다.")
@GetMapping
public ResponseEntity<Page<MemberFindAllResponse>> getMembers(MemberQueryRequest queryRequest, Pageable pageable) {
Page<MemberFindAllResponse> response = memberService.findAll(queryRequest, pageable);
return ResponseEntity.ok().body(response);
}

@Operation(summary = "회원 탈퇴", description = "회원을 탈퇴시킵니다.")
@DeleteMapping("/{memberId}")
public ResponseEntity<Void> withdrawMember(@PathVariable Long memberId) {
memberService.withdrawMember(memberId);
return ResponseEntity.ok().build();
}

@Operation(summary = "회원 정보 수정", description = "회원 정보를 수정합니다.")
@PutMapping("/{memberId}")
public ResponseEntity<Void> updateMember(
@PathVariable Long memberId, @Valid @RequestBody MemberUpdateRequest request) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package com.gdschongik.gdsc.domain.member.dto.request;

import static com.gdschongik.gdsc.global.common.constant.RegexConstant.*;

import io.swagger.v3.oas.annotations.media.Schema;

public record MemberQueryRequest(
String studentId,
String name,
String phone,
String department,
String email,
String discordUsername,
String discordNickname) {}
@Schema(description = "학번", pattern = STUDENT_ID) String studentId,
@Schema(description = "이름") String name,
@Schema(description = "전화번호", pattern = PHONE) String phone,
@Schema(description = "학과") String department,
@Schema(description = "이메일") String email,
@Schema(description = "discord username") String discordUsername,
@Schema(description = "커뮤니티 닉네임", pattern = NICKNAME) String discordNickname) {}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@

import static com.gdschongik.gdsc.global.common.constant.RegexConstant.*;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;

public record MemberUpdateRequest(
@NotBlank @Pattern(regexp = STUDENT_ID, message = "학번은 " + STUDENT_ID + " 형식이어야 합니다.") String studentId,
@NotBlank String name,
@NotBlank @Pattern(regexp = PHONE, message = "전화번호는 " + PHONE + " 형식이어야 합니다.") String phone,
@NotBlank String department,
@NotBlank @Email String email,
@NotBlank String discordUsername,
@NotBlank @Pattern(regexp = NICKNAME, message = "닉네임은 " + NICKNAME + " 형식이어야 합니다.") String nickname) {}
@NotBlank
@Pattern(regexp = STUDENT_ID, message = "학번은 " + STUDENT_ID + " 형식이어야 합니다.")
@Schema(description = "학번", pattern = STUDENT_ID)
String studentId,
@NotBlank @Schema(description = "이름") String name,
@NotBlank
@Pattern(regexp = PHONE, message = "전화번호는 " + PHONE + " 형식이어야 합니다.")
@Schema(description = "전화번호", pattern = PHONE)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋은 의견인 것 같습니다.
해당 내용은 향후 다른 issue에서 처리하도록 하겠습니다!
감사합니다!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아닌거 같아서 지웠는데 벌써 보셨네요 ㅠㅠ

String phone,
@NotBlank @Schema(description = "학과") String department,
@NotBlank @Email @Schema(description = "이메일") String email,
@NotBlank @Schema(description = "discord username") String discordUsername,
@NotBlank
@Pattern(regexp = NICKNAME, message = "닉네임은 " + NICKNAME + " 형식이어야 합니다.")
@Schema(description = "커뮤니티 닉네임", pattern = NICKNAME)
String nickname) {}
Loading