Compare commits

..
Author SHA1 Message Date
phoenix fc5644bf37 Adding traits to SongEvent
simodels Build / Clippy (pull_request) Successful in 17s
Release Tagging / release (pull_request) Successful in 23s
simodels Build / build (pull_request) Successful in 20s
simodels Build / Check (pull_request) Successful in 24s
simodels Build / Rustfmt (pull_request) Successful in 24s
simodels Build / Test Suite (pull_request) Successful in 26s
2026-11-04 16:10:29 -05:00
phoenix f31178b3f0 Adding date_created
simodels Build / Rustfmt (pull_request) Successful in 16s
Release Tagging / release (pull_request) Successful in 25s
simodels Build / build (pull_request) Successful in 26s
simodels Build / Clippy (pull_request) Successful in 26s
simodels Build / Check (pull_request) Successful in 28s
simodels Build / Test Suite (pull_request) Successful in 36s
2026-11-04 14:56:47 -05:00
phoenix 7b7d6a29f6 bump: simodels
Release Tagging / release (pull_request) Successful in 27s
simodels Build / Rustfmt (pull_request) Successful in 28s
simodels Build / Test Suite (pull_request) Successful in 32s
simodels Build / build (pull_request) Successful in 36s
simodels Build / Clippy (pull_request) Successful in 37s
simodels Build / Check (pull_request) Successful in 39s
2026-11-04 14:54:02 -05:00
phoenix 36781f2487 cargo update 2026-11-04 14:53:42 -05:00
phoenix 8d2ed157d5 Warning fixes 2026-11-04 14:53:00 -05:00
phoenix 4bf850ae15 Code formatting 2026-11-04 14:51:21 -05:00
phoenix a2c4980277 Adding method to validate event_type of SongEvent 2026-11-04 14:50:40 -05:00
phoenix a960c7d299 Adding event type constants
Release Tagging / release (pull_request) Successful in 16s
simodels Build / Rustfmt (pull_request) Failing after 26s
simodels Build / Check (pull_request) Successful in 32s
simodels Build / Clippy (pull_request) Successful in 31s
simodels Build / build (pull_request) Successful in 36s
simodels Build / Test Suite (pull_request) Successful in 42s
2026-11-03 13:05:48 -05:00
phoenix 4f73ec6efa Adding ledger module
simodels Build / Check (pull_request) Successful in 23s
simodels Build / Rustfmt (pull_request) Failing after 25s
Release Tagging / release (pull_request) Successful in 32s
simodels Build / Test Suite (pull_request) Successful in 38s
simodels Build / Clippy (pull_request) Successful in 41s
simodels Build / build (pull_request) Successful in 47s
2026-11-03 13:02:55 -05:00
5 changed files with 16 additions and 46 deletions

No files matched your search

-16
View File
@@ -15,21 +15,5 @@ uuid = { version = "1.29.0", features = ["v4", "serde"] }
josekit = { version = "0.10.3" } josekit = { version = "0.10.3" }
utoipa = { version = "6.0.0", features = ["uuid", "time"] } utoipa = { version = "6.0.0", features = ["uuid", "time"] }
[features]
default = ["full"]
full = ["access_level", "album", "constants", "coverart", "ledger", "login_result", "song", "token", "types", "user", "util"]
auth = ["constants", "login_result", "token", "user"]
access_level = ["constants"]
album = []
constants = []
coverart = ["constants", "types"]
ledger = ["constants", "song", "types", "user"]
login_result = ["constants", "token", "user"]
song = ["constants", "types"]
token = []
types = []
user = []
util = []
[dev-dependencies] [dev-dependencies]
tempfile = { version = "3.27.0" } tempfile = { version = "3.27.0" }
+7 -9
View File
@@ -2,8 +2,6 @@ use std::default::Default;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
const DEFAULT_ACCESS_LEVEL: &str = super::constants::access_level::PUBLIC;
#[derive(Clone, Debug, Deserialize, Serialize, utoipa::ToSchema)] #[derive(Clone, Debug, Deserialize, Serialize, utoipa::ToSchema)]
pub struct AccessLevel { pub struct AccessLevel {
pub id: uuid::Uuid, pub id: uuid::Uuid,
@@ -15,8 +13,8 @@ impl Default for AccessLevel {
fn default() -> Self { fn default() -> Self {
AccessLevel { AccessLevel {
id: uuid::Uuid::nil(), id: uuid::Uuid::nil(),
level: DEFAULT_ACCESS_LEVEL.to_string(), level: String::new(),
song_id: uuid::Uuid::nil(), song_id: uuid::Uuid::new_v4(),
} }
} }
} }
@@ -24,16 +22,16 @@ impl Default for AccessLevel {
pub fn default_level() -> AccessLevel { pub fn default_level() -> AccessLevel {
AccessLevel { AccessLevel {
id: uuid::Uuid::nil(), id: uuid::Uuid::nil(),
level: DEFAULT_ACCESS_LEVEL.to_string(), level: String::from("Public"),
song_id: uuid::Uuid::nil(), song_id: uuid::Uuid::new_v4(),
} }
} }
pub fn private_level() -> AccessLevel { pub fn private_level() -> AccessLevel {
AccessLevel { AccessLevel {
id: uuid::Uuid::nil(), id: uuid::Uuid::new_v4(),
level: super::constants::access_level::PRIVATE.to_string(), level: String::from("Private"),
song_id: uuid::Uuid::nil(), song_id: uuid::Uuid::new_v4(),
} }
} }
-16
View File
@@ -13,22 +13,6 @@ pub mod file_extensions {
} }
} }
pub mod song_event {
/// Song Event Type - Play
pub const SONG_EVENT_TYPE_PLAY: &str = "PLAY";
/// Song Event Type - PAUSE
pub const SONG_EVENT_TYPE_PAUSE: &str = "PAUSE";
}
pub mod access_level {
pub const PUBLIC: &str = "PUBLIC";
pub const PRIVATE: &str = "PRIVATE";
}
pub mod token {
pub const TOKEN_TYPE: &str = "JWT";
}
pub mod error { pub mod error {
pub const DIRECTORY_NOT_INITIALIZED: &str = "Directory has not been initialized"; pub const DIRECTORY_NOT_INITIALIZED: &str = "Directory has not been initialized";
pub const FILENAME_NOT_INITIALIZED: &str = "Filename has not bee initialized"; pub const FILENAME_NOT_INITIALIZED: &str = "Filename has not bee initialized";
+6 -4
View File
@@ -4,9 +4,7 @@ pub struct SongEvent {
pub song_id: uuid::Uuid, pub song_id: uuid::Uuid,
pub user_id: uuid::Uuid, pub user_id: uuid::Uuid,
pub event_type: String, pub event_type: String,
#[serde(with = "time::serde::rfc3339::option")]
pub event_time: Option<time::OffsetDateTime>, pub event_time: Option<time::OffsetDateTime>,
#[serde(with = "time::serde::rfc3339::option")]
pub date_created: Option<time::OffsetDateTime>, pub date_created: Option<time::OffsetDateTime>,
} }
@@ -14,8 +12,12 @@ impl SongEvent {
pub fn is_event_type_valid(&self) -> bool { pub fn is_event_type_valid(&self) -> bool {
matches!( matches!(
self.event_type.as_str(), self.event_type.as_str(),
super::constants::song_event::SONG_EVENT_TYPE_PLAY SONG_EVENT_TYPE_PLAY | SONG_EVENT_TYPE_PAUSE
| super::constants::song_event::SONG_EVENT_TYPE_PAUSE
) )
} }
} }
/// Song Event Type - Play
pub const SONG_EVENT_TYPE_PLAY: &str = "PLAY";
/// Song Event Type - PAUSE
pub const SONG_EVENT_TYPE_PAUSE: &str = "PAUSE";
+3 -1
View File
@@ -111,13 +111,15 @@ pub struct TokenResource {
pub id: uuid::Uuid, pub id: uuid::Uuid,
} }
pub const TOKEN_TYPE: &str = "JWT";
pub fn create_token( pub fn create_token(
key: &String, key: &String,
token_resource: &TokenResource, token_resource: &TokenResource,
duration: time::Duration, duration: time::Duration,
) -> Result<(String, i64), josekit::JoseError> { ) -> Result<(String, i64), josekit::JoseError> {
let mut header = josekit::jws::JwsHeader::new(); let mut header = josekit::jws::JwsHeader::new();
header.set_token_type(super::constants::token::TOKEN_TYPE); header.set_token_type(TOKEN_TYPE);
let mut payload = josekit::jwt::JwtPayload::new(); let mut payload = josekit::jwt::JwtPayload::new();
let message = &token_resource.message; let message = &token_resource.message;