Add some users and jwt

This commit is contained in:
2024-03-15 08:17:14 +05:00
parent 1577486736
commit 73b0fb8762
4 changed files with 305 additions and 168 deletions

View File

@ -1,7 +1,11 @@
use skytable::{
query::SQParam,
response::{FromResponse, Response},
ClientResult,
query::SQParam,
response::{
FromResponse,
Response,
Value,
},
ClientResult,
};
@ -9,16 +13,18 @@ pub struct Users {
pub login: String,
pub uuid: String,
pub password: String,
pub email: String,
pub email: String,
pub tokens: Vec<Value>,
}
impl Users {
pub fn new(login: String, uuid: String, password: String, email: String) -> Self {
pub fn new(login: String, uuid: String, password: String, email: String, tokens: Vec<Value>) -> Self {
Self {
login,
uuid,
password,
email,
tokens,
}
}
}
@ -27,12 +33,14 @@ impl SQParam for Users {
fn append_param(&self, q: &mut Vec<u8>) -> usize {
self.login.append_param(q)
+ self.uuid.append_param(q)
+ self.password.append_param(q)
+ self.email.append_param(q)
}
}
impl FromResponse for Users {
fn from_response(resp: Response) -> ClientResult<Self> {
let (login, uuid, password, email) = FromResponse::from_response(resp)?;
Ok(Self::new(login, uuid, password, email))
let (login, uuid, password, email, tokens) = FromResponse::from_response(resp)?;
Ok(Self::new(login, uuid, password, email, tokens))
}
}