Merge commit '01af298c' into codex/cache-view-procedure-hotpaths
# Conflicts: # server-rs/crates/spacetime-client/src/mapper.rs # server-rs/crates/spacetime-client/src/module_bindings/big_fish_work_summary_snapshot_type.rs # server-rs/crates/spacetime-module/src/square_hole/types.rs
This commit is contained in:
@@ -161,12 +161,12 @@ pub fn list_match3d_works(
|
||||
match ctx.try_with_tx(|tx| list_match3d_works_tx(tx, input.clone())) {
|
||||
Ok(items) => Match3DWorksProcedureResult {
|
||||
ok: true,
|
||||
items_json: Some(to_json_string(&items)),
|
||||
items,
|
||||
error_message: None,
|
||||
},
|
||||
Err(message) => Match3DWorksProcedureResult {
|
||||
ok: false,
|
||||
items_json: None,
|
||||
items: Vec::new(),
|
||||
error_message: Some(message),
|
||||
},
|
||||
}
|
||||
@@ -191,12 +191,12 @@ pub fn delete_match3d_work(
|
||||
match ctx.try_with_tx(|tx| delete_match3d_work_tx(tx, input.clone())) {
|
||||
Ok(items) => Match3DWorksProcedureResult {
|
||||
ok: true,
|
||||
items_json: Some(to_json_string(&items)),
|
||||
items,
|
||||
error_message: None,
|
||||
},
|
||||
Err(message) => Match3DWorksProcedureResult {
|
||||
ok: false,
|
||||
items_json: None,
|
||||
items: Vec::new(),
|
||||
error_message: Some(message),
|
||||
},
|
||||
}
|
||||
@@ -234,7 +234,7 @@ pub fn click_match3d_item(
|
||||
Err(message) => Match3DClickItemProcedureResult {
|
||||
ok: false,
|
||||
status: MATCH3D_CLICK_REJECTED_NOT_CLICKABLE.to_string(),
|
||||
run_json: None,
|
||||
run: None,
|
||||
accepted_item_instance_id: None,
|
||||
cleared_item_instance_ids: Vec::new(),
|
||||
failure_reason: None,
|
||||
@@ -690,17 +690,22 @@ fn list_match3d_works_tx(
|
||||
ctx: &ReducerContext,
|
||||
input: Match3DWorksListInput,
|
||||
) -> Result<Vec<Match3DWorkSnapshot>, String> {
|
||||
let mut items = ctx
|
||||
.db
|
||||
.match3d_work_profile()
|
||||
let rows = if input.published_only {
|
||||
ctx.db
|
||||
.match3d_work_profile()
|
||||
.by_match3d_work_publication_status()
|
||||
.filter(&MATCH3D_PUBLICATION_PUBLISHED.to_string())
|
||||
.collect::<Vec<_>>()
|
||||
} else {
|
||||
require_non_empty(&input.owner_user_id, "match3d owner_user_id")?;
|
||||
ctx.db
|
||||
.match3d_work_profile()
|
||||
.by_match3d_work_owner_user_id()
|
||||
.filter(&input.owner_user_id)
|
||||
.collect::<Vec<_>>()
|
||||
};
|
||||
let mut items = rows
|
||||
.iter()
|
||||
.filter(|row| {
|
||||
if input.published_only {
|
||||
row.publication_status == MATCH3D_PUBLICATION_PUBLISHED
|
||||
} else {
|
||||
row.owner_user_id == input.owner_user_id
|
||||
}
|
||||
})
|
||||
.map(|row| build_work_snapshot(&row))
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
items.sort_by(|left, right| {
|
||||
@@ -741,10 +746,9 @@ fn delete_match3d_work_tx(
|
||||
for run in ctx
|
||||
.db
|
||||
.match3d_runtime_run()
|
||||
.iter()
|
||||
.filter(|row| {
|
||||
row.profile_id == input.profile_id && row.owner_user_id == input.owner_user_id
|
||||
})
|
||||
.by_match3d_run_profile_id()
|
||||
.filter(&input.profile_id)
|
||||
.filter(|row| row.owner_user_id == input.owner_user_id)
|
||||
.collect::<Vec<_>>()
|
||||
{
|
||||
ctx.db.match3d_runtime_run().run_id().delete(&run.run_id);
|
||||
@@ -987,8 +991,8 @@ fn build_session_snapshot(
|
||||
let mut messages = ctx
|
||||
.db
|
||||
.match3d_agent_message()
|
||||
.iter()
|
||||
.filter(|message| message.session_id == row.session_id)
|
||||
.by_match3d_agent_message_session_id()
|
||||
.filter(&row.session_id)
|
||||
.map(|message| Match3DAgentMessageSnapshot {
|
||||
message_id: message.message_id,
|
||||
session_id: message.session_id,
|
||||
@@ -1241,10 +1245,10 @@ fn click_result(
|
||||
Match3DClickItemProcedureResult {
|
||||
ok: true,
|
||||
status: status.to_string(),
|
||||
run_json: Some(to_json_string(&snapshot)),
|
||||
failure_reason: snapshot.failure_reason.clone(),
|
||||
run: Some(snapshot),
|
||||
accepted_item_instance_id,
|
||||
cleared_item_instance_ids,
|
||||
failure_reason: snapshot.failure_reason,
|
||||
error_message: None,
|
||||
}
|
||||
}
|
||||
@@ -1802,7 +1806,7 @@ fn to_json_string<T: Serialize>(value: &T) -> String {
|
||||
fn session_result(session: Match3DAgentSessionSnapshot) -> Match3DAgentSessionProcedureResult {
|
||||
Match3DAgentSessionProcedureResult {
|
||||
ok: true,
|
||||
session_json: Some(to_json_string(&session)),
|
||||
session: Some(session),
|
||||
error_message: None,
|
||||
}
|
||||
}
|
||||
@@ -1810,7 +1814,7 @@ fn session_result(session: Match3DAgentSessionSnapshot) -> Match3DAgentSessionPr
|
||||
fn session_error(message: String) -> Match3DAgentSessionProcedureResult {
|
||||
Match3DAgentSessionProcedureResult {
|
||||
ok: false,
|
||||
session_json: None,
|
||||
session: None,
|
||||
error_message: Some(message),
|
||||
}
|
||||
}
|
||||
@@ -1818,7 +1822,7 @@ fn session_error(message: String) -> Match3DAgentSessionProcedureResult {
|
||||
fn work_result(work: Match3DWorkSnapshot) -> Match3DWorkProcedureResult {
|
||||
Match3DWorkProcedureResult {
|
||||
ok: true,
|
||||
work_json: Some(to_json_string(&work)),
|
||||
work: Some(work),
|
||||
error_message: None,
|
||||
}
|
||||
}
|
||||
@@ -1826,7 +1830,7 @@ fn work_result(work: Match3DWorkSnapshot) -> Match3DWorkProcedureResult {
|
||||
fn work_error(message: String) -> Match3DWorkProcedureResult {
|
||||
Match3DWorkProcedureResult {
|
||||
ok: false,
|
||||
work_json: None,
|
||||
work: None,
|
||||
error_message: Some(message),
|
||||
}
|
||||
}
|
||||
@@ -1834,7 +1838,7 @@ fn work_error(message: String) -> Match3DWorkProcedureResult {
|
||||
fn run_result(run: Match3DRunSnapshot) -> Match3DRunProcedureResult {
|
||||
Match3DRunProcedureResult {
|
||||
ok: true,
|
||||
run_json: Some(to_json_string(&run)),
|
||||
run: Some(run),
|
||||
error_message: None,
|
||||
}
|
||||
}
|
||||
@@ -1842,7 +1846,7 @@ fn run_result(run: Match3DRunSnapshot) -> Match3DRunProcedureResult {
|
||||
fn run_error(message: String) -> Match3DRunProcedureResult {
|
||||
Match3DRunProcedureResult {
|
||||
ok: false,
|
||||
run_json: None,
|
||||
run: None,
|
||||
error_message: Some(message),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user