summaryrefslogtreecommitdiff
path: root/rust_backend/src/market/order.rs
diff options
context:
space:
mode:
authorkboz <kutayboz@gmail.com>2026-04-24 01:11:23 +0200
committerkboz <kutayboz@gmail.com>2026-04-24 01:11:23 +0200
commit29c4b57db9a34e0f815d93cac6a2cae543778a93 (patch)
tree68628e0b67353bcf74b5c516e5a2f0893cd598b7 /rust_backend/src/market/order.rs
parente43c98997b0de6a8da989f68d97f1d4f7fb7bb6f (diff)
downloadhaul-29c4b57db9a34e0f815d93cac6a2cae543778a93.tar.gz
build(core): adopt fork and remove experimental rust backendHEADmaster
- Added a 2026 copyright statement under the original creator's in `license.md` to properly establish new fork logic. - Updated `readme.md` to explicitly state this repository is a maintained fork. - Eliminated the `rust_backend/` directory, Actix codebase, and its associated launch configurations. - Purged all references specifying a Python/Rust/React tri-split from `AGENTS.md` and the frontend `.instructions.md` configuration. Co-authored-by: Copilot <copilot@github.com>
Diffstat (limited to 'rust_backend/src/market/order.rs')
-rw-r--r--rust_backend/src/market/order.rs83
1 files changed, 0 insertions, 83 deletions
diff --git a/rust_backend/src/market/order.rs b/rust_backend/src/market/order.rs
deleted file mode 100644
index 6dbbcf6..0000000
--- a/rust_backend/src/market/order.rs
+++ /dev/null
@@ -1,83 +0,0 @@
-use std::error::Error;
-use std::collections::HashMap;
-
-use chrono::{DateTime, Utc};
-use serde::{Deserialize, Serialize};
-
-use crate::eve_service::EveService;
-
-
-#[derive(Debug, Serialize, Deserialize, Clone)]
-pub struct Order {
- duration: u64,
- is_buy_order: bool,
- issued: DateTime<Utc>,
- location_id: u64,
- min_volume: u64,
- order_id: u64,
- price: f64,
- range: String,
- system_id: u64,
- type_id: u64,
- volume_remain: u64,
- volume_total: u64
-}
-
-const REGIONS: [u64; 1] = [10000033];
-
-#[derive(Clone, Serialize)]
-pub struct Orders {
- region_orders: HashMap<u64, Vec<Order>>,
- expiry_times: HashMap<u64, DateTime<Utc>>, // region_id to expiration time
-}
-
-
-impl Orders {
- pub fn new() -> Self {
- Orders {
- region_orders: HashMap::new(),
- expiry_times: HashMap::new(),
- }
- }
-
- pub fn insert(&mut self, region: u64, orders: Vec<Order>, expiry: DateTime<Utc>) {
- self.region_orders.insert(region, orders);
- self.expiry_times.insert(region, expiry);
- }
-
- pub fn expired_regions(&self) -> Vec<u64> {
- let current_time = Utc::now();
-
- println!("expiry: {:?}, time now: {:?}", &self.expiry_times, &current_time);
-
- let mut expired: Vec<u64> = self.expiry_times.iter()
- .filter(|&(_region_id, &expiry_time)| expiry_time < current_time)
- .map(|(&region_id, _)| region_id)
- .collect();
-
- for &region in REGIONS.iter() {
- if !self.expiry_times.contains_key(&region) {
- expired.push(region);
- }
- }
-
-
- expired
-
- }
-
- pub fn update(&mut self, updated_orders: Orders) {
- for (key, value) in updated_orders.region_orders {
- self.region_orders.insert(key, value);
-
- if let Some(expiry_time) = updated_orders.expiry_times.get(&key) {
- self.expiry_times.insert(key, *expiry_time);
- }
- }
- }
-
-
- pub fn orders(&self) -> Vec<Order> {
- self.region_orders.values().flat_map(|orders| orders.clone()).collect()
- }
-} \ No newline at end of file