feat: add wooden fish play template
This commit is contained in:
85
server-rs/crates/spacetime-module/src/wooden_fish/tables.rs
Normal file
85
server-rs/crates/spacetime-module/src/wooden_fish/tables.rs
Normal file
@@ -0,0 +1,85 @@
|
||||
use crate::*;
|
||||
|
||||
#[spacetimedb::table(
|
||||
accessor = wooden_fish_agent_session,
|
||||
index(accessor = by_wooden_fish_agent_session_owner_user_id, btree(columns = [owner_user_id]))
|
||||
)]
|
||||
pub struct WoodenFishAgentSessionRow {
|
||||
#[primary_key]
|
||||
pub(crate) session_id: String,
|
||||
pub(crate) owner_user_id: String,
|
||||
pub(crate) current_turn: u32,
|
||||
pub(crate) progress_percent: u32,
|
||||
pub(crate) stage: String,
|
||||
pub(crate) config_json: String,
|
||||
pub(crate) draft_json: String,
|
||||
pub(crate) published_profile_id: String,
|
||||
pub(crate) created_at: Timestamp,
|
||||
pub(crate) updated_at: Timestamp,
|
||||
}
|
||||
|
||||
#[spacetimedb::table(
|
||||
accessor = wooden_fish_work_profile,
|
||||
index(accessor = by_wooden_fish_work_owner_user_id, btree(columns = [owner_user_id])),
|
||||
index(accessor = by_wooden_fish_work_publication_status, btree(columns = [publication_status]))
|
||||
)]
|
||||
pub struct WoodenFishWorkProfileRow {
|
||||
#[primary_key]
|
||||
pub(crate) profile_id: String,
|
||||
pub(crate) work_id: String,
|
||||
pub(crate) owner_user_id: String,
|
||||
pub(crate) source_session_id: String,
|
||||
pub(crate) author_display_name: String,
|
||||
pub(crate) work_title: String,
|
||||
pub(crate) work_description: String,
|
||||
pub(crate) theme_tags_json: String,
|
||||
pub(crate) hit_object_prompt: String,
|
||||
pub(crate) hit_object_reference_image_src: String,
|
||||
pub(crate) hit_sound_prompt: String,
|
||||
pub(crate) hit_object_asset_json: String,
|
||||
pub(crate) hit_sound_asset_json: String,
|
||||
pub(crate) floating_words_json: String,
|
||||
pub(crate) cover_image_src: String,
|
||||
pub(crate) generation_status: String,
|
||||
pub(crate) publication_status: String,
|
||||
pub(crate) play_count: u32,
|
||||
pub(crate) updated_at: Timestamp,
|
||||
pub(crate) published_at: Option<Timestamp>,
|
||||
}
|
||||
|
||||
#[spacetimedb::table(
|
||||
accessor = wooden_fish_runtime_run,
|
||||
index(accessor = by_wooden_fish_run_owner_user_id, btree(columns = [owner_user_id])),
|
||||
index(accessor = by_wooden_fish_run_profile_id, btree(columns = [profile_id]))
|
||||
)]
|
||||
pub struct WoodenFishRuntimeRunRow {
|
||||
#[primary_key]
|
||||
pub(crate) run_id: String,
|
||||
pub(crate) owner_user_id: String,
|
||||
pub(crate) profile_id: String,
|
||||
pub(crate) status: String,
|
||||
pub(crate) total_tap_count: u32,
|
||||
pub(crate) word_counters_json: String,
|
||||
pub(crate) started_at_ms: i64,
|
||||
pub(crate) updated_at_ms: i64,
|
||||
pub(crate) finished_at_ms: i64,
|
||||
pub(crate) snapshot_json: String,
|
||||
pub(crate) created_at: Timestamp,
|
||||
pub(crate) updated_at: Timestamp,
|
||||
}
|
||||
|
||||
#[spacetimedb::table(
|
||||
accessor = wooden_fish_event,
|
||||
index(accessor = by_wooden_fish_event_profile_id, btree(columns = [profile_id])),
|
||||
index(accessor = by_wooden_fish_event_run_id, btree(columns = [run_id]))
|
||||
)]
|
||||
pub struct WoodenFishEventRow {
|
||||
#[primary_key]
|
||||
pub(crate) event_id: String,
|
||||
pub(crate) owner_user_id: String,
|
||||
pub(crate) profile_id: String,
|
||||
pub(crate) run_id: String,
|
||||
pub(crate) event_type: String,
|
||||
pub(crate) result: String,
|
||||
pub(crate) occurred_at: Timestamp,
|
||||
}
|
||||
254
server-rs/crates/spacetime-module/src/wooden_fish/types.rs
Normal file
254
server-rs/crates/spacetime-module/src/wooden_fish/types.rs
Normal file
@@ -0,0 +1,254 @@
|
||||
use crate::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub const WOODEN_FISH_TEMPLATE_ID: &str = "wooden-fish";
|
||||
pub const WOODEN_FISH_TEMPLATE_NAME: &str = "敲木鱼";
|
||||
pub const WOODEN_FISH_STAGE_COLLECTING: &str = "Collecting";
|
||||
pub const WOODEN_FISH_STAGE_DRAFT_COMPILED: &str = "DraftCompiled";
|
||||
pub const WOODEN_FISH_STAGE_PUBLISHED: &str = "Published";
|
||||
pub const WOODEN_FISH_PUBLICATION_DRAFT: &str = "Draft";
|
||||
pub const WOODEN_FISH_PUBLICATION_PUBLISHED: &str = "Published";
|
||||
pub const WOODEN_FISH_GENERATION_DRAFT: &str = "draft";
|
||||
pub const WOODEN_FISH_GENERATION_READY: &str = "ready";
|
||||
pub const WOODEN_FISH_EVENT_RUN_STARTED: &str = "run-started";
|
||||
pub const WOODEN_FISH_EVENT_RUN_CHECKPOINT: &str = "checkpoint";
|
||||
pub const WOODEN_FISH_EVENT_RUN_FINISHED: &str = "finish";
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, SpacetimeType)]
|
||||
pub struct WoodenFishAgentSessionCreateInput {
|
||||
pub session_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub work_title: String,
|
||||
pub work_description: String,
|
||||
pub theme_tags_json: Option<String>,
|
||||
pub config_json: Option<String>,
|
||||
pub draft_json: Option<String>,
|
||||
pub created_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, SpacetimeType)]
|
||||
pub struct WoodenFishAgentSessionGetInput {
|
||||
pub session_id: String,
|
||||
pub owner_user_id: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, SpacetimeType)]
|
||||
pub struct WoodenFishDraftCompileInput {
|
||||
pub session_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub profile_id: String,
|
||||
pub author_display_name: String,
|
||||
pub work_title: String,
|
||||
pub work_description: String,
|
||||
pub theme_tags_json: Option<String>,
|
||||
pub hit_object_prompt: String,
|
||||
pub hit_object_reference_image_src: Option<String>,
|
||||
pub hit_sound_prompt: Option<String>,
|
||||
pub hit_object_asset_json: Option<String>,
|
||||
pub hit_sound_asset_json: Option<String>,
|
||||
pub floating_words_json: Option<String>,
|
||||
pub cover_image_src: Option<String>,
|
||||
pub generation_status: Option<String>,
|
||||
pub compiled_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, SpacetimeType)]
|
||||
pub struct WoodenFishWorkUpdateInput {
|
||||
pub profile_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub work_title: String,
|
||||
pub work_description: String,
|
||||
pub theme_tags_json: String,
|
||||
pub hit_object_prompt: Option<String>,
|
||||
pub hit_object_reference_image_src: Option<String>,
|
||||
pub hit_sound_prompt: Option<String>,
|
||||
pub hit_object_asset_json: Option<String>,
|
||||
pub hit_sound_asset_json: Option<String>,
|
||||
pub floating_words_json: Option<String>,
|
||||
pub cover_image_src: Option<String>,
|
||||
pub generation_status: Option<String>,
|
||||
pub updated_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, SpacetimeType)]
|
||||
pub struct WoodenFishWorkPublishInput {
|
||||
pub profile_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub published_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, SpacetimeType)]
|
||||
pub struct WoodenFishWorksListInput {
|
||||
pub owner_user_id: String,
|
||||
pub published_only: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, SpacetimeType)]
|
||||
pub struct WoodenFishWorkGetInput {
|
||||
pub profile_id: String,
|
||||
pub owner_user_id: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, SpacetimeType)]
|
||||
pub struct WoodenFishRunStartInput {
|
||||
pub run_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub profile_id: String,
|
||||
pub client_event_id: String,
|
||||
pub started_at_ms: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, SpacetimeType)]
|
||||
pub struct WoodenFishRunGetInput {
|
||||
pub run_id: String,
|
||||
pub owner_user_id: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, SpacetimeType)]
|
||||
pub struct WoodenFishRunCheckpointInput {
|
||||
pub run_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub total_tap_count: u32,
|
||||
pub word_counters_json: String,
|
||||
pub client_event_id: String,
|
||||
pub checkpoint_at_ms: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, SpacetimeType)]
|
||||
pub struct WoodenFishRunFinishInput {
|
||||
pub run_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub total_tap_count: u32,
|
||||
pub word_counters_json: String,
|
||||
pub client_event_id: String,
|
||||
pub finished_at_ms: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, SpacetimeType)]
|
||||
pub struct WoodenFishAgentSessionProcedureResult {
|
||||
pub ok: bool,
|
||||
pub session: Option<WoodenFishAgentSessionSnapshot>,
|
||||
pub error_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, SpacetimeType)]
|
||||
pub struct WoodenFishWorkProcedureResult {
|
||||
pub ok: bool,
|
||||
pub work: Option<WoodenFishWorkSnapshot>,
|
||||
pub error_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, SpacetimeType)]
|
||||
pub struct WoodenFishWorksProcedureResult {
|
||||
pub ok: bool,
|
||||
pub items: Vec<WoodenFishWorkSnapshot>,
|
||||
pub error_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, SpacetimeType)]
|
||||
pub struct WoodenFishRunProcedureResult {
|
||||
pub ok: bool,
|
||||
pub run: Option<module_wooden_fish::WoodenFishRunSnapshot>,
|
||||
pub error_message: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, SpacetimeType)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct WoodenFishCreatorConfigSnapshot {
|
||||
pub work_title: String,
|
||||
pub work_description: String,
|
||||
pub theme_tags: Vec<String>,
|
||||
pub hit_object_prompt: String,
|
||||
#[serde(default)]
|
||||
pub hit_object_reference_image_src: Option<String>,
|
||||
#[serde(default)]
|
||||
pub hit_sound_prompt: Option<String>,
|
||||
pub floating_words: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, SpacetimeType)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct WoodenFishImageAssetSnapshot {
|
||||
pub asset_id: String,
|
||||
pub image_src: String,
|
||||
pub image_object_key: String,
|
||||
pub asset_object_id: String,
|
||||
pub generation_provider: String,
|
||||
pub prompt: String,
|
||||
pub width: u32,
|
||||
pub height: u32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, SpacetimeType)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct WoodenFishAudioAssetSnapshot {
|
||||
pub asset_id: String,
|
||||
pub audio_src: String,
|
||||
pub audio_object_key: String,
|
||||
pub asset_object_id: String,
|
||||
pub source: String,
|
||||
#[serde(default)]
|
||||
pub prompt: Option<String>,
|
||||
#[serde(default)]
|
||||
pub duration_ms: Option<u32>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, SpacetimeType)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct WoodenFishDraftSnapshot {
|
||||
pub template_id: String,
|
||||
pub template_name: String,
|
||||
pub profile_id: Option<String>,
|
||||
pub work_title: String,
|
||||
pub work_description: String,
|
||||
pub theme_tags: Vec<String>,
|
||||
pub hit_object_prompt: String,
|
||||
pub hit_object_reference_image_src: Option<String>,
|
||||
pub hit_sound_prompt: Option<String>,
|
||||
pub floating_words: Vec<String>,
|
||||
pub hit_object_asset: Option<WoodenFishImageAssetSnapshot>,
|
||||
pub hit_sound_asset: Option<WoodenFishAudioAssetSnapshot>,
|
||||
pub cover_image_src: Option<String>,
|
||||
pub generation_status: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, SpacetimeType)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct WoodenFishAgentSessionSnapshot {
|
||||
pub session_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub current_turn: u32,
|
||||
pub progress_percent: u32,
|
||||
pub stage: String,
|
||||
pub config: WoodenFishCreatorConfigSnapshot,
|
||||
pub draft: Option<WoodenFishDraftSnapshot>,
|
||||
pub published_profile_id: Option<String>,
|
||||
pub created_at_micros: i64,
|
||||
pub updated_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, SpacetimeType)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct WoodenFishWorkSnapshot {
|
||||
pub work_id: String,
|
||||
pub profile_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub source_session_id: String,
|
||||
pub author_display_name: String,
|
||||
pub work_title: String,
|
||||
pub work_description: String,
|
||||
pub theme_tags: Vec<String>,
|
||||
pub hit_object_prompt: String,
|
||||
pub hit_object_reference_image_src: Option<String>,
|
||||
pub hit_sound_prompt: Option<String>,
|
||||
pub hit_object_asset: Option<WoodenFishImageAssetSnapshot>,
|
||||
pub hit_sound_asset: Option<WoodenFishAudioAssetSnapshot>,
|
||||
pub floating_words: Vec<String>,
|
||||
pub cover_image_src: String,
|
||||
pub publication_status: String,
|
||||
pub publish_ready: bool,
|
||||
pub play_count: u32,
|
||||
pub generation_status: String,
|
||||
pub updated_at_micros: i64,
|
||||
pub published_at_micros: Option<i64>,
|
||||
}
|
||||
Reference in New Issue
Block a user