diff --git a/emgauwa-lib/src/handlers/v1/relays.rs b/emgauwa-lib/src/handlers/v1/relays.rs index 98824c6..1968b56 100644 --- a/emgauwa-lib/src/handlers/v1/relays.rs +++ b/emgauwa-lib/src/handlers/v1/relays.rs @@ -22,7 +22,7 @@ pub async fn index(pool: web::Data>) -> Result = - relays.iter().map(|s| ReturnRelay::from_relay_ref(s, &mut pool_conn)).collect(); + relays.into_iter().map(|s| ReturnRelay::from_relay(s, &mut pool_conn)).collect(); Ok(HttpResponse::Ok().json(return_relays)) } @@ -40,7 +40,7 @@ pub async fn index(pool: web::Data>) -> Result = -// relays.iter().map(|s| ReturnRelay::from_relay_ref(s, &mut pool_conn)).collect(); +// relays.into_iter().map(|s| ReturnRelay::from_relay(s, &mut pool_conn)).collect(); // // Ok(HttpResponse::Ok().json(return_relays)) //} diff --git a/emgauwa-lib/src/handlers/v1/schedules.rs b/emgauwa-lib/src/handlers/v1/schedules.rs index 03bf977..fe3b064 100644 --- a/emgauwa-lib/src/handlers/v1/schedules.rs +++ b/emgauwa-lib/src/handlers/v1/schedules.rs @@ -24,7 +24,7 @@ pub async fn index(pool: web::Data>) -> Result = - schedules.iter().map(|s| ReturnSchedule::from_schedule_ref(s, &mut pool_conn)).collect(); + schedules.into_iter().map(|s| ReturnSchedule::from_schedule(s, &mut pool_conn)).collect(); Ok(HttpResponse::Ok().json(return_schedules)) } @@ -42,7 +42,7 @@ pub async fn tagged( let schedules = Schedule::get_by_tag(&mut pool_conn, &tag_db).await?; let return_schedules: Vec = - schedules.iter().map(|s| ReturnSchedule::from_schedule_ref(s, &mut pool_conn)).collect(); + schedules.into_iter().map(|s| ReturnSchedule::from_schedule(s, &mut pool_conn)).collect(); Ok(HttpResponse::Ok().json(return_schedules)) } diff --git a/emgauwa-lib/src/return_models.rs b/emgauwa-lib/src/return_models.rs index 046d942..80caa58 100644 --- a/emgauwa-lib/src/return_models.rs +++ b/emgauwa-lib/src/return_models.rs @@ -22,10 +22,6 @@ impl ReturnSchedule { tags, } } - - pub fn from_schedule_ref(schedule: &Schedule, conn: &mut PoolConnection) -> Self { - Self::from_schedule(schedule.clone(), conn) - } } #[derive(Debug, Serialize)] @@ -51,8 +47,4 @@ impl ReturnRelay { tags, } } - - pub fn from_relay_ref(relay: &Relay, conn: &mut PoolConnection) -> Self { - Self::from_relay(relay.clone(), conn) - } }