회원가입 추가, 역할 추가, spotlessApply 실행
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
package com.kamco.cd.kamcoback.members;
|
||||
|
||||
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
|
||||
import com.kamco.cd.kamcoback.members.dto.MembersDto;
|
||||
import com.kamco.cd.kamcoback.members.service.AdminService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.UUID;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Tag(name = "회원정보 관리자 관리", description = "회원정보 관리자 관리 API")
|
||||
@RestController
|
||||
@RequestMapping("/api/admin")
|
||||
@RequiredArgsConstructor
|
||||
public class AdminApiController {
|
||||
|
||||
private final AdminService adminService;
|
||||
|
||||
@Operation(summary = "회원가입", description = "회원가입")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "201",
|
||||
description = "회원가입 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = Long.class))),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@PostMapping("/members/join")
|
||||
public ApiResponseDto<Long> saveMember(
|
||||
@io.swagger.v3.oas.annotations.parameters.RequestBody(
|
||||
description = "회원가입",
|
||||
required = true,
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = MembersDto.AddReq.class)))
|
||||
@RequestBody
|
||||
@Valid
|
||||
MembersDto.AddReq addReq) {
|
||||
|
||||
return ApiResponseDto.createOK(adminService.saveMember(addReq));
|
||||
}
|
||||
|
||||
@Operation(summary = "역할 저장", description = "역할 저장")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "201",
|
||||
description = "역할 추가",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = UUID.class))),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@PostMapping("/roles/add")
|
||||
public ApiResponseDto<UUID> saveRoles(
|
||||
@io.swagger.v3.oas.annotations.parameters.RequestBody(
|
||||
description = "역할 추가",
|
||||
required = true,
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = MembersDto.RolesDto.class)))
|
||||
@RequestBody
|
||||
@Valid
|
||||
MembersDto.RolesDto rolesDto) {
|
||||
adminService.saveRoles(rolesDto);
|
||||
return ApiResponseDto.createOK(rolesDto.getUuid());
|
||||
}
|
||||
|
||||
@Operation(summary = "역할 삭제", description = "역할 삭제")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "201",
|
||||
description = "역할 삭제",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = UUID.class))),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@PostMapping("/roles/rm")
|
||||
public ApiResponseDto<UUID> deleteRoles(
|
||||
@io.swagger.v3.oas.annotations.parameters.RequestBody(
|
||||
description = "역할 삭제",
|
||||
required = true,
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = MembersDto.RolesDto.class)))
|
||||
@RequestBody
|
||||
@Valid
|
||||
MembersDto.RolesDto rolesDto) {
|
||||
adminService.deleteRoles(rolesDto);
|
||||
return ApiResponseDto.createOK(rolesDto.getUuid());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user