-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add features for view post history snapshots (#5787)
* Add snapshots related api * feat: add features for view post history snapshots --------- Co-authored-by: guqing <i@guqing.email>
- Loading branch information
Showing
45 changed files
with
2,830 additions
and
45 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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: 9 additions & 0 deletions
9
application/src/main/java/run/halo/app/content/ContentUpdateParam.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,9 @@ | ||
package run.halo.app.content; | ||
|
||
public record ContentUpdateParam(Long version, String raw, String content, String rawType) { | ||
|
||
public static ContentUpdateParam from(Content content) { | ||
return new ContentUpdateParam(null, content.raw(), content.content(), | ||
content.rawType()); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
application/src/main/java/run/halo/app/content/ListedSnapshotDto.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,42 @@ | ||
package run.halo.app.content; | ||
|
||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.time.Instant; | ||
import lombok.Data; | ||
import lombok.experimental.Accessors; | ||
import run.halo.app.core.extension.content.Snapshot; | ||
import run.halo.app.extension.MetadataOperator; | ||
|
||
@Data | ||
@Accessors(chain = true) | ||
public class ListedSnapshotDto { | ||
@Schema(requiredMode = REQUIRED) | ||
private MetadataOperator metadata; | ||
|
||
@Schema(requiredMode = REQUIRED) | ||
private Spec spec; | ||
|
||
@Data | ||
@Accessors(chain = true) | ||
@Schema(name = "ListedSnapshotSpec") | ||
public static class Spec { | ||
@Schema(requiredMode = REQUIRED) | ||
private String owner; | ||
|
||
private Instant modifyTime; | ||
} | ||
|
||
/** | ||
* Creates from snapshot. | ||
*/ | ||
public static ListedSnapshotDto from(Snapshot snapshot) { | ||
return new ListedSnapshotDto() | ||
.setMetadata(snapshot.getMetadata()) | ||
.setSpec(new Spec() | ||
.setOwner(snapshot.getSpec().getOwner()) | ||
.setModifyTime(snapshot.getSpec().getLastModifyTime()) | ||
); | ||
} | ||
} |
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
Oops, something went wrong.