summaryrefslogtreecommitdiffstats
path: root/atuin-server/src/handlers/history.rs
diff options
context:
space:
mode:
authorConrad Ludgate <conradludgate@gmail.com>2021-05-09 21:17:24 +0100
committerGitHub <noreply@github.com>2021-05-09 21:17:24 +0100
commitde2e34ac500c17e80fe4dcf2ed1c08add8998fa3 (patch)
treeaca08817ace6e0bd6a7dfc21615b2ed8b62f3a05 /atuin-server/src/handlers/history.rs
parente43e5ce74a85d87a625295b9b089a1b5b8e26fab (diff)
some changes :shrug: (#83)
* make everything a cow * fmt + clippy
Diffstat (limited to 'atuin-server/src/handlers/history.rs')
-rw-r--r--atuin-server/src/handlers/history.rs20
1 files changed, 10 insertions, 10 deletions
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<ErrorResponseStatus> {
+) -> JSONResult<ErrorResponseStatus<'static>> {
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<ErrorResponseStatus> {
+) -> JSONResult<ErrorResponseStatus<'static>> {
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<AddHistoryRequest>,
+ req: Vec<AddHistoryRequest<'_, String>>,
user: User,
db: impl Database + Clone + Send + Sync,
-) -> ReplyResult<impl Reply, ErrorResponseStatus> {
+) -> ReplyResult<impl Reply, ErrorResponseStatus<'_>> {
debug!("request to add {} history items", req.len());
let history: Vec<NewHistory> = 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();