|
| 1 | +package com.somemore.user.controller; |
| 2 | + |
| 3 | +import com.somemore.global.auth.annotation.UserId; |
| 4 | +import com.somemore.global.common.response.ApiResponse; |
| 5 | +import com.somemore.user.dto.basicinfo.CenterBasicInfoRequestDto; |
| 6 | +import com.somemore.user.dto.basicinfo.VolunteerBasicInfoRequestDto; |
| 7 | +import com.somemore.user.usecase.UpdateBasicInfoUseCase; |
| 8 | +import io.swagger.v3.oas.annotations.Operation; |
| 9 | +import io.swagger.v3.oas.annotations.tags.Tag; |
| 10 | +import lombok.RequiredArgsConstructor; |
| 11 | +import lombok.extern.slf4j.Slf4j; |
| 12 | +import org.springframework.security.access.annotation.Secured; |
| 13 | +import org.springframework.web.bind.annotation.PostMapping; |
| 14 | +import org.springframework.web.bind.annotation.RequestBody; |
| 15 | +import org.springframework.web.bind.annotation.RequestMapping; |
| 16 | +import org.springframework.web.bind.annotation.RestController; |
| 17 | + |
| 18 | +import java.util.UUID; |
| 19 | + |
| 20 | +@Tag(name = "User Command API", description = "유저 생성 수정 삭제 관련 API") |
| 21 | +@RestController |
| 22 | +@Slf4j |
| 23 | +@RequiredArgsConstructor |
| 24 | +@RequestMapping("/api/user") |
| 25 | +public class UserCommandController { |
| 26 | + |
| 27 | + private final UpdateBasicInfoUseCase updateBasicInfoUseCase; |
| 28 | + |
| 29 | + @Secured("ROLE_VOLUNTEER") |
| 30 | + @PostMapping("/basic-info/volunteer") |
| 31 | + @Operation(summary = "봉사자 기본 정보 업데이트", description = "봉사자의 기본 정보를 업데이트합니다.") |
| 32 | + public ApiResponse<String> registerBasicInfo( |
| 33 | + @UserId UUID userId, |
| 34 | + @RequestBody VolunteerBasicInfoRequestDto volunteerBasicInfoRequestDto |
| 35 | + ) { |
| 36 | + updateBasicInfoUseCase.update(userId, volunteerBasicInfoRequestDto); |
| 37 | + return ApiResponse.ok("봉사자 기본 정보 업데이트 완료"); |
| 38 | + } |
| 39 | + |
| 40 | + @Secured("ROLE_CENTER") |
| 41 | + @PostMapping("/basic-info/center") |
| 42 | + @Operation(summary = "센터 기본 정보 업데이트", description = "센터의 기본 정보를 업데이트합니다.") |
| 43 | + public ApiResponse<String> registerBasicInfo( |
| 44 | + @UserId UUID userId, |
| 45 | + @RequestBody CenterBasicInfoRequestDto centerBasicInfoRequestDto |
| 46 | + ) { |
| 47 | + updateBasicInfoUseCase.update(userId, centerBasicInfoRequestDto); |
| 48 | + return ApiResponse.ok("센터 기본 정보 업데이틍 완료"); |
| 49 | + } |
| 50 | +} |
0 commit comments