Skip to content

Commit

Permalink
feat: Connection Controller & Service
Browse files Browse the repository at this point in the history
  • Loading branch information
HyungJoonSon committed Dec 5, 2024
1 parent 72cb356 commit 6fac386
Showing 1 changed file with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
import lombok.RequiredArgsConstructor;
import org.dongguk.dscd.wooahan.api.core.annotation.common.AccountID;
import org.dongguk.dscd.wooahan.api.core.dto.ResponseDto;
import org.dongguk.dscd.wooahan.api.user.dto.request.UpdateUserDeviceTokenDto;
import org.dongguk.dscd.wooahan.api.user.dto.request.UpdateUserNotificationStatusDto;
import org.dongguk.dscd.wooahan.api.user.dto.request.UpdateUserNotificationTimeDto;
import org.dongguk.dscd.wooahan.api.user.usecase.UpdateUserDeviceTokenUseCase;
import org.dongguk.dscd.wooahan.api.user.usecase.UpdateUserNotificationStatusUseCase;
import org.dongguk.dscd.wooahan.api.user.usecase.UpdateUserNotificationTimeUseCase;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PutMapping;
Expand All @@ -20,6 +24,8 @@
public class UserCommandV1Controller {

private final UpdateUserNotificationTimeUseCase updateUserNotificationTimeUseCase;
private final UpdateUserNotificationStatusUseCase updateUserNotificationStatusUseCase;
private final UpdateUserDeviceTokenUseCase updateUserDeviceTokenUseCase;

/**
* 4-2. 사용자 알림 시간 수정
Expand All @@ -38,4 +44,40 @@ public ResponseDto<?> updateUserNotificationTime(

return ResponseDto.ok(null);
}

/**
* 4-3. 사용자 알림 상태 수정
*
* @param accountId 계정 ID
* @param requestDto 요청 DTO
* @return 응답 DTO
*/
@PreAuthorize("hasRole('USER')")
@PutMapping("/notification-status")
public ResponseDto<?> updateUserNotificationTime(
@AccountID UUID accountId,
@RequestBody @Valid UpdateUserNotificationStatusDto requestDto
) {
updateUserNotificationStatusUseCase.execute(accountId, requestDto);

return ResponseDto.ok(null);
}

/**
* 4-4. 사용자 기기 토큰 수정
*
* @param accountId 계정 ID
* @param requestDto 요청 DTO
* @return 응답 DTO
*/
@PreAuthorize("hasRole('USER')")
@PutMapping("/device-token")
public ResponseDto<?> updateUserNotificationTime(
@AccountID UUID accountId,
@RequestBody @Valid UpdateUserDeviceTokenDto requestDto
) {
updateUserDeviceTokenUseCase.execute(accountId, requestDto);

return ResponseDto.ok(null);
}
}

0 comments on commit 6fac386

Please sign in to comment.