Skip to content

Commit

Permalink
docs: admin member api 문서화 (#46)
Browse files Browse the repository at this point in the history
* docs: 어드민 controller 문서 작업

* docs: request dto 문서화
  • Loading branch information
Sangwook02 authored Feb 11, 2024
1 parent cc99a4c commit 49a9575
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 14 deletions.
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)
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) {}

0 comments on commit 49a9575

Please sign in to comment.