Skip to content

Commit

Permalink
feat : 유저 알림수신여부 변경 컨트롤러 작성 #155
Browse files Browse the repository at this point in the history
  • Loading branch information
bongsh0112 committed Feb 10, 2024
1 parent 33d83b4 commit 604ced8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import tify.server.api.user.service.RetrieveUserListUseCase;
import tify.server.api.user.service.RetrieveUserOpinionUseCase;
import tify.server.api.user.service.RetrieveUserReportUseCase;
import tify.server.api.user.service.UpdateAlarmReceiveUseCase;
import tify.server.api.user.service.UpdateNeighborUseCase;
import tify.server.api.user.service.UpdateUserExpoTokenUseCase;
import tify.server.api.user.service.UpdateUserFavorUseCase;
Expand Down Expand Up @@ -104,6 +105,7 @@ public class UserController {
private final RetrieveUserOpinionUseCase retrieveUserOpinionUseCase;
private final RetrieveNeighborFavorBoxUseCase retrieveNeighborFavorBoxUseCase;
private final UpdateUserExpoTokenUseCase updateUserExpoTokenUseCase;
private final UpdateAlarmReceiveUseCase updateAlarmReceiveUseCase;

@Operation(summary = "유저 정보 조회")
@GetMapping("/{userId}")
Expand Down Expand Up @@ -339,4 +341,10 @@ public void patchExpoToken(
@RequestParam Long userId, @RequestBody @Valid PatchExpoTokenRequest request) {
updateUserExpoTokenUseCase.execute(userId, request);
}

@Operation(summary = "유저의 알림 수신 여부를 변경합니다.")
@PatchMapping("/alarm/receive")
public void patchAlarmReceive() {
updateAlarmReceiveUseCase.execute();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package tify.server.api.user.service;


import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
import tify.server.api.config.security.SecurityUtils;
import tify.server.core.annotation.UseCase;
import tify.server.domain.domains.user.adaptor.UserAdaptor;
import tify.server.domain.domains.user.domain.User;

@UseCase
@RequiredArgsConstructor
public class UpdateAlarmReceiveUseCase {

private final UserAdaptor userAdaptor;

@Transactional
public void execute() {
User currentUser = userAdaptor.query(SecurityUtils.getCurrentUserId());
currentUser.updateUserReceiveAlarm();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public User(OauthInfo oauthInfo) {
this.oauthInfo = oauthInfo;
}

// TODO : 온보딩 시 푸시알림 true / false 선택 가능하도록
public void onBoarding(
String username,
String userId,
Expand Down Expand Up @@ -125,4 +126,8 @@ public void updateOnBoardingStatus(UserOnBoardingStatus userOnBoardingStatus) {
public void updateUserExpoToken(String expoToken) {
this.expoToken = expoToken;
}

public void updateUserReceiveAlarm() {
this.receiveAlarm = !this.receiveAlarm;
}
}

0 comments on commit 604ced8

Please sign in to comment.