fix: polish bark battle creation flow

This commit is contained in:
kdletters
2026-05-22 05:00:07 +08:00
parent 01da85a577
commit bf82f04b64
73 changed files with 9362 additions and 2663 deletions

View File

@@ -13,7 +13,6 @@ pub struct BarkBattleDraftConfigSnapshot {
pub config_version: u64,
pub ruleset_version: String,
pub difficulty_preset: String,
pub leaderboard_enabled: bool,
pub config_json: String,
pub editor_state_json: String,
pub created_at_micros: i64,

View File

@@ -13,7 +13,6 @@ pub struct BarkBattleDraftConfigUpsertInput {
pub config_version: u64,
pub ruleset_version: String,
pub difficulty_preset: String,
pub leaderboard_enabled: bool,
pub config_json: String,
pub updated_at_micros: i64,
}

View File

@@ -12,11 +12,10 @@ pub struct BarkBattleDraftCreateInput {
pub work_id: String,
pub title: Option<String>,
pub description: Option<String>,
pub theme_preset: String,
pub player_dog_skin_preset: String,
pub opponent_dog_skin_preset: String,
pub theme_description: String,
pub player_image_description: String,
pub opponent_image_description: String,
pub difficulty_preset: Option<String>,
pub leaderboard_enabled: Option<bool>,
pub editor_state_json: Option<String>,
pub created_at_micros: i64,
}

View File

@@ -0,0 +1,106 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct BarkBattleGalleryViewRow {
pub work_id: String,
pub owner_user_id: String,
pub source_draft_id: Option<String>,
pub config_version: u64,
pub ruleset_version: String,
pub difficulty_preset: String,
pub title: String,
pub description: String,
pub theme_description: String,
pub player_image_description: String,
pub opponent_image_description: String,
pub onomatopoeia: Vec<String>,
pub player_character_image_src: Option<String>,
pub opponent_character_image_src: Option<String>,
pub ui_background_image_src: Option<String>,
pub play_count: u64,
pub finish_count: u64,
pub updated_at_micros: i64,
pub published_at_micros: i64,
}
impl __sdk::InModule for BarkBattleGalleryViewRow {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `BarkBattleGalleryViewRow`.
///
/// Provides typed access to columns for query building.
pub struct BarkBattleGalleryViewRowCols {
pub work_id: __sdk::__query_builder::Col<BarkBattleGalleryViewRow, String>,
pub owner_user_id: __sdk::__query_builder::Col<BarkBattleGalleryViewRow, String>,
pub source_draft_id: __sdk::__query_builder::Col<BarkBattleGalleryViewRow, Option<String>>,
pub config_version: __sdk::__query_builder::Col<BarkBattleGalleryViewRow, u64>,
pub ruleset_version: __sdk::__query_builder::Col<BarkBattleGalleryViewRow, String>,
pub difficulty_preset: __sdk::__query_builder::Col<BarkBattleGalleryViewRow, String>,
pub title: __sdk::__query_builder::Col<BarkBattleGalleryViewRow, String>,
pub description: __sdk::__query_builder::Col<BarkBattleGalleryViewRow, String>,
pub theme_description: __sdk::__query_builder::Col<BarkBattleGalleryViewRow, String>,
pub player_image_description: __sdk::__query_builder::Col<BarkBattleGalleryViewRow, String>,
pub opponent_image_description: __sdk::__query_builder::Col<BarkBattleGalleryViewRow, String>,
pub onomatopoeia: __sdk::__query_builder::Col<BarkBattleGalleryViewRow, Vec<String>>,
pub player_character_image_src:
__sdk::__query_builder::Col<BarkBattleGalleryViewRow, Option<String>>,
pub opponent_character_image_src:
__sdk::__query_builder::Col<BarkBattleGalleryViewRow, Option<String>>,
pub ui_background_image_src:
__sdk::__query_builder::Col<BarkBattleGalleryViewRow, Option<String>>,
pub play_count: __sdk::__query_builder::Col<BarkBattleGalleryViewRow, u64>,
pub finish_count: __sdk::__query_builder::Col<BarkBattleGalleryViewRow, u64>,
pub updated_at_micros: __sdk::__query_builder::Col<BarkBattleGalleryViewRow, i64>,
pub published_at_micros: __sdk::__query_builder::Col<BarkBattleGalleryViewRow, i64>,
}
impl __sdk::__query_builder::HasCols for BarkBattleGalleryViewRow {
type Cols = BarkBattleGalleryViewRowCols;
fn cols(table_name: &'static str) -> Self::Cols {
BarkBattleGalleryViewRowCols {
work_id: __sdk::__query_builder::Col::new(table_name, "work_id"),
owner_user_id: __sdk::__query_builder::Col::new(table_name, "owner_user_id"),
source_draft_id: __sdk::__query_builder::Col::new(table_name, "source_draft_id"),
config_version: __sdk::__query_builder::Col::new(table_name, "config_version"),
ruleset_version: __sdk::__query_builder::Col::new(table_name, "ruleset_version"),
difficulty_preset: __sdk::__query_builder::Col::new(table_name, "difficulty_preset"),
title: __sdk::__query_builder::Col::new(table_name, "title"),
description: __sdk::__query_builder::Col::new(table_name, "description"),
theme_description: __sdk::__query_builder::Col::new(table_name, "theme_description"),
player_image_description: __sdk::__query_builder::Col::new(
table_name,
"player_image_description",
),
opponent_image_description: __sdk::__query_builder::Col::new(
table_name,
"opponent_image_description",
),
onomatopoeia: __sdk::__query_builder::Col::new(table_name, "onomatopoeia"),
player_character_image_src: __sdk::__query_builder::Col::new(
table_name,
"player_character_image_src",
),
opponent_character_image_src: __sdk::__query_builder::Col::new(
table_name,
"opponent_character_image_src",
),
ui_background_image_src: __sdk::__query_builder::Col::new(
table_name,
"ui_background_image_src",
),
play_count: __sdk::__query_builder::Col::new(table_name, "play_count"),
finish_count: __sdk::__query_builder::Col::new(table_name, "finish_count"),
updated_at_micros: __sdk::__query_builder::Col::new(table_name, "updated_at_micros"),
published_at_micros: __sdk::__query_builder::Col::new(
table_name,
"published_at_micros",
),
}
}
}

View File

@@ -0,0 +1,114 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use super::bark_battle_gallery_view_row_type::BarkBattleGalleryViewRow;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `bark_battle_gallery_view`.
///
/// Obtain a handle from the [`BarkBattleGalleryViewTableAccess::bark_battle_gallery_view`] method on [`super::RemoteTables`],
/// like `ctx.db.bark_battle_gallery_view()`.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.bark_battle_gallery_view().on_insert(...)`.
pub struct BarkBattleGalleryViewTableHandle<'ctx> {
imp: __sdk::TableHandle<BarkBattleGalleryViewRow>,
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the table `bark_battle_gallery_view`.
///
/// Implemented for [`super::RemoteTables`].
pub trait BarkBattleGalleryViewTableAccess {
#[allow(non_snake_case)]
/// Obtain a [`BarkBattleGalleryViewTableHandle`], which mediates access to the table `bark_battle_gallery_view`.
fn bark_battle_gallery_view(&self) -> BarkBattleGalleryViewTableHandle<'_>;
}
impl BarkBattleGalleryViewTableAccess for super::RemoteTables {
fn bark_battle_gallery_view(&self) -> BarkBattleGalleryViewTableHandle<'_> {
BarkBattleGalleryViewTableHandle {
imp: self
.imp
.get_table::<BarkBattleGalleryViewRow>("bark_battle_gallery_view"),
ctx: std::marker::PhantomData,
}
}
}
pub struct BarkBattleGalleryViewInsertCallbackId(__sdk::CallbackId);
pub struct BarkBattleGalleryViewDeleteCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::Table for BarkBattleGalleryViewTableHandle<'ctx> {
type Row = BarkBattleGalleryViewRow;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = BarkBattleGalleryViewRow> + '_ {
self.imp.iter()
}
type InsertCallbackId = BarkBattleGalleryViewInsertCallbackId;
fn on_insert(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> BarkBattleGalleryViewInsertCallbackId {
BarkBattleGalleryViewInsertCallbackId(self.imp.on_insert(Box::new(callback)))
}
fn remove_on_insert(&self, callback: BarkBattleGalleryViewInsertCallbackId) {
self.imp.remove_on_insert(callback.0)
}
type DeleteCallbackId = BarkBattleGalleryViewDeleteCallbackId;
fn on_delete(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> BarkBattleGalleryViewDeleteCallbackId {
BarkBattleGalleryViewDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
}
fn remove_on_delete(&self, callback: BarkBattleGalleryViewDeleteCallbackId) {
self.imp.remove_on_delete(callback.0)
}
}
#[doc(hidden)]
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
let _table =
client_cache.get_or_make_table::<BarkBattleGalleryViewRow>("bark_battle_gallery_view");
}
#[doc(hidden)]
pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<BarkBattleGalleryViewRow>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<BarkBattleGalleryViewRow>", "TableUpdate")
.with_cause(e)
.into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `BarkBattleGalleryViewRow`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait bark_battle_gallery_viewQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `BarkBattleGalleryViewRow`.
fn bark_battle_gallery_view(&self) -> __sdk::__query_builder::Table<BarkBattleGalleryViewRow>;
}
impl bark_battle_gallery_viewQueryTableAccess for __sdk::QueryTableAccessor {
fn bark_battle_gallery_view(&self) -> __sdk::__query_builder::Table<BarkBattleGalleryViewRow> {
__sdk::__query_builder::Table::new("bark_battle_gallery_view")
}
}

View File

@@ -13,7 +13,6 @@ pub struct BarkBattleRunSnapshot {
pub config_version: u64,
pub ruleset_version: String,
pub difficulty_preset: String,
pub leaderboard_enabled: bool,
pub status: String,
pub client_started_at_micros: i64,
pub server_started_at_micros: i64,

View File

@@ -13,7 +13,6 @@ pub struct BarkBattleRuntimeConfigSnapshot {
pub config_version: u64,
pub ruleset_version: String,
pub difficulty_preset: String,
pub leaderboard_enabled: bool,
pub config_json: String,
pub published_snapshot_json: String,
pub published_at_micros: i64,