feat: add AED currency support and user node groups
This commit is contained in:
@@ -38,14 +38,11 @@ This document outlines the comprehensive redesign of the Project Mycelium market
|
||||
- [ ] **Implement Mycelium Credit (MC)**
|
||||
- [ ] Update currency service to use MC as base
|
||||
- [ ] Set initial exchange rate: 1 MC = 1 USD
|
||||
- [ ] Update currency conversion logic
|
||||
- [ ] Update pricing calculations
|
||||
- [ ] Update currency conversion logic if needed
|
||||
- [ ] Update pricing calculations if needed
|
||||
|
||||
- [ ] **Currency Display Preferences**
|
||||
- [ ] Add AED to supported currencies
|
||||
- [ ] Update settings page with currency selector
|
||||
- [ ] Implement currency preference persistence
|
||||
- [ ] Update currency display throughout UI
|
||||
- [ ] Add AED to supported currencies (see /dashboard/settings Currency Preferences)
|
||||
|
||||
### 3. Statistics & Grid Integration
|
||||
- [ ] **TF Grid Statistics**
|
||||
|
@@ -134,6 +134,18 @@ impl CurrencyService {
|
||||
provider_config: None,
|
||||
last_updated: chrono::Utc::now(),
|
||||
},
|
||||
Currency {
|
||||
code: "AED".to_string(),
|
||||
name: "UAE Dirham".to_string(),
|
||||
symbol: "د.إ".to_string(),
|
||||
currency_type: crate::models::currency::CurrencyType::Fiat,
|
||||
exchange_rate_to_base: dec!(3.67),
|
||||
is_base_currency: false,
|
||||
decimal_places: 2,
|
||||
is_active: true,
|
||||
provider_config: None,
|
||||
last_updated: chrono::Utc::now(),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
|
@@ -263,7 +263,7 @@
|
||||
<select class="form-select" id="paymentCurrency">
|
||||
<option value="USD" selected>USD</option>
|
||||
<option value="EUR">EUR</option>
|
||||
<option value="GBP">GBP</option>
|
||||
<option value="AED">AED</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
@@ -321,7 +321,7 @@
|
||||
<select class="form-select" id="receiveCurrency">
|
||||
<option value="USD" selected>USD</option>
|
||||
<option value="EUR">EUR</option>
|
||||
<option value="GBP">GBP</option>
|
||||
<option value="AED">AED</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
|
@@ -418,6 +418,7 @@
|
||||
<option value="MC" {% if user_display_currency == "MC" %}selected{% endif %}>MC - Mycelium Credit</option>
|
||||
<option value="EUR" {% if user_display_currency == "EUR" %}selected{% endif %}>EUR - Euro</option>
|
||||
<option value="CAD" {% if user_display_currency == "CAD" %}selected{% endif %}>CAD - Canadian Dollar</option>
|
||||
<option value="AED" {% if user_display_currency == "AED" %}selected{% endif %}>AED - UAE Dirham</option>
|
||||
</select>
|
||||
<small class="text-muted">Choose your preferred currency for displaying prices in the marketplace</small>
|
||||
</div>
|
||||
|
@@ -74,7 +74,7 @@
|
||||
<select class="form-select" id="topupCurrency">
|
||||
<option value="USD" selected>USD ($)</option>
|
||||
<option value="EUR">EUR (€)</option>
|
||||
<option value="USD">USD</option>
|
||||
<option value="AED">AED (د.إ)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
|
22
test_aed_currency.rs
Normal file
22
test_aed_currency.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
use rust_decimal::Decimal;
|
||||
use rust_decimal_macros::dec;
|
||||
|
||||
fn main() {
|
||||
// Test AED currency conversion
|
||||
let usd_amount = dec!(100.0); // 100 USD
|
||||
let aed_rate = dec!(3.67); // 1 USD = 3.67 AED
|
||||
|
||||
// Convert USD to AED
|
||||
let aed_amount = usd_amount * aed_rate;
|
||||
println!("100 USD = {:.2} AED", aed_amount);
|
||||
|
||||
// Convert AED back to USD
|
||||
let usd_converted_back = aed_amount / aed_rate;
|
||||
println!("{:.2} AED = {:.2} USD", aed_amount, usd_converted_back);
|
||||
|
||||
// Test formatting
|
||||
println!("Formatted AED: د.إ{:.2}", aed_amount);
|
||||
println!("Formatted USD: ${:.2}", usd_amount);
|
||||
|
||||
println!("AED currency test completed successfully!");
|
||||
}
|
@@ -97,10 +97,94 @@
|
||||
"active_product_rentals": [],
|
||||
"resource_provider_rental_earnings": [],
|
||||
"node_rentals": [],
|
||||
"node_groups": [],
|
||||
"node_groups": [
|
||||
{
|
||||
"id": "compute",
|
||||
"name": "Compute",
|
||||
"description": "General compute workloads",
|
||||
"node_ids": [],
|
||||
"group_type": {
|
||||
"Default": "compute"
|
||||
},
|
||||
"updated_at": "2025-09-08T18:44:31.238377407Z",
|
||||
"created_at": "2025-09-08T18:44:31.238375624Z",
|
||||
"group_config": {
|
||||
"group_name": "Compute Nodes",
|
||||
"max_nodes": 100,
|
||||
"allocation_strategy": "balanced",
|
||||
"auto_scaling": true,
|
||||
"preferred_slice_formats": [
|
||||
"1x1",
|
||||
"2x2"
|
||||
],
|
||||
"default_pricing": 50.0,
|
||||
"resource_optimization": {
|
||||
"cpu_optimization": 0.5,
|
||||
"memory_optimization": 0.5,
|
||||
"storage_optimization": 0.5,
|
||||
"network_optimization": 0.5
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "storage",
|
||||
"name": "Storage",
|
||||
"description": "Storage and data workloads",
|
||||
"node_ids": [],
|
||||
"group_type": {
|
||||
"Default": "storage"
|
||||
},
|
||||
"updated_at": "2025-09-08T18:44:31.238384425Z",
|
||||
"created_at": "2025-09-08T18:44:31.238383997Z",
|
||||
"group_config": {
|
||||
"group_name": "Storage Nodes",
|
||||
"max_nodes": 50,
|
||||
"allocation_strategy": "storage_optimized",
|
||||
"auto_scaling": false,
|
||||
"preferred_slice_formats": [
|
||||
"1x1"
|
||||
],
|
||||
"default_pricing": 30.0,
|
||||
"resource_optimization": {
|
||||
"cpu_optimization": 0.3,
|
||||
"memory_optimization": 0.3,
|
||||
"storage_optimization": 0.8,
|
||||
"network_optimization": 0.6
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "ai-gpu",
|
||||
"name": "AI/GPU",
|
||||
"description": "AI and GPU-intensive workloads",
|
||||
"node_ids": [],
|
||||
"group_type": {
|
||||
"Default": "ai-gpu"
|
||||
},
|
||||
"updated_at": "2025-09-08T18:44:31.238388576Z",
|
||||
"created_at": "2025-09-08T18:44:31.238388156Z",
|
||||
"group_config": {
|
||||
"group_name": "AI/GPU Nodes",
|
||||
"max_nodes": 20,
|
||||
"allocation_strategy": "gpu_optimized",
|
||||
"auto_scaling": true,
|
||||
"preferred_slice_formats": [
|
||||
"4x4",
|
||||
"8x8"
|
||||
],
|
||||
"default_pricing": 200.0,
|
||||
"resource_optimization": {
|
||||
"cpu_optimization": 0.8,
|
||||
"memory_optimization": 0.7,
|
||||
"storage_optimization": 0.4,
|
||||
"network_optimization": 0.5
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"slice_rentals": [],
|
||||
"slice_assignments": [],
|
||||
"display_currency": "USD",
|
||||
"display_currency": "AED",
|
||||
"quick_topup_amounts": [
|
||||
10.0,
|
||||
25.0,
|
||||
|
Reference in New Issue
Block a user