mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Add dev-only factory ops for featuring a vehicle
This commit is contained in:
@@ -321,4 +321,16 @@ impl crate::VehicleFactoryAdapter for ArcAdapter {
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn set_featured(&self, id: i32, is_featured: bool) -> Result<(), Box<dyn std::error::Error>> {
|
||||
if self.is_readonly {
|
||||
return Ok(());
|
||||
}
|
||||
super::entities::robot_metadata::ActiveModel {
|
||||
id: sea_orm::ActiveValue::Set(id as u32),
|
||||
featured: sea_orm::ActiveValue::Set(is_featured as i32),
|
||||
..Default::default()
|
||||
}.update(&self.orm).await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ pub trait VehicleFactoryAdapter: Send + Sync + 'static {
|
||||
/// Just update any purchase trackers
|
||||
async fn purchase(&self, id: i32) -> Result<(), Box<dyn std::error::Error>>;
|
||||
async fn update_vehicle(&self, id: i32, cube_data: Option<Vec<u8>>, colour_data: Option<Vec<u8>>) -> Result<(), Box<dyn std::error::Error>>;
|
||||
async fn set_featured(&self, id: i32, is_featured: bool) -> Result<(), Box<dyn std::error::Error>>;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
||||
Reference in New Issue
Block a user