Skip to content

Commit 717980b

Browse files
authored
feat: attachment ref update such as subject cover and episodes resources. (#481)
* feat: add AttachmentOperator.java * feat: add uk for table attachment_reference * feat: add default cover dir and add attachment ref update when subject add and remove. * optimize: list attachments when parentId is null. * feat: add AttachmentSelectDialog.vue * optimize: AttachmentSelectDialog.vue * feat: add attachment ref endpoint api * feat: try to update subject episode logic by attachment matching with episodes * build: gen new api-client@0.10.5 and publish to npm center repo in @runikaros/api-client * optimize: subject cover attachment name. * optimize: attachment ref matching by subjectId and attachmentIds. * feat: update subject episodes matching by id and attachments in console page SubjectDetails.vue * optimize: add check before save attachment ref entity. * feat: single episode and attachment bind in SubjectDetails.vue * build: gen new api-client@0.10.6 and publish to npm center repo in @runikaros/api-client * optimize: AttachmentReferenceEndpoint.java * feat: episode and attachment ref remove in EpisodeDetailsDialog.vue * optimize: mail enable setting in Setting.vue * optimize: remove all console file pages. * optimize: remove all file and folder codes in server. * fix: checkstyle issues. * docs: update CHANGELOG.MD * test: fix AttachmentServiceTest.upload() case.
1 parent e2c7cf2 commit 717980b

File tree

123 files changed

+1601
-7704
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+1601
-7704
lines changed

CHANGELOG.MD

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
更新日志文档,版本顺序从新到旧,最新版本在最前(上)面。
44

5+
# 0.10.0
6+
7+
## 重构
8+
9+
- 文件和目录统一成附件 #434
10+
- 控制台移除文件和目录相关页面
11+
- 服务端移除文件和目录相关代码
12+
513
# 0.9.0
614

715
## 新特性

api/src/main/java/run/ikaros/api/core/attachment/AttachmentConst.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22

33
public interface AttachmentConst {
44
Long ROOT_DIRECTORY_ID = 0L;
5+
Long COVER_DIRECTORY_ID = 1L;
6+
Long DOWNLOAD_DIRECTORY_ID = 2L;
7+
String ROOT_DIR_NAME = "/";
8+
String COVER_DIR_NAME = "Covers";
9+
String DOWNLOAD_DIR_NAME = "Downloads";
510
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package run.ikaros.api.core.attachment;
2+
3+
import jakarta.annotation.Nullable;
4+
import jakarta.validation.constraints.NotBlank;
5+
import reactor.core.publisher.Mono;
6+
import run.ikaros.api.plugin.AllowPluginOperate;
7+
import run.ikaros.api.store.enums.AttachmentType;
8+
import run.ikaros.api.wrap.PagingWrap;
9+
10+
public interface AttachmentOperate extends AllowPluginOperate {
11+
12+
Mono<Attachment> save(Attachment attachment);
13+
14+
Mono<PagingWrap<Attachment>> listByCondition(AttachmentSearchCondition searchCondition);
15+
16+
Mono<Void> removeById(Long attachmentId);
17+
18+
Mono<Attachment> upload(AttachmentUploadCondition uploadCondition);
19+
20+
Mono<Attachment> findById(Long attachmentId);
21+
22+
Mono<Attachment> findByTypeAndParentIdAndName(AttachmentType type, @Nullable Long parentId,
23+
String name);
24+
25+
Mono<Void> removeByTypeAndParentIdAndName(
26+
AttachmentType type, @Nullable Long parentId, String name);
27+
28+
29+
Mono<Attachment> createDirectory(@Nullable Long parentId, @NotBlank String name);
30+
}

api/src/main/java/run/ikaros/api/core/attachment/AttachmentReference.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package run.ikaros.api.core.attachment;
22

3-
import com.fasterxml.jackson.annotation.JsonProperty;
43
import lombok.AllArgsConstructor;
54
import lombok.Builder;
65
import lombok.Data;
@@ -16,8 +15,6 @@
1615
public class AttachmentReference {
1716
private Long id;
1817
private AttachmentReferenceType type;
19-
@JsonProperty(" attachment_id")
2018
private Long attachmentId;
21-
@JsonProperty("reference_id")
2219
private Long referenceId;
2320
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package run.ikaros.api.core.attachment.exception;
2+
3+
public class AttachmentNotFoundException extends RuntimeException {
4+
public AttachmentNotFoundException(String message) {
5+
super(message);
6+
}
7+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package run.ikaros.api.core.attachment.exception;
2+
3+
public class AttachmentRefMatchingException extends RuntimeException {
4+
public AttachmentRefMatchingException(String message) {
5+
super(message);
6+
}
7+
8+
public AttachmentRefMatchingException(String message, Throwable cause) {
9+
super(message, cause);
10+
}
11+
}

api/src/main/java/run/ikaros/api/core/attachment/exception/AttachmentRemoveException.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package run.ikaros.api.core.attachment.exception;
22

33
public class AttachmentRemoveException extends RuntimeException {
4+
public AttachmentRemoveException(String message) {
5+
super(message);
6+
}
7+
48
public AttachmentRemoveException(String message, Throwable cause) {
59
super(message, cause);
610
}

api/src/main/java/run/ikaros/api/core/file/File.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

api/src/main/java/run/ikaros/api/core/file/FileOperate.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

api/src/main/java/run/ikaros/api/core/file/FileRelationOperate.java

Lines changed: 0 additions & 13 deletions
This file was deleted.

api/src/main/java/run/ikaros/api/core/file/FileRelations.java

Lines changed: 0 additions & 25 deletions
This file was deleted.

api/src/main/java/run/ikaros/api/core/file/Folder.java

Lines changed: 0 additions & 66 deletions
This file was deleted.

api/src/main/java/run/ikaros/api/core/file/FolderOperate.java

Lines changed: 0 additions & 21 deletions
This file was deleted.

api/src/main/java/run/ikaros/api/core/file/RemoteFileChunk.java

Lines changed: 0 additions & 14 deletions
This file was deleted.

api/src/main/java/run/ikaros/api/core/file/RemoteFileHandler.java

Lines changed: 0 additions & 38 deletions
This file was deleted.

api/src/main/java/run/ikaros/api/core/subject/EpisodeFileOperate.java

Lines changed: 0 additions & 15 deletions
This file was deleted.

api/src/main/java/run/ikaros/api/core/subject/EpisodeResource.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package run.ikaros.api.core.subject;
22

3-
import com.fasterxml.jackson.annotation.JsonProperty;
43
import java.util.Set;
54
import lombok.AllArgsConstructor;
65
import lombok.Builder;
@@ -14,9 +13,7 @@
1413
@NoArgsConstructor
1514
@AllArgsConstructor
1615
public class EpisodeResource {
17-
@JsonProperty("file_id")
18-
private Long fileId;
19-
@JsonProperty("episode_id")
16+
private Long attachmentId;
2017
private Long episodeId;
2118
private String url;
2219
private boolean canRead;

0 commit comments

Comments
 (0)