Switch factory trait over to i32 IDs

This commit is contained in:
NG (Graham) committed 2026-01-04 16:48:18 -05:00
1 parent 3015572170
commit 2e0c6b2b62
7 files changed
+9 -9

No files matched your search

+3 -3
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) {
+1 -1
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>>;