-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support subject sync create and remove for plugin. (#562)
* feat: support subject sync create and remove for plugin. * docs: update CHANGELOG.MD * fix: checkstyle
- Loading branch information
GuoHao
authored
Jun 15, 2024
1 parent
ddf52ab
commit 9d60fa2
Showing
16 changed files
with
199 additions
and
16 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
2 changes: 1 addition & 1 deletion
2
...core/subject/enums/SubjectSyncAction.java → ...s/api/core/subject/SubjectSyncAction.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
30 changes: 30 additions & 0 deletions
30
api/src/main/java/run/ikaros/api/core/subject/SubjectSyncPlatformOperate.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 run.ikaros.api.core.subject; | ||
|
||
import jakarta.annotation.Nullable; | ||
import reactor.core.publisher.Flux; | ||
import reactor.core.publisher.Mono; | ||
import run.ikaros.api.core.subject.vo.PostSubjectSyncCondition; | ||
import run.ikaros.api.plugin.AllowPluginOperate; | ||
import run.ikaros.api.store.enums.SubjectSyncPlatform; | ||
|
||
public interface SubjectSyncPlatformOperate extends AllowPluginOperate { | ||
Mono<Subject> sync(@Nullable Long subjectId, SubjectSyncPlatform platform, String platformId); | ||
|
||
Mono<Subject> sync(PostSubjectSyncCondition condition); | ||
|
||
Mono<SubjectSync> save(SubjectSync subjectSync); | ||
|
||
Mono<Void> remove(SubjectSync subjectSync); | ||
|
||
Flux<SubjectSync> findSubjectSyncsBySubjectId(long subjectId); | ||
|
||
Mono<SubjectSync> findSubjectSyncBySubjectIdAndPlatform(long subjectId, | ||
SubjectSyncPlatform platform); | ||
|
||
Flux<SubjectSync> findSubjectSyncsByPlatformAndPlatformId(SubjectSyncPlatform platform, | ||
String platformId); | ||
|
||
Mono<SubjectSync> findBySubjectIdAndPlatformAndPlatformId(Long subjectId, | ||
SubjectSyncPlatform platform, | ||
String platformId); | ||
} |
2 changes: 1 addition & 1 deletion
2
.../subject/vo/BatchMatchingEpisodeFile.java → .../subject/vo/BatchMatchingEpisodeFile.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
2 changes: 1 addition & 1 deletion
2
...core/subject/vo/FindSubjectCondition.java → ...core/subject/vo/FindSubjectCondition.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,4 +1,4 @@ | ||
package run.ikaros.server.core.subject.vo; | ||
package run.ikaros.api.core.subject.vo; | ||
|
||
|
||
import java.util.Objects; | ||
|
4 changes: 2 additions & 2 deletions
4
.../subject/vo/PostSubjectSyncCondition.java → .../subject/vo/PostSubjectSyncCondition.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
68 changes: 68 additions & 0 deletions
68
server/src/main/java/run/ikaros/server/core/subject/SubjectSyncPlatformOperator.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,68 @@ | ||
package run.ikaros.server.core.subject; | ||
|
||
import jakarta.annotation.Nullable; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
import reactor.core.publisher.Flux; | ||
import reactor.core.publisher.Mono; | ||
import run.ikaros.api.core.subject.Subject; | ||
import run.ikaros.api.core.subject.SubjectSync; | ||
import run.ikaros.api.core.subject.SubjectSyncPlatformOperate; | ||
import run.ikaros.api.core.subject.vo.PostSubjectSyncCondition; | ||
import run.ikaros.api.store.enums.SubjectSyncPlatform; | ||
import run.ikaros.server.core.subject.service.SubjectSyncPlatformService; | ||
|
||
@Slf4j | ||
@Component | ||
public class SubjectSyncPlatformOperator implements SubjectSyncPlatformOperate { | ||
private final SubjectSyncPlatformService service; | ||
|
||
public SubjectSyncPlatformOperator(SubjectSyncPlatformService service) { | ||
this.service = service; | ||
} | ||
|
||
@Override | ||
public Mono<Subject> sync(@Nullable Long subjectId, SubjectSyncPlatform platform, | ||
String platformId) { | ||
return service.sync(subjectId, platform, platformId); | ||
} | ||
|
||
@Override | ||
public Mono<Subject> sync(PostSubjectSyncCondition condition) { | ||
return service.sync(condition); | ||
} | ||
|
||
@Override | ||
public Mono<SubjectSync> save(SubjectSync subjectSync) { | ||
return service.save(subjectSync); | ||
} | ||
|
||
@Override | ||
public Mono<Void> remove(SubjectSync subjectSync) { | ||
return service.remove(subjectSync); | ||
} | ||
|
||
@Override | ||
public Flux<SubjectSync> findSubjectSyncsBySubjectId(long subjectId) { | ||
return service.findSubjectSyncsBySubjectId(subjectId); | ||
} | ||
|
||
@Override | ||
public Mono<SubjectSync> findSubjectSyncBySubjectIdAndPlatform(long subjectId, | ||
SubjectSyncPlatform platform) { | ||
return service.findSubjectSyncBySubjectIdAndPlatform(subjectId, platform); | ||
} | ||
|
||
@Override | ||
public Flux<SubjectSync> findSubjectSyncsByPlatformAndPlatformId(SubjectSyncPlatform platform, | ||
String platformId) { | ||
return service.findSubjectSyncsByPlatformAndPlatformId(platform, platformId); | ||
} | ||
|
||
@Override | ||
public Mono<SubjectSync> findBySubjectIdAndPlatformAndPlatformId(Long subjectId, | ||
SubjectSyncPlatform platform, | ||
String platformId) { | ||
return service.findBySubjectIdAndPlatformAndPlatformId(subjectId, platform, platformId); | ||
} | ||
} |
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
20 changes: 19 additions & 1 deletion
20
server/src/main/java/run/ikaros/server/core/subject/service/SubjectSyncPlatformService.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,13 +1,31 @@ | ||
package run.ikaros.server.core.subject.service; | ||
|
||
import jakarta.annotation.Nullable; | ||
import reactor.core.publisher.Flux; | ||
import reactor.core.publisher.Mono; | ||
import run.ikaros.api.core.subject.Subject; | ||
import run.ikaros.api.core.subject.SubjectSync; | ||
import run.ikaros.api.core.subject.vo.PostSubjectSyncCondition; | ||
import run.ikaros.api.store.enums.SubjectSyncPlatform; | ||
import run.ikaros.server.core.subject.vo.PostSubjectSyncCondition; | ||
|
||
public interface SubjectSyncPlatformService { | ||
Mono<Subject> sync(@Nullable Long subjectId, SubjectSyncPlatform platform, String platformId); | ||
|
||
Mono<Subject> sync(PostSubjectSyncCondition condition); | ||
|
||
Mono<SubjectSync> save(SubjectSync subjectSync); | ||
|
||
Mono<Void> remove(SubjectSync subjectSync); | ||
|
||
Flux<SubjectSync> findSubjectSyncsBySubjectId(long subjectId); | ||
|
||
Mono<SubjectSync> findSubjectSyncBySubjectIdAndPlatform(long subjectId, | ||
SubjectSyncPlatform platform); | ||
|
||
Flux<SubjectSync> findSubjectSyncsByPlatformAndPlatformId(SubjectSyncPlatform platform, | ||
String platformId); | ||
|
||
Mono<SubjectSync> findBySubjectIdAndPlatformAndPlatformId(Long subjectId, | ||
SubjectSyncPlatform platform, | ||
String platformId); | ||
} |
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