-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
106 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...va/com/wable/www/WableServer/api/notification/service/InfoNotificationCommandService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.wable.www.WableServer.api.notification.service; | ||
|
||
import com.wable.www.WableServer.api.member.domain.Member; | ||
import com.wable.www.WableServer.api.member.repository.MemberRepository; | ||
import com.wable.www.WableServer.api.notification.domain.InfoNotification; | ||
import com.wable.www.WableServer.api.notification.domain.InfoNotificationType; | ||
import com.wable.www.WableServer.api.notification.domain.Notification; | ||
import com.wable.www.WableServer.api.notification.repository.InfoNotificationRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.List; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional | ||
public class InfoNotificationCommandService { | ||
private final MemberRepository memberRepository; | ||
private final InfoNotificationRepository infoNotificationRepository; | ||
|
||
public void postGameStartInfoNotification() { | ||
List<Member> members = memberRepository.findAllActiveMembers(); | ||
|
||
for (Member member : members) { | ||
InfoNotification gameStartInfoNotification = InfoNotification.builder() | ||
.infoNotificationTargetMember(member) | ||
.infoNotificationType(InfoNotificationType.GAMESTART) | ||
.build(); | ||
infoNotificationRepository.save(gameStartInfoNotification); | ||
} | ||
} | ||
|
||
public void postGameDoneInfoNotification() { | ||
List<Member> members = memberRepository.findAllActiveMembers(); | ||
|
||
for (Member member : members) { | ||
InfoNotification gameDoneInfoNotification = InfoNotification.builder() | ||
.infoNotificationTargetMember(member) | ||
.infoNotificationType(InfoNotificationType.GAMEDONE) | ||
.build(); | ||
infoNotificationRepository.save(gameDoneInfoNotification); | ||
} | ||
} | ||
|
||
public void postWeekDoneInfoNotification() { | ||
List<Member> members = memberRepository.findAllActiveMembers(); | ||
|
||
for (Member member : members) { | ||
InfoNotification weekDoneInfoNotification = InfoNotification.builder() | ||
.infoNotificationTargetMember(member) | ||
.infoNotificationType(InfoNotificationType.WEEKDONE) | ||
.build(); | ||
infoNotificationRepository.save(weekDoneInfoNotification); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters