1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Add slot renaming op code support to fix #24

This commit is contained in:
NG (Graham)
2025-05-31 15:36:33 -04:00
parent 299c15c6da
commit f117fd3d2a
4 changed files with 45 additions and 0 deletions

View File

@@ -694,6 +694,18 @@ impl <C: Clone> super::User<C> for UserData {
}
}
async fn set_slot_name(&self, slot: i32, name: String) -> Result<(), i16> {
let to_save = rc_database::schema::garage::ActiveModel {
name: rc_database::sea_orm::ActiveValue::Set(name),
..Default::default()
};
self.db.update_garage_by_user_id_and_slot(to_save, self.account.id, slot as u32).await.map_err(|e| {
log::error!("Failed to save garage {} for user_id {}: {}", slot, self.account.id, e);
DATABASE_ERR
})?;
Ok(())
}
fn signup_date(&self) -> i64 {
super::since_windows_epoch(self.account.creation_time)
}

View File

@@ -72,6 +72,7 @@ pub trait User<C>: ChatUser {
async fn save_slot_controls(&self, controls: ControlData) -> Result<(), i16>;
async fn save_slot_customisations(&self, customs: CustomisationData) -> Result<(), i16>;
async fn get_slot_customisations(&self, uuid: &str) -> Result<GetCustomisationData<C>, i16>;
async fn set_slot_name(&self, slot: i32, name: String) -> Result<(), i16>;
fn signup_date(&self) -> i64;
async fn singleplayer_robots(&self, factory: &dyn rc_factory::VehicleFactoryAdapter, weapon_order: &crate::cubes::WeaponListParser) -> Result<polariton::operation::Typed<C>, i16>;
async fn prepare_factory_upload(&self, vehicle: VehicleUploadData) -> Result<rc_factory::VehicleUploadInfo, i16>;