Compare commits
No commits in common. "bc2b8322a4fd04121a0d0acd7d2e88508e38f169" and "499e3236e8abc7a4ba6098ae7e5a1dfd9b624f88" have entirely different histories.
bc2b8322a4
...
499e3236e8
@ -324,13 +324,12 @@ public class DatabaseController {
|
||||
public String remove_entry(@RequestParam Map<String, String> params) {
|
||||
String section = params.get("section");
|
||||
long entry_id = Long.parseLong(params.get("entry_id"));
|
||||
|
||||
switch (section) {
|
||||
case "agge" -> { bioService.removeById(entry_id); synergyService.removeByEntityId(entry_id, SectionType.AGE); }
|
||||
case "hobb" -> { hobbyService.removeById(entry_id); synergyService.removeByEntityId(entry_id, SectionType.HOBBY); }
|
||||
case "lugg" -> { luggageService.removeById(entry_id); synergyService.removeByEntityId(entry_id, SectionType.LUGGAGE); }
|
||||
case "heal" -> { healthService.removeById(entry_id); synergyService.removeByEntityId(entry_id, SectionType.HEALTH); }
|
||||
case "prof" -> { workService.removeById(entry_id); synergyService.removeByEntityId(entry_id, SectionType.WORK); }
|
||||
case "agge" -> bioService.removeById(entry_id);
|
||||
case "hobb" -> hobbyService.removeById(entry_id);
|
||||
case "lugg" -> luggageService.removeById(entry_id);
|
||||
case "heal" -> healthService.removeById(entry_id);
|
||||
case "prof" -> workService.removeById(entry_id);
|
||||
case "actions" -> actionService.removeById(entry_id);
|
||||
case "script_request" -> actionRequestService.removeById(entry_id);
|
||||
case "themes" -> themeService.removeById(entry_id);
|
||||
|
@ -2,10 +2,6 @@ package com.alterdekim.javabot.repository;
|
||||
|
||||
import com.alterdekim.javabot.entities.Synergy;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@ -14,9 +10,4 @@ public interface SynergyRepository extends JpaRepository<Synergy, Long> {
|
||||
Optional<Synergy> findById(Long id);
|
||||
|
||||
List<Synergy> findAll();
|
||||
|
||||
@Transactional
|
||||
@Modifying
|
||||
@Query("DELETE FROM Synergy s WHERE (s.firstEntityId = :uuid AND s.firstType = :sectionType) OR (s.secondEntityId = :uuid AND s.secondType = :sectionType)")
|
||||
void deleteByEntityId(@Param("uuid") Long entityId, @Param("sectionType") Integer sectionType);
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.alterdekim.javabot.service;
|
||||
|
||||
import com.alterdekim.javabot.bot.SectionType;
|
||||
import com.alterdekim.javabot.entities.Luggage;
|
||||
import com.alterdekim.javabot.entities.Synergy;
|
||||
|
||||
@ -12,6 +11,4 @@ public interface SynergyService {
|
||||
void saveSynergy(Synergy synergy);
|
||||
|
||||
List<Synergy> getAllSynergies();
|
||||
|
||||
void removeByEntityId(Long entityId, SectionType sectionType);
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.alterdekim.javabot.service;
|
||||
|
||||
import com.alterdekim.javabot.bot.SectionType;
|
||||
import com.alterdekim.javabot.entities.Synergy;
|
||||
import com.alterdekim.javabot.repository.SynergyRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -30,9 +29,4 @@ public class SynergyServiceImpl implements SynergyService {
|
||||
public List<Synergy> getAllSynergies() {
|
||||
return repository.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeByEntityId(Long entityId, SectionType sectionType) {
|
||||
repository.deleteByEntityId(entityId, sectionType.ordinal()+1);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user