added command to add/remove channels from channel groups

added storing the commands with their modules in the db
renamed command impl module
This commit is contained in:
Sheldan
2020-04-04 17:09:28 +02:00
parent bf94af66d5
commit 20b282584a
64 changed files with 637 additions and 71 deletions

View File

@@ -6,6 +6,7 @@ import lombok.*;
import net.dv8tion.jda.api.entities.ChannelType;
import javax.persistence.*;
import java.util.List;
import java.util.Set;
@Entity
@@ -22,7 +23,7 @@ public class AChannel implements SnowFlake {
@Getter
@ManyToMany(mappedBy = "channels")
private Set<AChannelGroup> groups;
private List<AChannelGroup> groups;
@ManyToOne(fetch = FetchType.LAZY)
@Getter

View File

@@ -3,6 +3,7 @@ package dev.sheldan.abstracto.core.models.database;
import lombok.*;
import javax.persistence.*;
import java.util.List;
import java.util.Set;
@Entity
@@ -26,7 +27,7 @@ public class AChannelGroup {
name = "channel_in_group",
joinColumns = @JoinColumn(name = "group_id"),
inverseJoinColumns = @JoinColumn(name = "channel_id"))
private Set<AChannel> channels;
private List<AChannel> channels;
}

View File

@@ -0,0 +1,15 @@
package dev.sheldan.abstracto.core.service;
import dev.sheldan.abstracto.core.models.database.AChannel;
import dev.sheldan.abstracto.core.models.database.AChannelGroup;
import net.dv8tion.jda.api.entities.TextChannel;
public interface ChannelGroupService {
AChannelGroup createChannelGroup(String name);
void addChannelToChannelGroup(String channelGroupName, TextChannel textChannel);
void addChannelToChannelGroup(String channelGroupName, Long channelId);
void addChannelToChannelGroup(String channelGroupName, AChannel channel);
void removeChannelFromChannelGroup(String channelGroupName, TextChannel textChannel);
void removeChannelFromChannelGroup(String channelGroupName, Long channelId);
void removeChannelFromChannelGroup(String channelGroupName, AChannel channel);
}

View File

@@ -0,0 +1,11 @@
package dev.sheldan.abstracto.core.service.management;
import dev.sheldan.abstracto.core.models.database.AChannel;
import dev.sheldan.abstracto.core.models.database.AChannelGroup;
public interface ChannelGroupManagementService {
AChannelGroup createChannelGroup(String name);
AChannelGroup addChannelToChannelGroup(AChannelGroup channelGroup, AChannel channel);
void removeChannelFromChannelGroup(AChannelGroup channelGroup, AChannel channel);
AChannelGroup findByName(String name);
}