feat: checkpoint m5 and bootstrap m6 asset flow
This commit is contained in:
@@ -32,10 +32,11 @@ pub async fn get_runtime_snapshot(
|
||||
) -> Result<Json<Value>, Response> {
|
||||
let user_id = authenticated.claims().user_id().to_string();
|
||||
let record = state
|
||||
.spacetime_client()
|
||||
.get_runtime_snapshot(user_id)
|
||||
.get_runtime_snapshot_record(user_id)
|
||||
.await
|
||||
.map_err(|error| runtime_save_error_response(&request_context, map_runtime_save_client_error(error)))?;
|
||||
.map_err(|error| {
|
||||
runtime_save_error_response(&request_context, map_runtime_save_client_error(error))
|
||||
})?;
|
||||
|
||||
Ok(json_success_body(
|
||||
Some(&request_context),
|
||||
@@ -70,8 +71,7 @@ pub async fn put_runtime_snapshot(
|
||||
let saved_at_micros = offset_datetime_to_unix_micros(saved_at);
|
||||
|
||||
let record = state
|
||||
.spacetime_client()
|
||||
.put_runtime_snapshot(
|
||||
.put_runtime_snapshot_record(
|
||||
user_id,
|
||||
saved_at_micros,
|
||||
payload.bottom_tab,
|
||||
@@ -80,7 +80,9 @@ pub async fn put_runtime_snapshot(
|
||||
updated_at_micros,
|
||||
)
|
||||
.await
|
||||
.map_err(|error| runtime_save_error_response(&request_context, map_runtime_save_client_error(error)))?;
|
||||
.map_err(|error| {
|
||||
runtime_save_error_response(&request_context, map_runtime_save_client_error(error))
|
||||
})?;
|
||||
|
||||
Ok(json_success_body(
|
||||
Some(&request_context),
|
||||
@@ -95,10 +97,11 @@ pub async fn delete_runtime_snapshot(
|
||||
) -> Result<Json<Value>, Response> {
|
||||
let user_id = authenticated.claims().user_id().to_string();
|
||||
state
|
||||
.spacetime_client()
|
||||
.delete_runtime_snapshot(user_id)
|
||||
.delete_runtime_snapshot_record(user_id)
|
||||
.await
|
||||
.map_err(|error| runtime_save_error_response(&request_context, map_runtime_save_client_error(error)))?;
|
||||
.map_err(|error| {
|
||||
runtime_save_error_response(&request_context, map_runtime_save_client_error(error))
|
||||
})?;
|
||||
|
||||
Ok(json_success_body(
|
||||
Some(&request_context),
|
||||
@@ -116,7 +119,9 @@ pub async fn list_profile_save_archives(
|
||||
.spacetime_client()
|
||||
.list_profile_save_archives(user_id)
|
||||
.await
|
||||
.map_err(|error| runtime_save_error_response(&request_context, map_runtime_save_client_error(error)))?;
|
||||
.map_err(|error| {
|
||||
runtime_save_error_response(&request_context, map_runtime_save_client_error(error))
|
||||
})?;
|
||||
|
||||
Ok(json_success_body(
|
||||
Some(&request_context),
|
||||
@@ -151,7 +156,12 @@ pub async fn resume_profile_save_archive(
|
||||
.spacetime_client()
|
||||
.resume_profile_save_archive(user_id, world_key)
|
||||
.await
|
||||
.map_err(|error| runtime_save_error_response(&request_context, map_runtime_save_resume_client_error(error)))?;
|
||||
.map_err(|error| {
|
||||
runtime_save_error_response(
|
||||
&request_context,
|
||||
map_runtime_save_resume_client_error(error),
|
||||
)
|
||||
})?;
|
||||
|
||||
Ok(json_success_body(
|
||||
Some(&request_context),
|
||||
@@ -205,7 +215,8 @@ fn map_runtime_save_client_error(error: SpacetimeClientError) -> AppError {
|
||||
fn map_runtime_save_resume_client_error(error: SpacetimeClientError) -> AppError {
|
||||
let (status, provider) = match &error {
|
||||
SpacetimeClientError::Procedure(message)
|
||||
if message.contains("world_key 不存在") || message.contains("对应 world_key 不存在") =>
|
||||
if message.contains("world_key 不存在")
|
||||
|| message.contains("对应 world_key 不存在") =>
|
||||
{
|
||||
(StatusCode::NOT_FOUND, "runtime-save")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user