From de2e34ac500c17e80fe4dcf2ed1c08add8998fa3 Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Sun, 9 May 2021 21:17:24 +0100 Subject: some changes :shrug: (#83) * make everything a cow * fmt + clippy --- atuin-server/src/handlers/history.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'atuin-server/src/handlers/history.rs') diff --git a/atuin-server/src/handlers/history.rs b/atuin-server/src/handlers/history.rs index 18852b58..06715381 100644 --- a/atuin-server/src/handlers/history.rs +++ b/atuin-server/src/handlers/history.rs @@ -6,7 +6,7 @@ use atuin_common::api::*; pub async fn count( user: User, db: impl Database + Clone + Send + Sync, -) -> JSONResult { +) -> JSONResult> { db.count_history(&user).await.map_or( reply_error( ErrorResponse::reply("failed to query history count") @@ -17,16 +17,16 @@ pub async fn count( } pub async fn list( - req: SyncHistoryRequest, + req: SyncHistoryRequest<'_>, user: User, db: impl Database + Clone + Send + Sync, -) -> JSONResult { +) -> JSONResult> { let history = db .list_history( &user, req.sync_ts.naive_utc(), req.history_ts.naive_utc(), - req.host, + &req.host, ) .await; @@ -54,20 +54,20 @@ pub async fn list( } pub async fn add( - req: Vec, + req: Vec>, user: User, db: impl Database + Clone + Send + Sync, -) -> ReplyResult { +) -> ReplyResult> { debug!("request to add {} history items", req.len()); let history: Vec = req - .iter() + .into_iter() .map(|h| NewHistory { - client_id: h.id.as_str(), + client_id: h.id, user_id: user.id, - hostname: h.hostname.as_str(), + hostname: h.hostname, timestamp: h.timestamp.naive_utc(), - data: h.data.as_str(), + data: h.data.into(), }) .collect(); -- cgit v1.2.3