Compare commits

..
Author SHA1 Message Date
phoenix 3140f997d7 Updating workflow
simodels Build / Test Suite (pull_request) Successful in 44s
simodels Build / Rustfmt (pull_request) Successful in 38s
Release Tagging / release (pull_request) Successful in 1m21s
simodels Build / Clippy (pull_request) Successful in 1m31s
simodels Build / build (pull_request) Successful in 1m33s
simodels Build / Check (pull_request) Has been cancelled
2026-07-14 16:01:11 -04:00
phoenix 9ceeeaa2fd Name change 2026-07-14 15:59:52 -04:00
phoenix 859b0fb1b3 Serialize Album collection (#2)
Release Tagging / release (push) Successful in 44s
Rust Build / Check (push) Successful in 1m0s
Rust Build / Rustfmt (push) Successful in 26s
Rust Build / Clippy (push) Successful in 1m2s
Rust Build / build (push) Successful in 1m7s
Rust Build / Test Suite (push) Successful in 2m29s
Release Tagging / release (pull_request) Successful in 43s
Rust Build / Check (pull_request) Successful in 1m31s
Rust Build / Test Suite (pull_request) Successful in 1m38s
Rust Build / Rustfmt (pull_request) Successful in 1m25s
Rust Build / build (pull_request) Successful in 44s
Rust Build / Clippy (pull_request) Successful in 1m5s
Reviewed-on: phoenix/icarus_models#2
2026-07-07 16:04:19 -04:00
8 changed files with 68 additions and 32 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ jobs:
- name: Install Rust - name: Install Rust
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
toolchain: 1.96.1 toolchain: 1.97
components: cargo components: cargo
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
+6 -6
View File
@@ -1,4 +1,4 @@
name: Rust Build name: simodels Build
on: on:
push: push:
@@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.96.1 toolchain: 1.97
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo check - run: cargo check
@@ -32,7 +32,7 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.96.1 toolchain: 1.97
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo test - run: cargo test
@@ -43,7 +43,7 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.96.1 toolchain: 1.97
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: rustup component add rustfmt - run: rustup component add rustfmt
- run: cargo fmt --all -- --check - run: cargo fmt --all -- --check
@@ -55,7 +55,7 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.96.1 toolchain: 1.97
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: rustup component add clippy - run: rustup component add clippy
- run: cargo clippy -- -D warnings - run: cargo clippy -- -D warnings
@@ -67,6 +67,6 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.96.1 toolchain: 1.97
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo build - run: cargo build
Generated
+14 -14
View File
@@ -190,20 +190,6 @@ version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
[[package]]
name = "icarus_models"
version = "0.11.2"
dependencies = [
"josekit",
"rand",
"serde",
"serde_json",
"tempfile",
"time",
"utoipa",
"uuid",
]
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.14.0" version = "2.14.0"
@@ -490,6 +476,20 @@ version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214"
[[package]]
name = "simodels"
version = "0.11.3"
dependencies = [
"josekit",
"rand",
"serde",
"serde_json",
"tempfile",
"time",
"utoipa",
"uuid",
]
[[package]] [[package]]
name = "slab" name = "slab"
version = "0.4.12" version = "0.4.12"
+3 -3
View File
@@ -1,9 +1,9 @@
[package] [package]
name = "icarus_models" name = "simodels"
version = "0.11.2" version = "0.11.3"
edition = "2024" edition = "2024"
rust-version = "1.95" rust-version = "1.95"
description = "models used for the icarus project" description = "models used for the soaricarus project"
license = "MIT" license = "MIT"
[dependencies] [dependencies]
+3 -2
View File
@@ -1,3 +1,4 @@
A library containing commonly used structs, functions, enums, constants and other code # simodels
that is used throughout the icarus projects. Code from this library serves as the model Library containing commonly used structs, functions, enums, constants and other code
that is used throughout the soaricarus projects. Code from this library serves as the model
for other projects in the icarus project. for other projects in the icarus project.
+36 -1
View File
@@ -37,7 +37,42 @@ pub mod collection {
pub artist: String, pub artist: String,
pub disc: i32, pub disc: i32,
pub track: i32, pub track: i32,
// In seconds /// In seconds
pub duration: f64, pub duration: f64,
} }
pub fn deserialize_json(json_data: &str, album: &mut Album) -> Result<(), serde_json::Error> {
match serde_json::from_str::<Album>(json_data) {
Ok(parsed_album) => {
*album = parsed_album;
Ok(())
}
Err(err) => Err(err),
}
}
}
#[cfg(test)]
mod tests {
#[test]
fn test_deserilize_album_collection_json() {
let album_file_path = "tests/album.json";
let album_file_content = match std::fs::read_to_string(album_file_path) {
Ok(content) => content,
Err(err) => {
assert!(false, "Error: {err:?}");
String::new()
}
};
let mut album = super::collection::Album::default();
match super::collection::deserialize_json(&album_file_content, &mut album) {
Ok(_) => {
assert_eq!(3, album.tracks.len(), "Track count do not match");
}
Err(err) => {
assert!(false, "Error: {err:?}");
}
}
}
} }
+2 -2
View File
@@ -164,9 +164,9 @@ mod tests {
fn test_resource() -> TokenResource { fn test_resource() -> TokenResource {
TokenResource { TokenResource {
issuer: String::from("icarus_auth_test"), issuer: String::from("soaricarus_auth_test"),
message: String::from("Authorization"), message: String::from("Authorization"),
audiences: vec![String::from("icarus_test")], audiences: vec![String::from("soaricarus_test")],
id: uuid::Uuid::nil(), id: uuid::Uuid::nil(),
} }
} }
+3 -3
View File
@@ -33,8 +33,8 @@ mod song_tests {
use tempfile::tempdir; use tempfile::tempdir;
use crate::utils; use crate::utils;
use icarus_models::song; use simodels::song;
use icarus_models::types; use simodels::types;
#[test] #[test]
fn test_song_to_data() { fn test_song_to_data() {
@@ -157,7 +157,7 @@ mod song_tests {
#[cfg(test)] #[cfg(test)]
mod album_tests { mod album_tests {
use crate::utils; use crate::utils;
use icarus_models::album; use simodels::album;
#[test] #[test]
fn parse_album() { fn parse_album() {