-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add msgToggle repo, service, API and commands
- Loading branch information
Showing
7 changed files
with
96 additions
and
46 deletions.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
eternalcore-api/src/main/java/com/eternalcode/core/feature/msgtoggle/MsgToggleService.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
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
9 changes: 3 additions & 6 deletions
9
...alcore-core/src/main/java/com/eternalcode/core/feature/msgtoggle/MsgToggleRepository.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 |
---|---|---|
@@ -1,15 +1,12 @@ | ||
package com.eternalcode.core.feature.msgtoggle; | ||
|
||
import java.util.UUID; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
interface MsgToggleRepository { | ||
public interface MsgToggleRepository { | ||
|
||
boolean isToggledOff(UUID uuid); | ||
CompletableFuture<Boolean> isToggledOff(UUID uuid); | ||
|
||
void setToggledOff(UUID uuid, boolean toggledOff); | ||
|
||
void remove(UUID uuid); | ||
|
||
void removeAll(); | ||
|
||
} |
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
30 changes: 30 additions & 0 deletions
30
...lcore-core/src/main/java/com/eternalcode/core/feature/msgtoggle/MsgToggleServiceImpl.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,30 @@ | ||
package com.eternalcode.core.feature.msgtoggle; | ||
|
||
import com.eternalcode.core.injector.annotations.Inject; | ||
import com.eternalcode.core.injector.annotations.component.Service; | ||
import java.util.UUID; | ||
import java.util.concurrent.CompletableFuture; | ||
import org.jetbrains.annotations.Blocking; | ||
|
||
@Service | ||
public class MsgToggleServiceImpl implements MsgToggleService{ | ||
|
||
private final MsgToggleRepository msgToggleRepository; | ||
|
||
@Inject | ||
public MsgToggleServiceImpl(MsgToggleRepository msgToggleRepository) { | ||
this.msgToggleRepository = msgToggleRepository; | ||
} | ||
|
||
|
||
@Override | ||
public CompletableFuture<Boolean> hasMsgToggledOff(UUID uuid) { | ||
return this.msgToggleRepository.isToggledOff(uuid); | ||
} | ||
|
||
@Override | ||
@Blocking | ||
public void toggleMsg(UUID uuid, boolean toggle) { | ||
this.msgToggleRepository.setToggledOff(uuid, toggle); | ||
} | ||
} |
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