Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
13f88a5
feat : 충돌 해결
Choon0414 Mar 12, 2024
dedbe1b
chore : develop 병합
Choon0414 Mar 12, 2024
3c7d70c
chore : VersionException 제거
Choon0414 Mar 12, 2024
303a6a1
chore : SnakeCaseStrategy import static 수정
Choon0414 Mar 12, 2024
f734327
refactor : 엔티티 id int -> Long 수정
Choon0414 Mar 12, 2024
31cf14b
feat : 사장님 식당 생성, 특정 상점 조회 API구현 (#199)
20HyeonsuLee Mar 14, 2024
3cc8587
Merge branch 'develop' of https://github.com/BCSDLab/KOIN_API_V2 into…
Choon0414 Mar 14, 2024
2f1fa83
feat : 커스텀 예외처리 추가
Choon0414 Mar 15, 2024
428a386
feat : Dining created_at, updated_at 추가
Choon0414 Mar 16, 2024
580b293
chore : 충돌 해결
Choon0414 Mar 16, 2024
4288f72
chore : 테스트 정보 수정
Choon0414 Mar 16, 2024
daa0a87
chore : 파라미터 설명 추가
Choon0414 Mar 18, 2024
71d1181
refactor : menu String -> List 수정
Choon0414 Mar 18, 2024
be02581
fix : 테이블명 수정
Choon0414 Mar 18, 2024
046bd0b
refactor : 현재시간에 대한 테스트를 위해 clock 모킹 추가
Choon0414 Mar 18, 2024
a6f65cd
remove : 사용하지 않는 예외 삭제
Choon0414 Mar 18, 2024
2daff5c
chore : 테스트코드 public 제외, 불필요한 공백 삭제
Choon0414 Mar 19, 2024
523bfab
Merge branch 'develop' of https://github.com/BCSDLab/KOIN_API_V2 into…
Choon0414 Mar 20, 2024
ea9c557
Merge branch 'develop' of https://github.com/BCSDLab/KOIN_API_V2 into…
Choon0414 Mar 20, 2024
3a58504
Merge branch 'develop' of https://github.com/BCSDLab/KOIN_API_V2 into…
Choon0414 Mar 22, 2024
6a18293
feat : 영양사 컨트롤러, 서비스 구현
Choon0414 Mar 25, 2024
c75f8d0
feat : 식단 이미지 변수 추가
Choon0414 Mar 25, 2024
d20de00
feat : 영양사 권한 및 영양사 도메인 enum 추가
Choon0414 Mar 25, 2024
55a48c6
feat : image 컬럼 추가
Choon0414 Mar 25, 2024
d2d5d7c
feat : Image 업로드 요청 DTO 생성
Choon0414 Mar 25, 2024
8fb3bc0
feat : 영양사님의 사진 업로드 테스트 추가
Choon0414 Mar 25, 2024
03a6f43
feat : 특정 식단의 이미지 업데이트 쿼리 추가
Choon0414 Mar 25, 2024
5672517
feat : 쿼리문 수정
Choon0414 Mar 25, 2024
406b93d
chore : log 제거
Choon0414 Mar 25, 2024
9ad10b1
refactor : coop Api 분리
Choon0414 Mar 26, 2024
8b74c78
refactor : image_url로 변수명 수정
Choon0414 Mar 26, 2024
3eabfaf
refactor : image_url로 변수명 수정
Choon0414 Mar 26, 2024
95cad19
chore : menuId로 변수명 구체화
Choon0414 Mar 26, 2024
1987bce
chore : V$ -> V3 버전 수정
Choon0414 Mar 26, 2024
e81b35b
remove : repository 계층 트랜잭션 제거(service 계층 처리)
Choon0414 Mar 26, 2024
bbe52f2
feat : 허용되지 않은 권한에 대한 테스트 추가
Choon0414 Mar 26, 2024
909fafd
refactor : update 수정(setter 이용)
Choon0414 Mar 26, 2024
42f0033
refactor : 테스트 - 허용되지않은 권한 수정
Choon0414 Mar 26, 2024
bb82498
Merge branch 'develop' into feature/221-coop-dining-image
Choon0414 Mar 26, 2024
8646c50
refactor : getById() 추가
Choon0414 Mar 26, 2024
693a204
chore : Optional 검증을 위해 findById() -> getById() 수정
Choon0414 Mar 26, 2024
6ca404f
remove() : DynamicUpdate 제거
Choon0414 Mar 26, 2024
daf97a6
Merge branch 'develop' into feature/221-coop-dining-image
Choon0414 Mar 26, 2024
9606015
chore : 충돌 해결
Choon0414 Mar 26, 2024
38ab3be
chore : 파일 위치 수정
Choon0414 Mar 27, 2024
928a201
Merge branch 'develop' of https://github.com/BCSDLab/KOIN_API_V2 into…
Choon0414 Mar 28, 2024
9811650
Merge branch 'develop' of https://github.com/BCSDLab/KOIN_API_V2 into…
Choon0414 Mar 28, 2024
3efa0b1
Merge branch 'develop' of https://github.com/BCSDLab/KOIN_API_V2 into…
Choon0414 Mar 29, 2024
cb27ab5
feat : 알림 구독 엔티티 생성
Choon0414 Mar 29, 2024
f01308f
feat: flyway 테이블 추가
songsunkook Mar 29, 2024
2c3cb2a
feat: API 형태 추가
songsunkook Mar 29, 2024
7eead1c
feat: 알림구독 추가, 삭제 컨트롤러 작성
Mar 29, 2024
1f74b0f
feat: 레포지토리 추가중..
Mar 29, 2024
4ccf6eb
feat : delete api 수정
Choon0414 Mar 29, 2024
f35b886
feat: post 수정 중 ..
songsunkook Mar 29, 2024
d0936d0
feat: GET 요청 반환값 만들기
Choi-JJunho Mar 29, 2024
f787b24
feat: 안정화
Mar 29, 2024
4dd1e24
feat: notification 팩토리 추가
Mar 29, 2024
81d97f5
feat: getNotification 테스트코드 작성중
Mar 29, 2024
15440d6
test: 테스트 작성 중..
songsunkook Mar 29, 2024
5dd41de
feat: getNotification 테스트코드 작성완료
Mar 29, 2024
496fa86
feat: 스네이크케이스로 변경 후 디바이스토큰 추가 테스트코드 작성
Mar 29, 2024
a7161ca
feat: post반환값 수정
Mar 29, 2024
a76a375
feat : deleteNotification 테스트 코드 추가
Choon0414 Mar 29, 2024
15f15bc
feat : NotificationApiTest 완성
Choon0414 Mar 30, 2024
f4f0e74
remove : 알림 구독 관련 테스트 제거
Choon0414 Mar 30, 2024
18eb20f
fix: 상속 받는 예외 클래스 수정
Choon0414 Mar 31, 2024
d6bf1a7
fix: BIGINT -> UNSIGNED INT 수정
Choon0414 Mar 31, 2024
7f91986
chore: 충돌 해결
Choon0414 Mar 31, 2024
23ce144
test: koinAppUrl 추가
Choi-JJunho Apr 1, 2024
ce72737
style: 라인포맷팅
Choi-JJunho Apr 1, 2024
6079900
test: .log().all() 제거
Choi-JJunho Apr 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package in.koreatech.koin.domain.user.controller;

import static in.koreatech.koin.domain.user.model.UserType.OWNER;
import static in.koreatech.koin.domain.user.model.UserType.STUDENT;

import org.springframework.http.ResponseEntity;
Expand All @@ -13,8 +12,6 @@

import in.koreatech.koin.domain.user.dto.EmailCheckExistsRequest;
import in.koreatech.koin.domain.user.dto.NicknameCheckExistsRequest;
import in.koreatech.koin.domain.user.dto.NotificationPermitRequest;
import in.koreatech.koin.domain.user.dto.NotificationStatusResponse;
import in.koreatech.koin.domain.user.dto.StudentResponse;
import in.koreatech.koin.domain.user.dto.StudentUpdateRequest;
import in.koreatech.koin.domain.user.dto.StudentUpdateResponse;
Expand Down Expand Up @@ -142,52 +139,6 @@ ResponseEntity<Void> checkUserEmailExist(
@Valid EmailCheckExistsRequest request
);

@ApiResponses(
value = {
@ApiResponse(responseCode = "200"),
@ApiResponse(responseCode = "400", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "401", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "403", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "404", content = @Content(schema = @Schema(hidden = true))),
}
)
@Operation(summary = "푸쉬알림 동의 여부 조회")
@GetMapping("/user/notification")
ResponseEntity<NotificationStatusResponse> checkNotificationStatus(
@Auth(permit = {STUDENT, OWNER}) Long memberId
);

@ApiResponses(
value = {
@ApiResponse(responseCode = "200"),
@ApiResponse(responseCode = "400"),
@ApiResponse(responseCode = "401"),
@ApiResponse(responseCode = "403"),
@ApiResponse(responseCode = "404"),
}
)
@Operation(summary = "푸쉬알림 동의")
@PostMapping("/user/notification")
ResponseEntity<Void> permitNotification(
@Auth(permit = {STUDENT, OWNER}) Long memberId,
@Valid @RequestBody NotificationPermitRequest request
);

@ApiResponses(
value = {
@ApiResponse(responseCode = "200"),
@ApiResponse(responseCode = "400"),
@ApiResponse(responseCode = "401"),
@ApiResponse(responseCode = "403"),
@ApiResponse(responseCode = "404"),
}
)
@Operation(summary = "푸쉬알림 거절")
@DeleteMapping("/user/notification")
ResponseEntity<Void> rejectNotification(
@Auth(permit = {STUDENT, OWNER}) Long memberId
);

@ApiResponses(
value = {
@ApiResponse(responseCode = "200"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,9 @@
import in.koreatech.koin.domain.user.dto.UserLoginResponse;
import in.koreatech.koin.domain.user.dto.UserTokenRefreshRequest;
import in.koreatech.koin.domain.user.dto.UserTokenRefreshResponse;

import static in.koreatech.koin.domain.user.model.UserType.OWNER;
import static in.koreatech.koin.domain.user.model.UserType.STUDENT;
import in.koreatech.koin.domain.user.service.StudentService;
import in.koreatech.koin.domain.user.service.UserService;
import in.koreatech.koin.global.auth.Auth;
import in.koreatech.koin.domain.user.dto.NotificationPermitRequest;
import in.koreatech.koin.domain.user.dto.NotificationStatusResponse;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;

Expand Down Expand Up @@ -105,28 +100,4 @@ public ResponseEntity<Void> checkDuplicationOfNickname(
userService.checkUserNickname(request);
return ResponseEntity.ok().build();
}

@GetMapping("/user/notification")
public ResponseEntity<NotificationStatusResponse> checkNotificationStatus(
@Auth(permit = {STUDENT, OWNER}) Long memberId
) {
return ResponseEntity.ok(userService.checkNotification(memberId));
}

@PostMapping("/user/notification")
public ResponseEntity<Void> permitNotification(
@Auth(permit = {STUDENT, OWNER}) Long memberId,
@Valid @RequestBody NotificationPermitRequest request
) {
userService.permitNotification(memberId, request.deviceToken());
return ResponseEntity.ok().build();
}

@DeleteMapping("/user/notification")
public ResponseEntity<Void> rejectNotification(
@Auth(permit = {STUDENT, OWNER}) Long memberId
) {
userService.rejectNotification(memberId);
return ResponseEntity.ok().build();
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import in.koreatech.koin.domain.user.dto.EmailCheckExistsRequest;
import in.koreatech.koin.domain.user.dto.NicknameCheckExistsRequest;
import in.koreatech.koin.domain.user.dto.NotificationStatusResponse;
import in.koreatech.koin.domain.user.dto.UserLoginRequest;
import in.koreatech.koin.domain.user.dto.UserLoginResponse;
import in.koreatech.koin.domain.user.dto.UserTokenRefreshRequest;
Expand Down Expand Up @@ -93,21 +92,4 @@ public void checkUserNickname(NicknameCheckExistsRequest request) {
throw DuplicationEmailException.withDetail("nickname: " + request.nickname());
});
}

public NotificationStatusResponse checkNotification(Long userId) {
User user = userRepository.getById(userId);
return new NotificationStatusResponse(user.getDeviceToken() != null);
}

@Transactional
public void permitNotification(Long userId, String deviceToken) {
User user = userRepository.getById(userId);
user.permitNotification(deviceToken);
}

@Transactional
public void rejectNotification(Long userId) {
User user = userRepository.getById(userId);
user.rejectNotification();
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package in.koreatech.koin.global.domain.notification.controller;

import static in.koreatech.koin.domain.user.model.UserType.COOP;
import static in.koreatech.koin.domain.user.model.UserType.OWNER;
import static in.koreatech.koin.domain.user.model.UserType.STUDENT;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import in.koreatech.koin.global.auth.Auth;
import in.koreatech.koin.global.domain.notification.model.NotificationSubscribeType;
import in.koreatech.koin.global.domain.notification.dto.NotificationPermitRequest;
import in.koreatech.koin.global.domain.notification.dto.NotificationStatusResponse;
import in.koreatech.koin.global.domain.notification.dto.NotificationSubscribePermitRequest;
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;

@Tag(name = "(Normal) Notification: 알림", description = "알림 관련 API")
public interface NotificationApi {

@ApiResponses(
value = {
@ApiResponse(responseCode = "200"),
@ApiResponse(responseCode = "400", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "401", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "403", content = @Content(schema = @Schema(hidden = true))),
@ApiResponse(responseCode = "404", content = @Content(schema = @Schema(hidden = true))),
}
)
@Operation(summary = "푸쉬알림 동의 여부 조회")
@GetMapping("/notification")
ResponseEntity<NotificationStatusResponse> checkNotificationStatus(
@Auth(permit = {STUDENT, OWNER, COOP}) Long userId
);

@ApiResponses(
value = {
@ApiResponse(responseCode = "201"),
@ApiResponse(responseCode = "400"),
@ApiResponse(responseCode = "401"),
@ApiResponse(responseCode = "403"),
@ApiResponse(responseCode = "404"),
}
)
@Operation(summary = "푸쉬알림 동의")
@PostMapping("/notification")
ResponseEntity<Void> permitNotification(
@Auth(permit = {STUDENT, OWNER, COOP}) Long userId,
@Valid @RequestBody NotificationPermitRequest request
);

@ApiResponses(
value = {
@ApiResponse(responseCode = "201"),
@ApiResponse(responseCode = "400"),
@ApiResponse(responseCode = "401"),
@ApiResponse(responseCode = "403"),
@ApiResponse(responseCode = "404"),
}
)
@Operation(summary = "특정 푸쉬알림 구독")
@PostMapping("/notification/subscribe")
ResponseEntity<Void> permitNotificationSubscribe(
@Auth(permit = {STUDENT, OWNER, COOP}) Long userId,
@Valid @RequestBody NotificationSubscribePermitRequest request
);

@ApiResponses(
value = {
@ApiResponse(responseCode = "204"),
@ApiResponse(responseCode = "400"),
@ApiResponse(responseCode = "401"),
@ApiResponse(responseCode = "403"),
@ApiResponse(responseCode = "404"),
}
)
@Operation(summary = "푸쉬알림 거절")
@DeleteMapping("/notification")
ResponseEntity<Void> rejectNotification(
@Auth(permit = {STUDENT, OWNER, COOP}) Long userId
);

@ApiResponses(
value = {
@ApiResponse(responseCode = "204"),
@ApiResponse(responseCode = "400"),
@ApiResponse(responseCode = "401"),
@ApiResponse(responseCode = "403"),
@ApiResponse(responseCode = "404"),
}
)
@Operation(summary = "특정 푸쉬알림 구독 취소")
@DeleteMapping("/notification/subscribe")
ResponseEntity<Void> rejectNotificationSubscribe(
@Auth(permit = {STUDENT, OWNER, COOP}) Long userId,
@Valid @ModelAttribute("type") NotificationSubscribeType notificationSubscribeType
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package in.koreatech.koin.global.domain.notification.controller;

import static in.koreatech.koin.domain.user.model.UserType.COOP;
import static in.koreatech.koin.domain.user.model.UserType.OWNER;
import static in.koreatech.koin.domain.user.model.UserType.STUDENT;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import in.koreatech.koin.global.auth.Auth;
import in.koreatech.koin.global.domain.notification.service.NotificationService;
import in.koreatech.koin.global.domain.notification.model.NotificationSubscribeType;
import in.koreatech.koin.global.domain.notification.dto.NotificationPermitRequest;
import in.koreatech.koin.global.domain.notification.dto.NotificationStatusResponse;
import in.koreatech.koin.global.domain.notification.dto.NotificationSubscribePermitRequest;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;

@RestController
@RequiredArgsConstructor
public class NotificationController implements NotificationApi {

private final NotificationService notificationService;

@GetMapping("/notification")
public ResponseEntity<NotificationStatusResponse> checkNotificationStatus(
@Auth(permit = {STUDENT, OWNER, COOP}) Long userId
) {
return ResponseEntity.ok(notificationService.checkNotification(userId));
}

@PostMapping("/notification")
public ResponseEntity<Void> permitNotification(
@Auth(permit = {STUDENT, OWNER, COOP}) Long userId,
@Valid @RequestBody NotificationPermitRequest request
) {
notificationService.permitNotification(userId, request.deviceToken());
return ResponseEntity.status(HttpStatus.CREATED).build();
}

@PostMapping("/notification/subscribe")
public ResponseEntity<Void> permitNotificationSubscribe(
@Auth(permit = {STUDENT, OWNER, COOP}) Long userId,
@Valid @RequestBody NotificationSubscribePermitRequest subscribePermitRequest
) {
notificationService.permitNotificationSubscribe(userId, subscribePermitRequest);
return ResponseEntity.status(HttpStatus.CREATED).build();
}

@DeleteMapping("/notification")
public ResponseEntity<Void> rejectNotification(
@Auth(permit = {STUDENT, OWNER, COOP}) Long userId
) {
notificationService.rejectNotification(userId);
return ResponseEntity.noContent().build();
}

@DeleteMapping("/notification/subscribe")
public ResponseEntity<Void> rejectNotificationSubscribe(
@Auth(permit = {STUDENT, OWNER, COOP}) Long userId,
@Valid @ModelAttribute("type") NotificationSubscribeType notificationSubscribeType
) {
notificationService.rejectNotificationByType(userId, notificationSubscribeType);
return ResponseEntity.noContent().build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package in.koreatech.koin.global.domain.notification.dto;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;


@JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class)
public record NotificationPermitRequest(
@Schema(description = "FCM 디바이스 토큰")
@NotBlank String deviceToken
) {

}
Loading