pub struct IoTUseCases { /* private fields */ }Expand description
Use cases for managing IoT readings and consumption data
Implementations§
Source§impl IoTUseCases
impl IoTUseCases
pub fn new(iot_repo: Arc<dyn IoTRepository>) -> Self
Sourcepub async fn create_reading(
&self,
dto: CreateIoTReadingDto,
user_id: Uuid,
organization_id: Uuid,
) -> Result<IoTReadingResponseDto, String>
pub async fn create_reading( &self, dto: CreateIoTReadingDto, user_id: Uuid, organization_id: Uuid, ) -> Result<IoTReadingResponseDto, String>
Create a single IoT reading
Sourcepub async fn create_readings_bulk(
&self,
dtos: Vec<CreateIoTReadingDto>,
user_id: Uuid,
organization_id: Uuid,
) -> Result<usize, String>
pub async fn create_readings_bulk( &self, dtos: Vec<CreateIoTReadingDto>, user_id: Uuid, organization_id: Uuid, ) -> Result<usize, String>
Create multiple IoT readings in bulk
Sourcepub async fn query_readings(
&self,
query: QueryIoTReadingsDto,
) -> Result<Vec<IoTReadingResponseDto>, String>
pub async fn query_readings( &self, query: QueryIoTReadingsDto, ) -> Result<Vec<IoTReadingResponseDto>, String>
Query IoT readings with filters
Sourcepub async fn get_consumption_stats(
&self,
building_id: Uuid,
metric_type: MetricType,
start_date: DateTime<Utc>,
end_date: DateTime<Utc>,
) -> Result<ConsumptionStatsDto, String>
pub async fn get_consumption_stats( &self, building_id: Uuid, metric_type: MetricType, start_date: DateTime<Utc>, end_date: DateTime<Utc>, ) -> Result<ConsumptionStatsDto, String>
Get consumption statistics for a building and metric type
Sourcepub async fn get_daily_aggregates(
&self,
building_id: Uuid,
device_type: DeviceType,
metric_type: MetricType,
start_date: DateTime<Utc>,
end_date: DateTime<Utc>,
) -> Result<Vec<DailyAggregateDto>, String>
pub async fn get_daily_aggregates( &self, building_id: Uuid, device_type: DeviceType, metric_type: MetricType, start_date: DateTime<Utc>, end_date: DateTime<Utc>, ) -> Result<Vec<DailyAggregateDto>, String>
Get daily aggregates for a device type and metric
Sourcepub async fn get_monthly_aggregates(
&self,
building_id: Uuid,
device_type: DeviceType,
metric_type: MetricType,
start_date: DateTime<Utc>,
end_date: DateTime<Utc>,
) -> Result<Vec<MonthlyAggregateDto>, String>
pub async fn get_monthly_aggregates( &self, building_id: Uuid, device_type: DeviceType, metric_type: MetricType, start_date: DateTime<Utc>, end_date: DateTime<Utc>, ) -> Result<Vec<MonthlyAggregateDto>, String>
Get monthly aggregates for a device type and metric
Sourcepub async fn detect_anomalies(
&self,
building_id: Uuid,
metric_type: MetricType,
threshold_percentage: f64,
lookback_days: i64,
) -> Result<Vec<IoTReadingResponseDto>, String>
pub async fn detect_anomalies( &self, building_id: Uuid, metric_type: MetricType, threshold_percentage: f64, lookback_days: i64, ) -> Result<Vec<IoTReadingResponseDto>, String>
Detect consumption anomalies (values deviating significantly from average)
Auto Trait Implementations§
impl Freeze for IoTUseCases
impl !RefUnwindSafe for IoTUseCases
impl Send for IoTUseCases
impl Sync for IoTUseCases
impl Unpin for IoTUseCases
impl !UnwindSafe for IoTUseCases
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.