1
This commit is contained in:
@@ -320,6 +320,7 @@ impl From<module_runtime::RuntimeProfileInviteCodeAdminUpsertInput>
|
||||
admin_user_id: input.admin_user_id,
|
||||
invite_code: input.invite_code,
|
||||
metadata_json: input.metadata_json,
|
||||
granted_user_tags: input.granted_user_tags,
|
||||
starts_at_micros: input.starts_at_micros,
|
||||
expires_at_micros: input.expires_at_micros,
|
||||
updated_at_micros: input.updated_at_micros,
|
||||
@@ -2315,6 +2316,7 @@ pub(crate) fn map_runtime_profile_invite_code_snapshot(
|
||||
user_id: snapshot.user_id,
|
||||
invite_code: snapshot.invite_code,
|
||||
metadata_json: snapshot.metadata_json,
|
||||
granted_user_tags: snapshot.granted_user_tags,
|
||||
starts_at_micros: snapshot.starts_at_micros,
|
||||
expires_at_micros: snapshot.expires_at_micros,
|
||||
created_at_micros: snapshot.created_at_micros,
|
||||
@@ -2935,6 +2937,9 @@ fn map_match3d_creator_config(
|
||||
reference_image_src: snapshot.reference_image_src,
|
||||
clear_count: snapshot.clear_count,
|
||||
difficulty: snapshot.difficulty,
|
||||
asset_style_id: snapshot.asset_style_id,
|
||||
asset_style_label: snapshot.asset_style_label,
|
||||
asset_style_prompt: snapshot.asset_style_prompt,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2993,6 +2998,7 @@ fn map_match3d_work_snapshot(snapshot: Match3DWorkJsonRecord) -> Match3DWorkProf
|
||||
updated_at: format_timestamp_micros(snapshot.updated_at_micros),
|
||||
published_at: snapshot.published_at_micros.map(format_timestamp_micros),
|
||||
publish_ready: snapshot.publish_ready,
|
||||
generated_item_assets_json: snapshot.generated_item_assets_json,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3745,6 +3751,7 @@ pub(crate) fn map_puzzle_leaderboard_entry(
|
||||
rank: snapshot.rank,
|
||||
nickname: snapshot.nickname,
|
||||
elapsed_ms: snapshot.elapsed_ms,
|
||||
visible_tags: snapshot.visible_tags,
|
||||
is_current_player: snapshot.is_current_player,
|
||||
}
|
||||
}
|
||||
@@ -5997,6 +6004,7 @@ pub struct Match3DCompileDraftRecordInput {
|
||||
pub cover_image_src: Option<String>,
|
||||
pub cover_asset_id: Option<String>,
|
||||
pub compiled_at_micros: i64,
|
||||
pub generated_item_assets_json: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
@@ -6075,6 +6083,9 @@ pub struct Match3DCreatorConfigRecord {
|
||||
pub reference_image_src: Option<String>,
|
||||
pub clear_count: u32,
|
||||
pub difficulty: u32,
|
||||
pub asset_style_id: Option<String>,
|
||||
pub asset_style_label: Option<String>,
|
||||
pub asset_style_prompt: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
@@ -6138,6 +6149,7 @@ pub struct Match3DWorkProfileRecord {
|
||||
pub updated_at: String,
|
||||
pub published_at: Option<String>,
|
||||
pub publish_ready: bool,
|
||||
pub generated_item_assets_json: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
@@ -6201,6 +6213,12 @@ struct Match3DCreatorConfigJsonRecord {
|
||||
reference_image_src: Option<String>,
|
||||
clear_count: u32,
|
||||
difficulty: u32,
|
||||
#[serde(default)]
|
||||
asset_style_id: Option<String>,
|
||||
#[serde(default)]
|
||||
asset_style_label: Option<String>,
|
||||
#[serde(default)]
|
||||
asset_style_prompt: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize)]
|
||||
@@ -6269,6 +6287,8 @@ struct Match3DWorkJsonRecord {
|
||||
play_count: u32,
|
||||
updated_at_micros: i64,
|
||||
published_at_micros: Option<i64>,
|
||||
#[serde(default)]
|
||||
generated_item_assets_json: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, serde::Deserialize)]
|
||||
@@ -7309,6 +7329,7 @@ pub struct PuzzleLeaderboardEntryRecord {
|
||||
pub rank: u32,
|
||||
pub nickname: String,
|
||||
pub elapsed_ms: u64,
|
||||
pub visible_tags: Vec<String>,
|
||||
pub is_current_player: bool,
|
||||
}
|
||||
|
||||
@@ -7870,6 +7891,53 @@ mod tests {
|
||||
assert_eq!(items[0].remix_count, 0);
|
||||
assert_eq!(items[0].like_count, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn match3d_work_mapper_keeps_generated_item_assets_json() {
|
||||
let result = Match3DWorkProcedureResult {
|
||||
ok: true,
|
||||
work_json: Some(
|
||||
r#"{
|
||||
"profileId":"match3d-profile-1",
|
||||
"ownerUserId":"user-1",
|
||||
"sourceSessionId":"match3d-session-1",
|
||||
"authorDisplayName":"测试作者",
|
||||
"gameName":"水果抓大鹅",
|
||||
"themeText":"水果",
|
||||
"summaryText":"水果主题",
|
||||
"tags":["水果"],
|
||||
"coverImageSrc":"",
|
||||
"coverAssetId":"",
|
||||
"clearCount":3,
|
||||
"difficulty":3,
|
||||
"config":{
|
||||
"themeText":"水果",
|
||||
"referenceImageSrc":null,
|
||||
"clearCount":3,
|
||||
"difficulty":3
|
||||
},
|
||||
"publicationStatus":"Draft",
|
||||
"publishReady":false,
|
||||
"playCount":0,
|
||||
"updatedAtMicros":123000000,
|
||||
"publishedAtMicros":null,
|
||||
"generatedItemAssetsJson":"[{\"itemId\":\"match3d-item-1\",\"itemName\":\"草莓\",\"imageSrc\":\"/generated-match3d-assets/session/profile/items/item/image.png\",\"status\":\"image_ready\"}]"
|
||||
}"#
|
||||
.to_string(),
|
||||
),
|
||||
error_message: None,
|
||||
};
|
||||
|
||||
let item = map_match3d_work_procedure_result(result)
|
||||
.expect("match3d work JSON 应保留生成素材 JSON");
|
||||
|
||||
assert_eq!(
|
||||
item.generated_item_assets_json.as_deref(),
|
||||
Some(
|
||||
r#"[{"itemId":"match3d-item-1","itemName":"草莓","imageSrc":"/generated-match3d-assets/session/profile/items/item/image.png","status":"image_ready"}]"#
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
|
||||
@@ -124,6 +124,7 @@ impl SpacetimeClient {
|
||||
cover_image_src: input.cover_image_src,
|
||||
cover_asset_id: input.cover_asset_id,
|
||||
compiled_at_micros: input.compiled_at_micros,
|
||||
generated_item_assets_json: input.generated_item_assets_json,
|
||||
};
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
|
||||
@@ -17,6 +17,7 @@ pub struct Match3DDraftCompileInput {
|
||||
pub cover_image_src: Option<String>,
|
||||
pub cover_asset_id: Option<String>,
|
||||
pub compiled_at_micros: i64,
|
||||
pub generated_item_assets_json: Option<String>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for Match3DDraftCompileInput {
|
||||
|
||||
@@ -24,6 +24,7 @@ pub struct Match3DWorkProfileRow {
|
||||
pub play_count: u32,
|
||||
pub updated_at: __sdk::Timestamp,
|
||||
pub published_at: Option<__sdk::Timestamp>,
|
||||
pub generated_item_assets_json: Option<String>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for Match3DWorkProfileRow {
|
||||
@@ -51,6 +52,8 @@ pub struct Match3DWorkProfileRowCols {
|
||||
pub play_count: __sdk::__query_builder::Col<Match3DWorkProfileRow, u32>,
|
||||
pub updated_at: __sdk::__query_builder::Col<Match3DWorkProfileRow, __sdk::Timestamp>,
|
||||
pub published_at: __sdk::__query_builder::Col<Match3DWorkProfileRow, Option<__sdk::Timestamp>>,
|
||||
pub generated_item_assets_json:
|
||||
__sdk::__query_builder::Col<Match3DWorkProfileRow, Option<String>>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasCols for Match3DWorkProfileRow {
|
||||
@@ -77,6 +80,10 @@ impl __sdk::__query_builder::HasCols for Match3DWorkProfileRow {
|
||||
play_count: __sdk::__query_builder::Col::new(table_name, "play_count"),
|
||||
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
|
||||
published_at: __sdk::__query_builder::Col::new(table_name, "published_at"),
|
||||
generated_item_assets_json: __sdk::__query_builder::Col::new(
|
||||
table_name,
|
||||
"generated_item_assets_json",
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -652,6 +652,7 @@ impl SpacetimeClient {
|
||||
admin_user_id: String,
|
||||
invite_code: String,
|
||||
metadata_json: String,
|
||||
granted_user_tags: Vec<String>,
|
||||
starts_at_micros: Option<i64>,
|
||||
expires_at_micros: Option<i64>,
|
||||
updated_at_micros: i64,
|
||||
@@ -660,6 +661,7 @@ impl SpacetimeClient {
|
||||
admin_user_id,
|
||||
invite_code,
|
||||
metadata_json,
|
||||
granted_user_tags,
|
||||
starts_at_micros,
|
||||
expires_at_micros,
|
||||
updated_at_micros,
|
||||
|
||||
Reference in New Issue
Block a user