收口创作流程统一总计划并修复等待页窄屏裁切
This commit is contained in:
@@ -28,6 +28,9 @@ use shared_contracts::admin::{
|
||||
AdminUpdateWorkVisibilityResponse, AdminUpsertCreationEntryTypeConfigRequest,
|
||||
AdminWorkVisibilityListResponse,
|
||||
};
|
||||
use shared_contracts::creation_entry_config::{
|
||||
encode_unified_creation_spec_response, validate_unified_creation_spec_for_play,
|
||||
};
|
||||
use time::{OffsetDateTime, format_description::well_known::Rfc3339};
|
||||
|
||||
use crate::{
|
||||
@@ -291,6 +294,7 @@ fn map_admin_creation_entry_type_config(
|
||||
category_label: entry.category_label,
|
||||
category_sort_order: entry.category_sort_order,
|
||||
updated_at_micros: entry.updated_at_micros,
|
||||
unified_creation_spec: entry.unified_creation_spec,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,6 +309,23 @@ fn validate_admin_creation_entry_config(
|
||||
if title.is_empty() {
|
||||
return Err(AppError::from_status(StatusCode::BAD_REQUEST).with_message("入口标题不能为空"));
|
||||
}
|
||||
let unified_creation_spec = match payload.unified_creation_spec {
|
||||
Some(spec) => {
|
||||
validate_unified_creation_spec_for_play(&id, &spec).map_err(|error| {
|
||||
AppError::from_status(StatusCode::BAD_REQUEST).with_message(error)
|
||||
})?;
|
||||
Some(spec)
|
||||
}
|
||||
None => None,
|
||||
};
|
||||
let unified_creation_spec_json = unified_creation_spec
|
||||
.as_ref()
|
||||
.map(|spec| {
|
||||
encode_unified_creation_spec_response(spec).map_err(|error| {
|
||||
AppError::from_status(StatusCode::BAD_REQUEST).with_message(error)
|
||||
})
|
||||
})
|
||||
.transpose()?;
|
||||
Ok(module_runtime::CreationEntryTypeAdminUpsertInput {
|
||||
id,
|
||||
title,
|
||||
@@ -317,6 +338,7 @@ fn validate_admin_creation_entry_config(
|
||||
category_id: payload.category_id.trim().to_string(),
|
||||
category_label: payload.category_label.trim().to_string(),
|
||||
category_sort_order: payload.category_sort_order,
|
||||
unified_creation_spec_json,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user