Skip to content

Commit

Permalink
[hotfix] CI 실패 해결 (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinkonu committed Jul 29, 2024
1 parent c7cb927 commit 05ab0bf
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,4 @@ public Optional<Long> findMaxId() {
public Long count() {
return recordJpaRepository.count();
}

@Override
public void deleteByUserId(long userId) {
uploadJpaRepository.deleteAllByRecordUserId(userId);
recordJpaRepository.deleteAllByUserId(userId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ public class RecordServiceImpl implements RecordService {
private final RecordRepository recordRepository;
private final ViewRepository viewRepository;
private final BookmarkRepository bookmarkRepository;
private final FileService fileService;
private final UserRepository userRepository;

@Override
public Record create(RecordCreate recordCreate, File file) {
FileUrl fileUrl = fileService.save(file);
public Record create(RecordCreate recordCreate) {
User user = userRepository.findById(recordCreate.uploaderId())
.orElseThrow(() -> new UserException(ErrorMessage.USER_NOT_FOUND));

Expand Down
3 changes: 1 addition & 2 deletions src/test/java/org/recordy/server/mock/FakeContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,8 @@ public FakeContainer() {
this.userService = new UserServiceImpl(userRepository, subscribeRepository, recordRepository, bookmarkRepository,viewRepository, authService, authTokenService);

this.keywordService = new KeywordServiceImpl(keywordRepository);
this.recordService = new RecordServiceImpl(recordRepository, viewRepository, fileService, userRepository);
this.recordService = new RecordServiceImpl(recordRepository, viewRepository, bookmarkRepository, userRepository);
this.bookmarkService = new BookmarkServiceImpl(userRepository, recordRepository, bookmarkRepository);
this.recordService = new RecordServiceImpl(recordRepository, viewRepository, bookmarkRepository, userService);
this.subscribeService = new SubscribeServiceImpl(subscribeRepository, userRepository);
this.s3Service = mock(S3Service.class); // S3Service mock 사용

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ public void delete(long subscribingUserId, long subscribedUserId) {
);
}

@Override
public void deleteByUserId(long userId) {
subscribes.values()
.removeIf(subscribe ->
subscribe.getSubscribingUser().getId() == userId ||
subscribe.getSubscribedUser().getId() == userId
);
}

@Override
public Slice<Subscribe> findAllBySubscribingUserId(long subscribingUserId, long cursor, Pageable pageable) {
List<Subscribe> content = subscribes.values().stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,10 @@ public View save(View view) {
viewEntities.put(autoIncrementId++, realView);
return view;
}

@Override
public void deleteByUserId(long userId) {
viewEntities.values()
.removeIf(view -> view.getUser().getId() == userId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.recordy.server.bookmark.domain.Bookmark;
import org.recordy.server.bookmark.service.BookmarkService;
import org.recordy.server.mock.FakeContainer;
import org.recordy.server.record.domain.Record;
Expand Down Expand Up @@ -75,7 +76,7 @@ void init() {
bookmarkService.bookmark(2, 3);

// when
Slice<Record> result = recordService.getBookmarkedRecords(1, 7, 10);
Slice<Bookmark> result = recordService.getBookmarkedRecords(1, 7, 10);

// then
assertAll(
Expand All @@ -98,7 +99,7 @@ void init() {
bookmarkService.bookmark(2, 3);

// when
Slice<Record> result = recordService.getBookmarkedRecords(1, 1, 10);
Slice<Bookmark> result = recordService.getBookmarkedRecords(1, 1, 10);

// then
assertAll(
Expand Down

0 comments on commit 05ab0bf

Please sign in to comment.