Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…kend into feture/test-oauth
  • Loading branch information
Astin01 committed Oct 16, 2024
2 parents 4536d1a + f92ac88 commit e67f8bb
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,15 @@ private void checkUserStatus(User user) {
}
}

private void saveToken(KakaoTokenResponse tokenResponse, User user) {
Token token = Token.builder()
.user(user)
.oauthToken(tokenResponse.getRefreshToken())
.build();

tokenRepository.save(token);
}

private User saveGoogleUser(GoogleUserResponse response) {
String imageUrl = getGoogleUserImage(response);
UserImage savedUserImage = userImageService.saveUserImage(imageUrl);
Expand Down Expand Up @@ -337,7 +346,6 @@ private void deleteCookie(String name, String value, HttpServletResponse respons
response.addCookie(cookie);
}


public void revokeToken(String type, String token) throws IOException {
HttpStatusCode responseCode;
switch (type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ public void updateDiary(Long userId, Long diaryId, DiaryUpdateRequest request) {
}

private void updateDiary(Long diaryId, DiaryUpdateRequest request) {
Diary diary = diaryRepository.findById(diaryId).orElseThrow(() -> new DiaryNotExistsException("해당 일기가 존재하지 않습니다."));
Diary diary = diaryRepository.findById(diaryId)
.orElseThrow(() -> new DiaryNotExistsException("해당 일기가 존재하지 않습니다."));
deleteDiaryImage(request);
diary.getDiaryDayContent().clear();
diary.updateDiary(request);
Expand All @@ -103,7 +104,7 @@ private void updateDiary(Long diaryId, DiaryUpdateRequest request) {

private void saveDiaryDayContent(Diary savedDiary, DiaryCreateRequest request) {
for (DiaryDayRequest dayRequest : request.getDiaryDayRequests()) {
s3Uploader.markImagePermanent(dayRequest.getDiaryDayContentImages());
makeDiaryImagePermanent(dayRequest.getDiaryDayContentImages());
DiaryDayContent diaryDayContent = DiaryDayContent.builder()
.diary(savedDiary)
.content(dayRequest.getContent())
Expand All @@ -115,6 +116,15 @@ private void saveDiaryDayContent(Diary savedDiary, DiaryCreateRequest request) {
}
}

private void makeDiaryImagePermanent(String diaryDayContentImages) {
if (!diaryDayContentImages.isEmpty()) {
String[] contentImages = diaryDayContentImages.split(",");
for (String contentImage : contentImages) {
s3Uploader.markImagePermanent(contentImage);
}
}
}

private void updateDiaryDayContent(Diary savedDiary, DiaryUpdateRequest request) {
diaryDayContentRepository.deleteById(savedDiary.getId());
for (DiaryUpdateDayRequest dayRequest : request.getDiaryDayRequests()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;

@Getter
@AllArgsConstructor
@ToString
public class InformationBriefResponse {

private Long informationId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
public interface InformationRepositoryCustom {
String LIKE_COUNT_SORT = "likes";
String VIEW_COUNT_SORT = "views";

Page<InformationBriefResponse> getInformationPageFilterAndOrder(Pageable pageable,
InformationPageRequest informationPageRequest,
Long userId, Long parentCategoryId);
Page<InformationBriefResponse> getPageInformationFilterAndOrder(Pageable pageable, InformationPageRequest informationPageRequest, Long userId, Long parentCategoryId);

List<InformationRankResponse> getInformationRank();

Expand Down
Loading

0 comments on commit e67f8bb

Please sign in to comment.