新增图片画布项目页
新增 /project 项目页和我的页项目入口 补齐图片画布工程列表、重命名和删除 API 支持 /editor/canvas 按 projectid 加载指定工程 更新图片画布文档、TRACKING 和对应测试
This commit is contained in:
@@ -65,6 +65,20 @@ pub struct EditorProjectGetRecordInput {
|
||||
pub owner_user_id: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct EditorProjectRenameRecordInput {
|
||||
pub project_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub title: String,
|
||||
pub updated_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct EditorProjectDeleteRecordInput {
|
||||
pub project_id: String,
|
||||
pub owner_user_id: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct EditorProjectLayoutSaveRecordInput {
|
||||
pub project_id: String,
|
||||
@@ -114,6 +128,26 @@ impl From<EditorProjectGetRecordInput> for crate::module_bindings::EditorProject
|
||||
}
|
||||
}
|
||||
|
||||
impl From<EditorProjectRenameRecordInput> for crate::module_bindings::EditorProjectRenameInput {
|
||||
fn from(input: EditorProjectRenameRecordInput) -> Self {
|
||||
Self {
|
||||
project_id: input.project_id,
|
||||
owner_user_id: input.owner_user_id,
|
||||
title: input.title,
|
||||
updated_at_micros: input.updated_at_micros,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<EditorProjectDeleteRecordInput> for crate::module_bindings::EditorProjectDeleteInput {
|
||||
fn from(input: EditorProjectDeleteRecordInput) -> Self {
|
||||
Self {
|
||||
project_id: input.project_id,
|
||||
owner_user_id: input.owner_user_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<EditorProjectLayoutSaveRecordInput>
|
||||
for crate::module_bindings::EditorProjectLayoutSaveInput
|
||||
{
|
||||
@@ -174,6 +208,33 @@ pub(crate) fn map_editor_project_required_procedure_result(
|
||||
.ok_or_else(|| SpacetimeClientError::missing_snapshot("图片画布工程快照"))
|
||||
}
|
||||
|
||||
pub(crate) fn map_editor_project_list_procedure_result(
|
||||
result: EditorProjectListProcedureResult,
|
||||
) -> Result<Vec<EditorProjectRecord>, SpacetimeClientError> {
|
||||
if !result.ok {
|
||||
return Err(SpacetimeClientError::procedure_failed(result.error_message));
|
||||
}
|
||||
|
||||
result
|
||||
.projects
|
||||
.into_iter()
|
||||
.map(map_editor_project_snapshot)
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub(crate) fn map_editor_project_delete_procedure_result(
|
||||
result: EditorProjectDeleteProcedureResult,
|
||||
) -> Result<String, SpacetimeClientError> {
|
||||
if !result.ok {
|
||||
return Err(SpacetimeClientError::procedure_failed(result.error_message));
|
||||
}
|
||||
|
||||
result
|
||||
.deleted_project_id
|
||||
.filter(|project_id| !project_id.trim().is_empty())
|
||||
.ok_or_else(|| SpacetimeClientError::missing_snapshot("图片画布工程删除结果"))
|
||||
}
|
||||
|
||||
pub(crate) fn map_editor_project_resource_procedure_result(
|
||||
result: EditorProjectResourceProcedureResult,
|
||||
) -> Result<EditorProjectResourceRecord, SpacetimeClientError> {
|
||||
|
||||
Reference in New Issue
Block a user