Close DDD refactor and remove generated asset proxy

This commit is contained in:
kdletters
2026-05-02 00:27:22 +08:00
parent fd08262bf0
commit 9d9913095d
605 changed files with 11811 additions and 10106 deletions

View File

@@ -1080,10 +1080,22 @@ fn start_puzzle_run_tx(
.profile_id()
.find(&input.profile_id)
.ok_or_else(|| "入口拼图作品不存在".to_string())?;
if entry_profile_row.publication_status != PuzzlePublicationStatus::Published {
// 结果页试玩允许作者启动自己的草稿 run公开入口仍必须保持已发布状态。
let is_owner_draft_preview = entry_profile_row.publication_status
== PuzzlePublicationStatus::Draft
&& entry_profile_row.owner_user_id == input.owner_user_id;
if entry_profile_row.publication_status != PuzzlePublicationStatus::Published
&& !is_owner_draft_preview
{
return Err("入口拼图作品未发布".to_string());
}
let entry_profile = build_puzzle_work_profile_from_row(&entry_profile_row)?;
if entry_profile.cover_image_src.is_none() {
return Err("入口拼图作品缺少正式图片".to_string());
}
if entry_profile.theme_tags.is_empty() {
return Err("入口拼图作品缺少标签".to_string());
}
let mut run =
start_run(input.run_id.clone(), &entry_profile, 0).map_err(|error| error.to_string())?;
let current_grid_size = run.current_grid_size;
@@ -1102,13 +1114,15 @@ fn start_puzzle_run_tx(
)
.map(|value| value.profile_id.clone());
increment_puzzle_profile_play_count(ctx, &entry_profile_row, input.started_at_micros);
upsert_puzzle_profile_played_work(
ctx,
&input.owner_user_id,
&entry_profile_row,
input.started_at_micros,
)?;
if entry_profile_row.publication_status == PuzzlePublicationStatus::Published {
increment_puzzle_profile_play_count(ctx, &entry_profile_row, input.started_at_micros);
upsert_puzzle_profile_played_work(
ctx,
&input.owner_user_id,
&entry_profile_row,
input.started_at_micros,
)?;
}
insert_puzzle_runtime_run(ctx, &run, &input.owner_user_id, input.started_at_micros)?;
Ok(run)
}
@@ -1246,6 +1260,23 @@ fn submit_puzzle_leaderboard_entry_tx(
if current_level.grid_size != input.grid_size {
return Err("提交成绩的网格规格与当前关卡不匹配".to_string());
}
let current_profile_row = ctx
.db
.puzzle_work_profile()
.profile_id()
.find(&input.profile_id)
.ok_or_else(|| "提交成绩的拼图作品不存在".to_string())?;
if current_profile_row.publication_status != PuzzlePublicationStatus::Published {
hydrate_puzzle_leaderboard_entries(
ctx,
&mut run,
&input.owner_user_id,
&input.profile_id,
input.grid_size,
);
replace_puzzle_runtime_run(ctx, &row, &run, input.submitted_at_micros);
return Ok(run);
}
let nickname = input.nickname.trim();
if nickname.is_empty() {