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

Switch factory trait over to i32 IDs

This commit is contained in:
NG (Graham)
2026-01-04 16:48:18 -05:00
parent 3015572170
commit 2e0c6b2b62
7 changed files with 9 additions and 9 deletions

View File

@@ -50,10 +50,10 @@ impl ArcAdapter {
#[async_trait::async_trait]
impl crate::VehicleFactoryAdapter for ArcAdapter {
async fn vehicle(&self, id: u32) -> Result<Option<(crate::VehicleInfo, crate::VehicleQueryInfo)>, Box<dyn std::error::Error>> {
async fn vehicle(&self, id: i32) -> Result<Option<(crate::VehicleInfo, crate::VehicleQueryInfo)>, Box<dyn std::error::Error>> {
log::debug!("Get vehicle by id {}", id);
let cubes = super::entities::robot_cubes::Entity::find_by_id(id).one(&self.orm);
let meta = super::entities::robot_metadata::Entity::find_by_id(id).one(&self.orm);
let cubes = super::entities::robot_cubes::Entity::find_by_id(id as u32).one(&self.orm);
let meta = super::entities::robot_metadata::Entity::find_by_id(id as u32).one(&self.orm);
let cubes = cubes.await?;
let meta = meta.await?;
if let (Some(cubes), Some(meta)) = (cubes, meta) {

View File

@@ -1,6 +1,6 @@
#[async_trait::async_trait]
pub trait VehicleFactoryAdapter: Send + Sync + 'static {
async fn vehicle(&self, id: u32) -> Result<Option<(VehicleInfo, VehicleQueryInfo)>, Box<dyn std::error::Error>>;
async fn vehicle(&self, id: i32) -> Result<Option<(VehicleInfo, VehicleQueryInfo)>, Box<dyn std::error::Error>>;
async fn list(&self, query: libfj::robocraft::ListQuery) -> Result<Vec<VehicleQueryInfo>, Box<dyn std::error::Error>>;
async fn upload(&self, vehicle: VehicleUploadInfo) -> Result<VehicleThumbnailInfo, Box<dyn std::error::Error>>;
async fn rate_vehicle(&self, id: i32, combat: i32, cosmetic: i32) -> Result<(), Box<dyn std::error::Error>>;