Skip to content

Commit

Permalink
fix : update_SevenDays Method add to Transactional
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonSangWon committed Oct 22, 2023
1 parent 4fdf014 commit 610b4c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/java/mega/waka/discord/DiscordListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,22 @@
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.events.session.ReadyEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;

import java.awt.*;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.format.TextStyle;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
import java.util.List;
Expand All @@ -38,6 +48,7 @@ public DiscordListener(MemberRepository memberRepository, SevenDaysWakaService s
public void onSlashCommandInteraction(SlashCommandInteractionEvent event) {
if(!event.getChannel().getId().equals("1090659127417638943")) return;
super.onSlashCommandInteraction(event);
sevenDaysWakaService.update_SevenDays();
User user = event.getUser();
String returnMessage = "";
String newMessage = "!!!!!***근무 시간 미달자 ***!!!! \n";
Expand Down Expand Up @@ -216,5 +227,4 @@ else if(sortedList.get(i).getValue() > 10*60)
TimeUnit.SECONDS);
}


}
2 changes: 2 additions & 0 deletions src/main/java/mega/waka/service/SevenDaysWakaService.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;

Expand Down Expand Up @@ -45,6 +46,7 @@ public SevenDaysWakaService(SevenDaysEditorRepository sevenDaysEditorRepository,
this.sevendaysProjectRepository = sevendaysProjectRepository;
this.memberRepository = memberRepository;
}
@Transactional
@JsonIgnore
public void update_SevenDays(){
List<Member> members = memberRepository.findAll();
Expand Down

0 comments on commit 610b4c7

Please sign in to comment.