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),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,43 +182,43 @@ pub struct Match3DRunTimeUpInput {
|
||||
#[derive(Clone, Debug, PartialEq, Eq, SpacetimeType)]
|
||||
pub struct Match3DAgentSessionProcedureResult {
|
||||
pub ok: bool,
|
||||
pub session_json: Option<String>,
|
||||
pub session: Option<Match3DAgentSessionSnapshot>,
|
||||
pub error_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, SpacetimeType)]
|
||||
pub struct Match3DWorkProcedureResult {
|
||||
pub ok: bool,
|
||||
pub work_json: Option<String>,
|
||||
pub work: Option<Match3DWorkSnapshot>,
|
||||
pub error_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, SpacetimeType)]
|
||||
pub struct Match3DWorksProcedureResult {
|
||||
pub ok: bool,
|
||||
pub items_json: Option<String>,
|
||||
pub items: Vec<Match3DWorkSnapshot>,
|
||||
pub error_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, SpacetimeType)]
|
||||
#[derive(Clone, Debug, PartialEq, SpacetimeType)]
|
||||
pub struct Match3DRunProcedureResult {
|
||||
pub ok: bool,
|
||||
pub run_json: Option<String>,
|
||||
pub run: Option<Match3DRunSnapshot>,
|
||||
pub error_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, SpacetimeType)]
|
||||
#[derive(Clone, Debug, PartialEq, SpacetimeType)]
|
||||
pub struct Match3DClickItemProcedureResult {
|
||||
pub ok: bool,
|
||||
pub status: String,
|
||||
pub run_json: Option<String>,
|
||||
pub run: Option<Match3DRunSnapshot>,
|
||||
pub accepted_item_instance_id: Option<String>,
|
||||
pub cleared_item_instance_ids: Vec<String>,
|
||||
pub failure_reason: Option<String>,
|
||||
pub error_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, SpacetimeType)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Match3DCreatorConfigSnapshot {
|
||||
pub theme_text: String,
|
||||
@@ -235,7 +235,7 @@ pub struct Match3DCreatorConfigSnapshot {
|
||||
pub generate_click_sound: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, SpacetimeType)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Match3DAgentMessageSnapshot {
|
||||
pub message_id: String,
|
||||
@@ -246,7 +246,7 @@ pub struct Match3DAgentMessageSnapshot {
|
||||
pub created_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, SpacetimeType)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Match3DDraftSnapshot {
|
||||
pub profile_id: String,
|
||||
@@ -260,7 +260,7 @@ pub struct Match3DDraftSnapshot {
|
||||
pub generated_item_assets_json: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, SpacetimeType)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Match3DAgentSessionSnapshot {
|
||||
pub session_id: String,
|
||||
@@ -278,7 +278,7 @@ pub struct Match3DAgentSessionSnapshot {
|
||||
pub updated_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, SpacetimeType)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Match3DWorkSnapshot {
|
||||
pub profile_id: String,
|
||||
@@ -302,7 +302,7 @@ pub struct Match3DWorkSnapshot {
|
||||
pub generated_item_assets_json: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, SpacetimeType)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Match3DItemSnapshot {
|
||||
pub item_instance_id: String,
|
||||
@@ -316,7 +316,7 @@ pub struct Match3DItemSnapshot {
|
||||
pub clickable: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, SpacetimeType)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Match3DTraySlotSnapshot {
|
||||
pub slot_index: u32,
|
||||
@@ -325,7 +325,7 @@ pub struct Match3DTraySlotSnapshot {
|
||||
pub visual_key: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, SpacetimeType)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Match3DRunSnapshot {
|
||||
pub run_id: String,
|
||||
|
||||
Reference in New Issue
Block a user