Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c610ba7
[remove] : 배포 스크립트 삭제
hyun2371 Jun 30, 2025
dfc1af2
[remove] : dummy sql 파일 삭제
hyun2371 Jun 30, 2025
f353875
[remove] : 알림 관련 파일 삭제
hyun2371 Jun 30, 2025
d58baa3
[chore] : application.yml 알림 경로 삭제
hyun2371 Jun 30, 2025
6dbd72e
[chore] : 새 json 파일 gitignore 추가
hyun2371 Jun 30, 2025
c25c866
[feat] : 기존 알림 삭제 반
hyun2371 Jun 30, 2025
3bbe13e
[feat] : 불필요한 엔티티 컬 삭제
hyun2371 Jun 30, 2025
6da6833
[chore] : FCM 설정 추가
hyun2371 Jun 30, 2025
3ca5af8
[feat] : 새 알림 엔티티 추
hyun2371 Jun 30, 2025
0d9cc86
[feat] : FCM 토큰 저장 구
hyun2371 Jun 30, 2025
a40c94f
[feat] : 입찰 알림 추
hyun2371 Jun 30, 2025
c38eb13
[chore] : 입찰 알림 테스트 위한 Http test 파일 추가
hyun2371 Jun 30, 2025
22b794b
[refactor] : 타입에 따른 메시지 생성 enum에 책임 위임
hyun2371 Jun 30, 2025
1f25270
[feat] : 알림 저장 로직 추가
hyun2371 Jun 30, 2025
b68a989
[refactor] : 알림 저장 호출 NotificationSender에 위
hyun2371 Jun 30, 2025
b38d174
[chore] : http 파일 gitignore 추가
hyun2371 Jun 30, 2025
aad4bc3
[feat] : 알림 생성, 조회 추
hyun2371 Jun 30, 2025
b78dd15
[refactor] : 사용하지 않는 의존성 제거
hyun2371 Jun 30, 2025
d42bc53
[feat] : 로그아웃 시 fcm 토큰 삭제
hyun2371 Jun 30, 2025
ef47ef6
[chore] : FirebaseApp 중복 생성 방지
hyun2371 Jun 30, 2025
7cdf0d6
[feat] : fcm token ttl 부여
hyun2371 Jun 30, 2025
74c6349
[chore] : ci 스크립트 firebase 경로 수정
hyun2371 Jun 30, 2025
6ed0f6f
[chore] : ci 스크립트 임시 trigger 추가
hyun2371 Jun 30, 2025
2e21e0c
[style] : 코드 리포멧
hyun2371 Jun 30, 2025
c9a0a9f
[chore] : ci 스크립트 임시 트리거 삭제
hyun2371 Jun 30, 2025
314e8b6
[fix] : 임시로 파일명 변
hyun2371 Jun 30, 2025
dbf7f92
[fix] : 임시로 파일명 변경
hyun2371 Jun 30, 2025
ff069f6
[fix] : 파일명 원복
hyun2371 Jun 30, 2025
ba98826
[remove] : 불필요한 json 파일 gitignore에서 삭제
hyun2371 Jun 30, 2025
94af207
[fix] : test 경로에 json 파일 추
hyun2371 Jun 30, 2025
14fe3be
[fix] : 설정 원
hyun2371 Jun 30, 2025
2d190f0
[chore] : json 파일 존재여부 확인
hyun2371 Jun 30, 2025
0c3a441
[chore] : json 존재여부확인
hyun2371 Jun 30, 2025
9828827
[chore] : 디코딩 추가
hyun2371 Jun 30, 2025
d9f9131
[chore] : 테스트 경로에 json생성
hyun2371 Jun 30, 2025
753db17
[chore] : 시크릿키명 제대로 입력
hyun2371 Jun 30, 2025
22823a0
[chore] : test 경로에 꼭 필요한지 확인
hyun2371 Jun 30, 2025
3ef9f24
[chore] : test 경로에 꼭 json 필요한지 확인
hyun2371 Jun 30, 2025
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
83 changes: 0 additions & 83 deletions .github/workflows/cd.yml

This file was deleted.

16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI Backend

on:
pull_request:
branches: ["main", "dev"]
branches: [ "main", "dev" ]

permissions:
contents: read
Expand All @@ -27,16 +27,16 @@ jobs:
distribution: 'temurin'

# firebase json 파일 생성
- name : Generate firebase_account.json
- name: Generate serviceAccountKey.json
run: |
mkdir -p ./core/src/main/resources/firebase
echo "${{ secrets.FIREBASE_ACCOUNT }}" | base64 -d > ./core/src/main/resources/firebase/firebase_account.json
mkdir -p ./core/src/test/resources/firebase
echo "${{ secrets.FIREBASE_ACCOUNT }}" | base64 -d > ./core/src/test/resources/firebase/firebase_account.json
mkdir -p ./api/src/test/resources/firebase
echo "${{ secrets.FIREBASE_ACCOUNT }}" | base64 -d > ./api/src/test/resources/firebase/firebase_account.json
echo "${{ secrets.FIREBASE_KEY }}" | base64 -d > ./core/src/main/resources/firebase/serviceAccountKey.json
# mkdir -p ./core/src/test/resources/firebase
# echo "${{ secrets.FIREBASE_KEY }}" | base64 -d > ./core/src/test/resources/firebase/serviceAccountKey.json
# mkdir -p ./api/src/test/resources/firebase
# echo "${{ secrets.FIREBASE_KEY }}" | base64 -d > ./api/src/test/resources/firebase/serviceAccountKey.json

# gradle 권한 부여
# gradle 권한 부여
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash
Expand Down
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ out/
core/src/main/resources/application-core-prod.yml
/api/src/main/resources/application.yml
/core/src/main/generated/
/core/src/main/resources/firebase/firebase_account.json
/core/src/test/resources/firebase/firebase_account.json
/api/src/test/resources/firebase/firebase_account.json
/core/src/main/resources/application-core-local.yml
/core/src/main/resources/firebase/serviceAccountKey.json
/core/src/test/http
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import dev.handsup.auth.dto.response.TokenReIssueResponse;
import dev.handsup.auth.jwt.JwtAuthorization;
import dev.handsup.auth.service.AuthService;
import dev.handsup.notification.service.FCMService;
import dev.handsup.notification.service.FcmService;
import dev.handsup.user.domain.User;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
Expand All @@ -35,7 +35,7 @@
public class AuthApiController {

private final AuthService authService;
private final FCMService fcmService;
private final FcmService fcmService;

@NoAuth
@PostMapping("/login")
Expand All @@ -60,7 +60,7 @@ public ResponseEntity<LoginSimpleResponse> login(
public ResponseEntity<HttpStatus> logout(
@Parameter(hidden = true) @JwtAuthorization User user
) {
fcmService.deleteFcmToken(user.getEmail());
fcmService.deleteFcmToken(user.getId());
return ResponseEntity.ok(HttpStatus.OK);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package dev.handsup.notification.controller;

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

import dev.handsup.auth.jwt.JwtAuthorization;
import dev.handsup.notification.dto.SaveFcmTokenRequest;
import dev.handsup.notification.service.FcmService;
import dev.handsup.user.domain.User;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;

@RestController
@RequiredArgsConstructor
public class FcmController {
private final FcmService fcmService;

@PostMapping("/api/fcm-tokens")
@Operation(summary = "FCM 토큰 저장 API", description = "{사용자 아이디 : FCM 토큰}을 redis에 저장")
@ApiResponse(useReturnTypeSchema = true)
public ResponseEntity<HttpStatus> saveFCMToken(
@Parameter(hidden = true) @JwtAuthorization User user,
@RequestBody @Valid SaveFcmTokenRequest request
) {
fcmService.saveFcmToken(user.getId(), request.fcmToken());
return ResponseEntity.ok(HttpStatus.OK);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package dev.handsup.notification.controller;

import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import dev.handsup.auth.jwt.JwtAuthorization;
import dev.handsup.common.dto.PageResponse;
import dev.handsup.notification.dto.NotificationResponse;
import dev.handsup.notification.service.NotificationService;
import dev.handsup.user.domain.User;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import lombok.RequiredArgsConstructor;

@RestController
@RequiredArgsConstructor
public class NotificationController {
private final NotificationService notificationService;

@GetMapping("/api/notifications")
@Operation(summary = "알림 전체 조회 API", description = "특정 사용자가 받은 알림을 최근 생성 순으로 전체 조회한다")
@ApiResponse(useReturnTypeSchema = true)
public ResponseEntity<PageResponse<NotificationResponse>> getUserNotifications(
@Parameter(hidden = true) @JwtAuthorization User user,
Pageable pageable
) {
PageResponse<NotificationResponse> response = notificationService.getNotifications(user, pageable);
return ResponseEntity.ok(response);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import dev.handsup.fixture.AuctionFixture;
import dev.handsup.fixture.BiddingFixture;
import dev.handsup.fixture.UserFixture;
import dev.handsup.notification.repository.FCMTokenRepository;
import dev.handsup.user.domain.User;
import dev.handsup.user.repository.UserRepository;

Expand All @@ -56,8 +55,7 @@ class BiddingApiControllerTest extends ApiTestSupport {
private AuctionService auctionService;
@Autowired
private JwtProvider jwtProvider;
@Autowired
private FCMTokenRepository fcmTokenRepository;


@BeforeEach
void setUp() {
Expand Down Expand Up @@ -170,7 +168,6 @@ void getTop3BidsForAuctionTest() throws Exception {
@Test
void completeTrading() throws Exception {
//given
fcmTokenRepository.saveFcmToken(bidder.getEmail(), "fcmToken123");
ReflectionTestUtils.setField(auction1, "status", AuctionStatus.TRADING); //변경 감지
Bidding bidding = BiddingFixture.bidding(bidder, auction1, TradingStatus.PROGRESSING);
biddingRepository.save(bidding);
Expand Down Expand Up @@ -204,7 +201,6 @@ void completeTrading_fails() throws Exception {
@Test
void cancelTrading() throws Exception {
//given
fcmTokenRepository.saveFcmToken(bidder.getEmail(), "fcmToken123");
Bidding waitingBidding1 = BiddingFixture.bidding(bidder, auction1, TradingStatus.WAITING, 200000);
Bidding waitingBidding2 = BiddingFixture.bidding(bidder, auction1, TradingStatus.WAITING, 300000);
Bidding anotherAuctionBidding = BiddingFixture.bidding(bidder, auction2, TradingStatus.WAITING, 400000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import dev.handsup.fixture.AuctionFixture;
import dev.handsup.fixture.BookmarkFixture;
import dev.handsup.fixture.UserFixture;
import dev.handsup.notification.repository.FCMTokenRepository;
import dev.handsup.user.domain.User;

@DisplayName("[Bookmark 통합 테스트]")
Expand All @@ -37,8 +36,7 @@ class BookmarkApiControllerTest extends ApiTestSupport {
private AuctionRepository auctionRepository;
@Autowired
private ProductCategoryRepository productCategoryRepository;
@Autowired
private FCMTokenRepository fcmTokenRepository;


@BeforeEach
void setUp() {
Expand All @@ -54,8 +52,6 @@ void setUp() {
@Test
@DisplayName("[북마크를 추가할 수 있다.]")
void addBookmark() throws Exception {
// fcm 토큰 저장, seller 는 receiver
fcmTokenRepository.saveFcmToken(seller.getEmail(), "fcmToken123");

mockMvc.perform(post("/api/auctions/bookmarks/{auctionId}", auction.getId())
.contentType(APPLICATION_JSON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import dev.handsup.fixture.CommentFixture;
import dev.handsup.fixture.ProductFixture;
import dev.handsup.fixture.UserFixture;
import dev.handsup.notification.repository.FCMTokenRepository;
import dev.handsup.user.domain.User;

@DisplayName("[Comment 통합 테스트]")
Expand All @@ -36,8 +35,7 @@ class CommentApiControllerTest extends ApiTestSupport {
private ProductCategory productCategory;
@Autowired
private CommentRepository commentRepository;
@Autowired
private FCMTokenRepository fcmTokenRepository;


@BeforeEach
void setUp() {
Expand All @@ -50,7 +48,6 @@ void setUp() {
@DisplayName("[댓글을 등록할 수 있다.]")
@Test
void registerComment() throws Exception {
fcmTokenRepository.saveFcmToken(seller.getEmail(), "fcmToken123");
RegisterCommentRequest request = RegisterCommentRequest.of("와");

mockMvc.perform(post("/api/auctions/{auctionId}/comments", auction.getId())
Expand Down
Loading