Compare commits

..
Author SHA1 Message Date
phoenix dd8bd3eff9 Added release workflow
Rust Build / Check (pull_request) Successful in 31s
Rust Build / Test Suite (pull_request) Successful in 25s
Rust Build / Rustfmt (pull_request) Failing after 27s
Rust Build / Clippy (pull_request) Successful in 29s
Rust Build / build (pull_request) Successful in 25s
Release Tagging / release (pull_request) Successful in 30s
2026-05-28 21:10:04 -04:00
phoenix 69cb67dbeb Updated branch
Rust Build / Check (pull_request) Successful in 56s
Rust Build / Test Suite (pull_request) Successful in 59s
Rust Build / Rustfmt (pull_request) Failing after 29s
Rust Build / build (pull_request) Successful in 33s
Rust Build / Clippy (pull_request) Successful in 44s
2026-05-28 21:08:16 -04:00
phoenix c9d3f2914d Adding workflow code 2026-05-28 21:05:56 -04:00
phoenix 180780f46b Added code 2026-05-28 21:04:26 -04:00
8 changed files with 9 additions and 178 deletions
+1 -1
View File
@@ -1 +1 @@
target/
/vendor/
+8 -5
View File
@@ -1,7 +1,9 @@
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct TwilioConfig {
// #[serde(skip_serializing_if = "init::is_uuid_nil")]
#[serde(alias = "auth_id")]
pub account_sid: uuid::Uuid,
#[serde(skip_serializing_if = "String::is_empty")]
@@ -14,10 +16,11 @@ pub struct TwilioConfig {
impl TwilioConfig {
pub fn print_config(&self) {
println!("Twilio config");
println!("Account SID: {:?}", self.account_sid);
println!("Service SID: {:?}", self.service_sid);
println!("Auth Token: {:?}", self.auth_token);
println!("Number: {:?}", self.phone_number);
println!("Twilio config");
println!("Account SID: {:?}", self.account_sid);
println!("Service SID: {:?}", self.service_sid);
println!("Auth Token: {:?}", self.auth_token);
println!("Number: {:?}", self.phone_number);
}
}
-15
View File
@@ -1,15 +0,0 @@
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct Contact {
pub id: uuid::Uuid,
// empty?
pub firstname: String,
// empty?
pub lastname: String,
// empty?
pub nickname: String,
pub phone_number: String,
// empty
pub user_id: uuid::Uuid,
}
-4
View File
@@ -1,5 +1 @@
pub mod config;
pub mod contact;
pub mod message;
pub mod token;
pub mod user;
-16
View File
@@ -1,16 +0,0 @@
use serde::{Deserialize, Serialize};
pub struct MessageEventResponse {
pub id: uuid::Uuid,
pub scheduledMessageEventId: uuid::Uuid,
// Json field
pub response: String,
pub userId: uuid::Uuid,
pub contact_id: uuid::Uuid,
pub message_id: uuid::Uuid,
pub status: string,
#[serde(with = "time::serde::rfc3339::option")]
pub sent: Option<time::OffsetDateTime>,
}
-10
View File
@@ -1,10 +0,0 @@
pub mod event;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct Message {
pub id: uuid::Uuid,
pub content: String,
pub user_id: uuid::Uuid,
}
-25
View File
@@ -1,25 +0,0 @@
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct Claims {
pub user_id: uuid::Uuid,
pub role: String,
#[serde(alias = "iss")]
pub issued: String,
#[serde(alias = "exp")]
pub expired: i64,
#[serde(alias = "iat")]
pub issued_at: i64,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct LoginResult {
pub user_id: uuid::Uuid,
pub access_token: String,
pub token_type: String,
pub expires_in: i64,
pub issued_at: i64,
}
// Alias for LoginResult
pub type Login = LoginResult;
-102
View File
@@ -1,102 +0,0 @@
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct User {
pub id: uuid::Uuid,
pub phone_number: String,
pub username: String,
pub password: String,
// Firstname is a pointer
pub firstname: String,
// Lastname is a pointer
pub lastname: String,
#[serde(with = "time::serde::rfc3339::option")]
pub created: Option<time::OffsetDateTime>,
#[serde(with = "time::serde::rfc3339::option")]
pub last_login: Option<time::OffsetDateTime>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct ServiceUser {
pub id: uuid::Uuid,
pub username: String,
pub passphrase: String,
#[serde(with = "time::serde::rfc3339::option")]
pub created: Option<time::OffsetDateTime>,
// When serializing to json, if empty do not populate
#[serde(with = "time::serde::rfc3339::option")]
pub last_login: Option<time::OffsetDateTime>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct Organization {
pub id: uuid::Uuid,
pub name: String,
#[serde(with = "time::serde::rfc3339::option")]
pub created: Option<time::OffsetDateTime>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UserLoginHistory {
pub id: uuid::Uuid,
#[serde(with = "time::serde::rfc3339::option")]
pub login_time: Option<time::OffsetDateTime>,
pub user_id: uuid::Uuid,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct ServiceUserLoginHistory {
pub id: uuid::Uuid,
#[serde(with = "time::serde::rfc3339::option")]
pub login_time: Option<time::OffsetDateTime>,
pub service_user_id: uuid::Uuid,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct UserProfile {
pub user_id: uuid::Uuid,
pub phone_number: String,
pub username: String,
pub firstname: String,
pub lastname: String,
#[serde(with = "time::serde::rfc3339::option")]
pub created: Option<time::OffsetDateTime>,
#[serde(with = "time::serde::rfc3339::option")]
pub last_login: Option<time::OffsetDateTime>,
}
pub fn init_user_profile(usr: &User) -> UserProfile {
UserProfile {
user_id: usr.id,
phone_number: usr.phone_number.clone(),
username: usr.username.clone(),
firstname: usr.firstname.clone(),
lastname: usr.lastname.clone(),
created: usr.created,
last_login: usr.last_login,
}
}
#[cfg(test)]
mod tests {
#[test]
fn test_init_user_profile() {
let usr = super::User {
id: uuid::Uuid::new_v4(),
phone_number: String::from("+12308438462"),
username: String::from("Cowboy99"),
password: String::from("238n7cyr2q89d3xhe2"),
firstname: String::from("BillyBob"),
lastname: String::from("Jones"),
created: Some(time::OffsetDateTime::now_utc()),
last_login: Some(time::OffsetDateTime::now_utc()),
..Default::default()
};
let profile = super::init_user_profile(&usr);
assert_eq!(
usr.phone_number, profile.phone_number,
"Phone numbers are not equal"
);
}
}