-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStickerReader.java
29 lines (24 loc) · 1000 Bytes
/
StickerReader.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.dilly.gift.adaptor;
import com.dilly.exception.EntityNotFoundException;
import com.dilly.exception.ErrorCode;
import com.dilly.gift.dao.StickerRepository;
import com.dilly.gift.dao.querydsl.StickerQueryRepository;
import com.dilly.gift.domain.sticker.Sticker;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
public class StickerReader {
private final StickerRepository stickerRepository;
private final StickerQueryRepository stickerQueryRepository;
public Slice<Sticker> searchBySlice(Long lastSequence, Pageable pageable) {
return stickerQueryRepository.searchBySlice(lastSequence, pageable);
}
public Sticker findById(Long id) {
return stickerRepository.findById(id).orElseThrow(
() -> new EntityNotFoundException(ErrorCode.STICKER_NOT_FOUND)
);
}
}