ci: fix warning
This commit is contained in:
parent
0ce76c5a89
commit
648ec41cf3
|
|
@ -34,7 +34,7 @@ futures-util = "0.3.26"
|
|||
async-stream = "0.3.4"
|
||||
config = { version = "0.13.3", default-features = false, features = ["yaml"] }
|
||||
once_cell = "1.13.0"
|
||||
chrono = { version = "0.4.23", features = ["serde"] }
|
||||
chrono = { version = "0.4.23", features = ["serde", "clock"] }
|
||||
derive_more = { version = "0.99" }
|
||||
uuid = { version = "1", features = ["v4", "serde"] }
|
||||
argon2 = { version = "0.5", features = ["std"] }
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ impl RevDB {
|
|||
items.for_each(|(key, value)| {
|
||||
batch.insert(key.as_ref(), value);
|
||||
});
|
||||
let _ = self.db.apply_batch(batch)?;
|
||||
self.db.apply_batch(batch)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ impl<'a> Document<'a> {
|
|||
value: DocumentRevData,
|
||||
) -> Result<(), RevDBError> {
|
||||
let key = make_document_key(uid, document_id, value.rev_id);
|
||||
let _ = self.db.insert(key, &value.to_vec()?)?;
|
||||
self.db.insert(key, &value.to_vec()?)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ fn insert_text() {
|
|||
assert_eq!(value.content, restored_data.content);
|
||||
}
|
||||
|
||||
//noinspection RsExternalLinter
|
||||
#[test]
|
||||
fn insert_multi_text() {
|
||||
let db = make_test_db();
|
||||
|
|
@ -51,6 +52,7 @@ fn insert_multi_text() {
|
|||
assert_eq!(expected_str, restored_str);
|
||||
}
|
||||
|
||||
//noinspection RsExternalLinter
|
||||
fn insert_100_string_to_document(uid: i64, document_id: i64, document: &Document) {
|
||||
let mut base_rev_id = 0;
|
||||
for i in 0..=100 {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
chrono = { version = "0.4.22", features = ["serde", "clock"] }
|
||||
jwt = "0.16.0"
|
||||
thiserror = "1.0.30"
|
||||
hmac = "0.12.1"
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ async fn login_handler(
|
|||
) -> Result<HttpResponse> {
|
||||
let req = req.into_inner();
|
||||
let email = UserEmail::parse(req.email)
|
||||
.map_err(|e| InputParamsError::InvalidEmail(e))?
|
||||
.map_err(InputParamsError::InvalidEmail)?
|
||||
.0;
|
||||
let password = UserPassword::parse(req.password)
|
||||
.map_err(|_| InputParamsError::InvalidPassword)?
|
||||
|
|
@ -52,10 +52,10 @@ async fn logout_handler(req: HttpRequest, state: Data<State>) -> Result<HttpResp
|
|||
async fn register_handler(req: Json<RegisterRequest>, state: Data<State>) -> Result<HttpResponse> {
|
||||
let req = req.into_inner();
|
||||
let name = UserName::parse(req.name)
|
||||
.map_err(|e| InputParamsError::InvalidName(e))?
|
||||
.map_err(InputParamsError::InvalidName)?
|
||||
.0;
|
||||
let email = UserEmail::parse(req.email)
|
||||
.map_err(|e| InputParamsError::InvalidEmail(e))?
|
||||
.map_err(InputParamsError::InvalidEmail)?
|
||||
.0;
|
||||
let password = UserPassword::parse(req.password)
|
||||
.map_err(|_| InputParamsError::InvalidPassword)?
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ pub async fn run(
|
|||
let key = pair
|
||||
.as_ref()
|
||||
.map(|(_, server_key)| Key::from(server_key.expose_secret().as_bytes()))
|
||||
.unwrap_or(Key::generate());
|
||||
.unwrap_or_else(Key::generate);
|
||||
let mut server = HttpServer::new(move || {
|
||||
App::new()
|
||||
// Session middleware
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ pub async fn login(
|
|||
state.user.write().await.authorized(logged_user);
|
||||
Ok((
|
||||
LoginResponse {
|
||||
token: token.clone().into(),
|
||||
token: token.0.clone(),
|
||||
uid: uid.to_string(),
|
||||
},
|
||||
Secret::new(token),
|
||||
|
|
@ -99,7 +99,7 @@ pub async fn register(
|
|||
state.user.write().await.authorized(logged_user);
|
||||
|
||||
Ok(RegisterResponse {
|
||||
token: token.into(),
|
||||
token: token.0.clone(),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -209,13 +209,8 @@ pub struct ChangePasswordRequest {
|
|||
pub new_password_confirm: String,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Default)]
|
||||
pub struct WrapI64(i64);
|
||||
impl Default for WrapI64 {
|
||||
fn default() -> Self {
|
||||
Self(0)
|
||||
}
|
||||
}
|
||||
impl Copy for WrapI64 {}
|
||||
impl DefaultIsZeroes for WrapI64 {}
|
||||
impl DebugSecret for WrapI64 {}
|
||||
|
|
@ -323,15 +318,3 @@ pub fn uid_from_request(
|
|||
None => Err(AuthError::Unauthorized),
|
||||
}
|
||||
}
|
||||
|
||||
impl From<String> for Token {
|
||||
fn from(val: String) -> Self {
|
||||
Self(val)
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<String> for Token {
|
||||
fn into(self) -> String {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
use crate::component::ws::entities::{Connect, Disconnect, WSError, WebSocketMessage};
|
||||
use actix::{Actor, Context, Handler};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct WSServer {}
|
||||
|
||||
impl std::default::Default for WSServer {
|
||||
fn default() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
impl WSServer {
|
||||
pub fn new() -> Self {
|
||||
WSServer::default()
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
#![allow(clippy::module_inception)]
|
||||
pub mod config;
|
||||
pub mod env;
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ async fn change_password_with_unmatched_password() {
|
|||
.change_password(
|
||||
token,
|
||||
&test_user.password,
|
||||
&new_password,
|
||||
&new_password_confirm,
|
||||
new_password,
|
||||
new_password_confirm,
|
||||
)
|
||||
.await;
|
||||
assert_eq!(http_resp.status(), StatusCode::BAD_REQUEST);
|
||||
|
|
@ -28,7 +28,7 @@ async fn login_fail_after_change_password() {
|
|||
|
||||
let new_password = "HelloWorld@1a";
|
||||
let http_resp = server
|
||||
.change_password(token, &test_user.password, &new_password, &new_password)
|
||||
.change_password(token, &test_user.password, new_password, new_password)
|
||||
.await;
|
||||
assert_eq!(http_resp.status(), StatusCode::OK);
|
||||
|
||||
|
|
@ -44,10 +44,10 @@ async fn login_success_with_new_password() {
|
|||
|
||||
let new_password = "HelloWorld@1a";
|
||||
let http_resp = server
|
||||
.change_password(token, &test_user.password, &new_password, &new_password)
|
||||
.change_password(token, &test_user.password, new_password, new_password)
|
||||
.await;
|
||||
assert_eq!(http_resp.status(), StatusCode::OK);
|
||||
|
||||
let http_resp = server.login(&test_user.email, &new_password).await;
|
||||
let http_resp = server.login(&test_user.email, new_password).await;
|
||||
assert_eq!(http_resp.status(), StatusCode::OK);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue