Compare commits

..
Author SHA1 Message Date
phoenix ad3553dc01 cargo fmt
Rust Build / Rustfmt (pull_request) Successful in 35s
Rust Build / Clippy (pull_request) Successful in 33s
Release Tagging / release (pull_request) Successful in 39s
Rust Build / Check (pull_request) Successful in 34s
Rust Build / Test Suite (pull_request) Successful in 33s
Rust Build / build (pull_request) Successful in 33s
2026-05-30 22:53:33 -04:00
phoenix 09aa0623f6 Making scheduling module available 2026-05-30 22:53:13 -04:00
phoenix 7893fe8e46 Adding scheduling module 2026-05-30 22:52:23 -04:00
phoenix 7bffed3f9d Adding statuses (#14)
Rust Build / Check (push) Successful in 33s
Release Tagging / release (push) Successful in 41s
Rust Build / Test Suite (push) Successful in 39s
Rust Build / Rustfmt (push) Successful in 35s
Rust Build / build (push) Successful in 35s
Rust Build / Clippy (push) Successful in 41s
Reviewed-on: phoenix/textsender-models#14
2026-05-30 16:15:35 -04:00
phoenix 3527f1aff3 Adding event module (#13)
Rust Build / Check (push) Successful in 37s
Release Tagging / release (push) Failing after 40s
Rust Build / Rustfmt (push) Successful in 34s
Rust Build / Test Suite (push) Successful in 39s
Rust Build / build (push) Successful in 26s
Rust Build / Clippy (push) Successful in 1m8s
Reviewed-on: phoenix/textsender-models#13
2026-05-30 15:56:13 -04:00
phoenix e965cdeed9 Adding message module (#12)
Rust Build / Check (push) Successful in 41s
Release Tagging / release (push) Successful in 1m18s
Rust Build / Rustfmt (push) Successful in 26s
Rust Build / Test Suite (push) Successful in 1m5s
Rust Build / Clippy (push) Successful in 27s
Rust Build / build (push) Successful in 33s
Reviewed-on: phoenix/textsender-models#12
2026-05-30 15:15:15 -04:00
phoenix 34c47ac529 Organization (#11)
Release Tagging / release (push) Successful in 28s
Rust Build / Check (push) Successful in 37s
Rust Build / Rustfmt (push) Successful in 28s
Rust Build / Clippy (push) Successful in 30s
Rust Build / build (push) Successful in 26s
Rust Build / Test Suite (push) Successful in 28s
Reviewed-on: phoenix/textsender-models#11
2026-05-29 22:55:32 -04:00
phoenix e5ae5e1828 Adding UserProfile (#10)
Release Tagging / release (push) Failing after 26s
Rust Build / Check (push) Successful in 35s
Rust Build / Test Suite (push) Successful in 27s
Rust Build / Rustfmt (push) Successful in 29s
Rust Build / Clippy (push) Successful in 30s
Rust Build / build (push) Successful in 24s
Reviewed-on: phoenix/textsender-models#10
2026-05-29 22:22:15 -04:00
5 changed files with 100 additions and 10 deletions
+1
View File
@@ -1,4 +1,5 @@
pub mod config;
pub mod contact;
pub mod message;
pub mod token;
pub mod user;
+18
View File
@@ -0,0 +1,18 @@
use serde::{Deserialize, Serialize};
pub const MESSAGE_EVENT_RESPONSE_STATUS_INSTANT: &str = "INSTANT";
pub const MESSAGE_EVENT_RESPONSE_STATUS_SCHEDULED: &str = "SCHEDULED";
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct MessageEventResponse {
pub id: uuid::Uuid,
pub scheduled_message_event_id: uuid::Uuid,
// Json field
pub response: String,
pub user_id: 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>,
}
+11
View File
@@ -0,0 +1,11 @@
pub mod event;
pub mod scheduling;
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,
}
+27
View File
@@ -0,0 +1,27 @@
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct ScheduledMessageEvent {
id: uuid::Uuid,
contact_id: uuid::Uuid,
message_id: uuid::Uuid,
scheduled_message_id: uuid::Uuid,
#[serde(with = "time::serde::rfc3339::option")]
created: Option<time::OffsetDateTime>,
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct ScheduledMessage {
id: uuid::Uuid,
#[serde(with = "time::serde::rfc3339::option")]
scheduled: Option<time::OffsetDateTime>,
#[serde(with = "time::serde::rfc3339::option")]
created: Option<time::OffsetDateTime>,
status: String,
user_id: uuid::Uuid,
}
pub const READY: &str = "READY";
pub const PENDING: &str = "PENDING";
pub const PROCESSING: &str = "PROCESSING";
pub const DONE: &str = "DONE";
+43 -10
View File
@@ -28,6 +28,14 @@ pub struct ServiceUser {
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,
@@ -51,19 +59,44 @@ pub struct UserProfile {
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 {
let mut usrProfile = UserProfile::default();
usrProfile.user_id = usr.id.clone();
usrProfile.phone_number = usr.phone_number.clone();
usrProfile.username = usr.username.clone();
usrProfile.firstname = usr.firstname.clone();
usrProfile.lastname = usr.lastname.clone();
usrProfile.created = usr.created.clone();
usrProfile.last_login = usr.last_login.clone();
return usrProfile;
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"
);
}
}