auth should work

This commit is contained in:
mbecker20
2023-06-18 05:49:32 +00:00
parent 5730e5d2ae
commit 7269050cf4
8 changed files with 426 additions and 130 deletions

View File

@@ -41,11 +41,11 @@ pub struct User {
pub google_id: Option<String>,
#[serde(default, skip_serializing_if = "String::is_empty")]
pub created_at: String,
#[serde(default, skip_serializing_if = "i64_is_zero")]
pub created_at: i64,
#[serde(default)]
pub updated_at: String,
pub updated_at: i64,
}
#[typeshare]
@@ -56,4 +56,8 @@ pub struct ApiSecret {
pub hash: String,
pub created_at: String,
pub expires: Option<i64>,
}
fn i64_is_zero(n: &i64) -> bool {
*n == 0
}

View File

@@ -19,6 +19,38 @@ pub struct GetLoginOptionsResponse {
//
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Request)]
#[response(CreateLocalUserResponse)]
pub struct CreateLocalUser {
pub username: String,
pub password: String,
}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct CreateLocalUserResponse {
pub jwt: String,
}
//
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Request)]
#[response(LoginLocalUserResponse)]
pub struct LoginLocalUser {
pub username: String,
pub password: String,
}
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct LoginLocalUserResponse {
pub jwt: String,
}
//
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Request)]
#[response(ExchangeForJwtResponse)]