feat: add visible flag for works
This commit is contained in:
@@ -32,6 +32,7 @@ pub fn match3d_gallery_view(ctx: &AnonymousViewContext) -> Vec<Match3DGalleryVie
|
||||
.match3d_work_profile()
|
||||
.by_match3d_work_publication_status()
|
||||
.filter(MATCH3D_PUBLICATION_PUBLISHED)
|
||||
.filter(|row| row.visible)
|
||||
.filter_map(|row| match build_gallery_view_row(&row) {
|
||||
Ok(item) => Some(item),
|
||||
Err(error) => {
|
||||
@@ -571,6 +572,7 @@ fn compile_match3d_draft_tx(
|
||||
updated_at: compiled_at,
|
||||
published_at: previous_published_at,
|
||||
generated_item_assets_json,
|
||||
visible: true,
|
||||
};
|
||||
upsert_work(ctx, work);
|
||||
replace_session(
|
||||
@@ -643,6 +645,7 @@ fn build_updated_match3d_work_row(
|
||||
updated_at,
|
||||
published_at: current.published_at,
|
||||
generated_item_assets_json: current.generated_item_assets_json.clone(),
|
||||
visible: current.visible,
|
||||
};
|
||||
Ok(next)
|
||||
}
|
||||
@@ -1330,6 +1333,7 @@ fn clone_work(row: &Match3DWorkProfileRow) -> Match3DWorkProfileRow {
|
||||
updated_at: row.updated_at,
|
||||
published_at: row.published_at,
|
||||
generated_item_assets_json: row.generated_item_assets_json.clone(),
|
||||
visible: row.visible,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1885,6 +1889,7 @@ mod tests {
|
||||
updated_at: Timestamp::from_micros_since_unix_epoch(1),
|
||||
published_at: None,
|
||||
generated_item_assets_json: None,
|
||||
visible: true,
|
||||
};
|
||||
let snapshot = build_initial_run_snapshot("run-1", &work, 10, None);
|
||||
assert_eq!(snapshot.total_item_count, 12);
|
||||
@@ -1924,6 +1929,7 @@ mod tests {
|
||||
r#"[{"itemId":"match3d-item-1","itemName":"草莓","imageSrc":"/generated-match3d-assets/session/profile/items/item/image.png","status":"image_ready"}]"#
|
||||
.to_string(),
|
||||
),
|
||||
visible: true,
|
||||
};
|
||||
|
||||
let snapshot = build_work_snapshot(&work).expect("work snapshot should build");
|
||||
@@ -1969,6 +1975,7 @@ mod tests {
|
||||
r#"[{"itemId":"match3d-item-1","itemName":"草莓","imageSrc":"/generated-match3d-assets/session/profile/items/item/image.png","status":"image_ready"}]"#
|
||||
.to_string(),
|
||||
),
|
||||
visible: true,
|
||||
};
|
||||
|
||||
let preserved =
|
||||
@@ -2038,6 +2045,7 @@ mod tests {
|
||||
r#"[{"itemId":"match3d-item-1","itemName":"草莓","imageSrc":"/generated-match3d-assets/session/profile/items/item/image.png","status":"image_ready"}]"#
|
||||
.to_string(),
|
||||
),
|
||||
visible: true,
|
||||
};
|
||||
let input = Match3DWorkUpdateInput {
|
||||
profile_id: existing.profile_id.clone(),
|
||||
@@ -2097,6 +2105,7 @@ mod tests {
|
||||
r#"[{"itemId":"match3d-item-1","itemName":"草莓","imageSrc":"/generated-match3d-assets/session/profile/items/item/image.png","status":"image_ready"},{"itemId":"match3d-item-2","itemName":"苹果","imageViews":[{"imageSrc":"/v1.png"},{"imageSrc":"/v2.png"},{"imageSrc":"/v3.png"},{"imageSrc":"/v4.png"},{"imageSrc":"/v5.png"}],"status":"model_ready"},{"itemId":"match3d-item-3","itemName":"香蕉","imageViews":[{"imageSrc":"/v1.png"},{"imageSrc":"/v2.png"},{"imageSrc":"/v3.png"},{"imageSrc":"/v4.png"}],"status":"image_ready"}]"#
|
||||
.to_string(),
|
||||
),
|
||||
visible: true,
|
||||
};
|
||||
|
||||
let error = validate_publishable_work(&base_work).unwrap_err();
|
||||
@@ -2156,6 +2165,7 @@ mod tests {
|
||||
updated_at: Timestamp::from_micros_since_unix_epoch(1),
|
||||
published_at: None,
|
||||
generated_item_assets_json: None,
|
||||
visible: true,
|
||||
};
|
||||
|
||||
let input_game_name = None;
|
||||
|
||||
Reference in New Issue
Block a user