Skip to content

Commit

Permalink
Merge pull request #43 from Central-MakeUs/fix/cycleDepend
Browse files Browse the repository at this point in the history
fix: cycle refactor 및 팝콘작 불러오기
  • Loading branch information
AlmondBreez3 authored Feb 17, 2024
2 parents a5c29ff + fabea75 commit 5e522ad
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Core/src/main/java/com/example/adaptor/ValidEnum.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.adaptor;

import com.example.validator.EnumValidator;
import com.example.adaptor.validator.EnumValidator;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.validator;
package com.example.adaptor.validator;

import com.example.adaptor.ValidEnum;
import jakarta.validation.ConstraintValidator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class DiverseMovieSchedule {
private final DiverseMovieService diverseMovieService;
//매 주 월요일 0시 0분에 실행되도록 cron 설정
@Scheduled(cron = "0 0 1 * * WED")
@Scheduled(cron = "0 0 1 * * SUN")
public void scheduledMethod() {
// 수요일에 실행될 로직을 여기에 작성
diverseMovieService.getTopRated();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public List<Popcorn> findLastWeekPopcorns() {
return jpaQueryFactory
.selectFrom(popcorn)
.orderBy(
popcorn.recommendationCount.desc(),
popcorn.createdAt.desc()
)
.limit(3)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.example.domains.common;
package com.example.domains.screening.schedule;

import com.example.domains.screening.adaptor.ScreeningAdaptor;
import com.example.domains.user.repository.UserRepository;
import com.example.domains.userscreening.adaptor.UserScreeningAdaptor;
import com.example.domains.userscreening.entity.UserScreening;
import com.example.fcm.adaptor.FcmTokenAdaptor;
Expand All @@ -23,10 +21,7 @@ public class ScheduleService {
private final FcmService fcmService;

private final UserScreeningAdaptor userScreeningAdaptor;
private final ScreeningAdaptor screeningAdaptor;
private final UserRepository userRepository;
private final FcmRepository fcmRepository;
private final FcmTokenAdaptor fcmTokenAdaptor;

private static final String NOTIFICATION_TITLE = "상영회 하루 전 알림";
// @Scheduled(cron = "0 0/1 * * * *")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.example.domains.user.enums.*;
import com.example.domains.user.exception.exceptions.AlreadyDeletedUserException;
import com.example.error.exception.ServerForbiddenException;
import com.example.fcm.entity.FCMToken;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import lombok.AccessLevel;
Expand Down Expand Up @@ -52,12 +51,8 @@ public class User extends BaseTimeEntity {

private int profileImgNum;

// private String phoneNumber;
private String appleEmail;

@OneToOne(mappedBy = "user")
private FCMToken fcmToken;

private boolean marketingAgreement;

@Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,4 @@ public class FcmTokenAdaptor {
public void execute(Long userId) {
fcmRepository.deleteByUserId(userId);
}

@Transactional
public boolean findByUserId(Long userId) {
return fcmRepository.existsByUserId(userId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ public interface FcmRepository extends JpaRepository<FCMToken, Long> {


void deleteByUserId(Long userId);

boolean existsByUserId(Long userId);
}
4 changes: 2 additions & 2 deletions Domain/src/main/java/com/example/fcm/service/FcmService.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public void registerFCMToken(Long userId, FcmRegistrationRequest request) {

public void sendMessageByToken(NotificationRequest request) {
User user = userRepository.findById(request.getUserId()).orElseThrow(IllegalArgumentException::new);

String fcmToken = user.getFcmToken().getFcmToken();
FCMToken fcm = fcmRepository.findByUserId(user.getId()).get();
String fcmToken = fcm.getFcmToken();
if (!fcmToken.isEmpty()) {
Message message = getMessage(request, fcmToken);

Expand Down

0 comments on commit 5e522ad

Please sign in to comment.