feat: rename farmer to resource provider across codebase and update terminology
This commit is contained in:
@@ -1234,11 +1234,11 @@ impl SessionDataBuilder {
|
||||
|
||||
// MockDataBuilder removed - using persistent data only
|
||||
// =============================================================================
|
||||
// FARMER DATA BUILDER
|
||||
// RESOURCE_PROVIDER DATA BUILDER
|
||||
// =============================================================================
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FarmerDataBuilder {
|
||||
pub struct ResourceProviderDataBuilder {
|
||||
total_nodes: Option<i32>,
|
||||
online_nodes: Option<i32>,
|
||||
total_capacity: Option<crate::models::user::NodeCapacity>,
|
||||
@@ -1251,7 +1251,7 @@ pub struct FarmerDataBuilder {
|
||||
active_slices: Option<i32>,
|
||||
}
|
||||
|
||||
impl FarmerDataBuilder {
|
||||
impl ResourceProviderDataBuilder {
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
@@ -1373,8 +1373,8 @@ impl FarmerDataBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn build(self) -> Result<crate::models::user::FarmerData, String> {
|
||||
Ok(crate::models::user::FarmerData {
|
||||
pub fn build(self) -> Result<crate::models::user::ResourceProviderData, String> {
|
||||
Ok(crate::models::user::ResourceProviderData {
|
||||
total_nodes: self.total_nodes.unwrap_or(0),
|
||||
online_nodes: self.online_nodes.unwrap_or(0),
|
||||
total_capacity: self.total_capacity.unwrap_or(crate::models::user::NodeCapacity {
|
||||
@@ -1445,8 +1445,8 @@ impl FarmerDataBuilder {
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct SliceProductBuilder {
|
||||
farmer_id: Option<String>,
|
||||
farmer_name: Option<String>,
|
||||
resource_provider_id: Option<String>,
|
||||
resource_provider_name: Option<String>,
|
||||
slice_name: Option<String>,
|
||||
cpu_cores: Option<i32>,
|
||||
memory_gb: Option<i32>,
|
||||
@@ -1464,13 +1464,13 @@ impl SliceProductBuilder {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
pub fn farmer_id(mut self, farmer_id: impl Into<String>) -> Self {
|
||||
self.farmer_id = Some(farmer_id.into());
|
||||
pub fn resource_provider_id(mut self, resource_provider_id: impl Into<String>) -> Self {
|
||||
self.resource_provider_id = Some(resource_provider_id.into());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn farmer_name(mut self, farmer_name: impl Into<String>) -> Self {
|
||||
self.farmer_name = Some(farmer_name.into());
|
||||
pub fn resource_provider_name(mut self, resource_provider_name: impl Into<String>) -> Self {
|
||||
self.resource_provider_name = Some(resource_provider_name.into());
|
||||
self
|
||||
}
|
||||
|
||||
@@ -1525,8 +1525,8 @@ impl SliceProductBuilder {
|
||||
}
|
||||
|
||||
pub fn build(self) -> Result<crate::models::product::Product, String> {
|
||||
let farmer_id = self.farmer_id.ok_or("farmer_id is required")?;
|
||||
let farmer_name = self.farmer_name.ok_or("farmer_name is required")?;
|
||||
let resource_provider_id = self.resource_provider_id.ok_or("resource_provider_id is required")?;
|
||||
let resource_provider_name = self.resource_provider_name.ok_or("resource_provider_name is required")?;
|
||||
let slice_name = self.slice_name.ok_or("slice_name is required")?;
|
||||
let cpu_cores = self.cpu_cores.ok_or("cpu_cores is required")?;
|
||||
let memory_gb = self.memory_gb.ok_or("memory_gb is required")?;
|
||||
@@ -1552,8 +1552,8 @@ impl SliceProductBuilder {
|
||||
};
|
||||
|
||||
Ok(crate::models::product::Product::create_slice_product(
|
||||
farmer_id,
|
||||
farmer_name,
|
||||
resource_provider_id,
|
||||
resource_provider_name,
|
||||
slice_name,
|
||||
slice_config,
|
||||
price_per_hour,
|
||||
@@ -2081,7 +2081,7 @@ impl NodeRentalBuilder {
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FarmerRentalEarningBuilder {
|
||||
pub struct ResourceProviderRentalEarningBuilder {
|
||||
id: Option<String>,
|
||||
node_id: Option<String>,
|
||||
rental_id: Option<String>,
|
||||
@@ -2093,7 +2093,7 @@ pub struct FarmerRentalEarningBuilder {
|
||||
payment_status: Option<crate::models::user::PaymentStatus>,
|
||||
}
|
||||
|
||||
impl FarmerRentalEarningBuilder {
|
||||
impl ResourceProviderRentalEarningBuilder {
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
@@ -2143,10 +2143,10 @@ impl FarmerRentalEarningBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn build(self) -> Result<crate::models::user::FarmerRentalEarning, String> {
|
||||
pub fn build(self) -> Result<crate::models::user::ResourceProviderRentalEarning, String> {
|
||||
let id = self.id.unwrap_or_else(|| format!("earning_{}", uuid::Uuid::new_v4()));
|
||||
|
||||
Ok(crate::models::user::FarmerRentalEarning {
|
||||
Ok(crate::models::user::ResourceProviderRentalEarning {
|
||||
id,
|
||||
node_id: self.node_id.ok_or("node_id is required")?,
|
||||
rental_id: self.rental_id.ok_or("rental_id is required")?,
|
||||
@@ -2469,8 +2469,8 @@ impl NodeCreationDataBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn build(self) -> Result<crate::services::farmer::NodeCreationData, String> {
|
||||
Ok(crate::services::farmer::NodeCreationData {
|
||||
pub fn build(self) -> Result<crate::services::resource_provider::NodeCreationData, String> {
|
||||
Ok(crate::services::resource_provider::NodeCreationData {
|
||||
name: self.name.ok_or("name is required")?,
|
||||
location: self.location.ok_or("location is required")?,
|
||||
cpu_cores: self.cpu_cores.unwrap_or(4),
|
||||
|
Reference in New Issue
Block a user