Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
55b51db4a0 | |||
76e28fc626 | |||
7b5cb41f4a | |||
fc362e4e21 | |||
689dbaf29a | |||
36ac93414b | |||
5b92d8857c | |||
03f5647d53 | |||
448c81fd1e | |||
c6d17b4904 | |||
f52f9d65fd | |||
67aaba4fbf | |||
f8662b6020 | |||
e7517f94dc | |||
98e187056d | |||
2bd6fd8f85 |
@@ -8,9 +8,10 @@ build:
|
|||||||
image: rust:1.85
|
image: rust:1.85
|
||||||
script:
|
script:
|
||||||
- cargo build --release
|
- cargo build --release
|
||||||
|
- ls -R target/release/
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- target/release/icarus-models
|
- target/release/
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
cache:
|
cache:
|
||||||
key: "cargo-cache"
|
key: "cargo-cache"
|
||||||
@@ -29,14 +30,25 @@ test:
|
|||||||
- target/
|
- target/
|
||||||
- ~/.cargo/
|
- ~/.cargo/
|
||||||
|
|
||||||
|
test_variable:
|
||||||
|
stage: test
|
||||||
|
image: rust:1.85
|
||||||
|
script:
|
||||||
|
- echo "Checking CARGO_LOGIN_TOKEN..."
|
||||||
|
- if [[ -z "$CARGO_LOGIN_TOKEN" ]]; then echo "CARGO_LOGIN_TOKEN is empty!"; exit 1; else echo "CARGO_LOGIN_TOKEN is set."; fi
|
||||||
|
- env
|
||||||
|
rules:
|
||||||
|
- if: '$CI_COMMIT_TAG'
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
image: rust:1.85
|
image: rust:1.85
|
||||||
script:
|
script:
|
||||||
- echo "Printing environment"
|
- echo "Deployment will be configured when this is ready for use"
|
||||||
- env
|
# - env
|
||||||
- cargo login "$CARGO_LOGIN_TOKEN"
|
# Uncomment when you are ready for this to be published
|
||||||
- cargo publish
|
# - cargo login "$CARGO_LOGIN_TOKEN"
|
||||||
|
# - cargo publish
|
||||||
dependencies:
|
dependencies:
|
||||||
- build
|
- build
|
||||||
rules:
|
rules:
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
name = "icarus-models"
|
name = "icarus-models"
|
||||||
description = "models used for the icarus project"
|
description = "models used for the icarus project"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
version = "0.1.0"
|
version = "0.1.3"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@@ -19,6 +19,25 @@ impl Default for AccessLevel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pub fn default_level() -> AccessLevel {
|
||||||
|
return AccessLevel {
|
||||||
|
id: -1,
|
||||||
|
level: String::from("Public"),
|
||||||
|
song_id: -1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn private_level() -> AccessLevel {
|
||||||
|
return AccessLevel {
|
||||||
|
id: -1,
|
||||||
|
level: String::from("Private"),
|
||||||
|
song_id: -1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
impl AccessLevel {
|
impl AccessLevel {
|
||||||
pub fn _to_json(&self) -> Result<String, serde_json::Error> {
|
pub fn _to_json(&self) -> Result<String, serde_json::Error> {
|
||||||
return serde_json::to_string_pretty(&self);
|
return serde_json::to_string_pretty(&self);
|
||||||
|
@@ -1,5 +1,8 @@
|
|||||||
pub mod access_level;
|
pub mod access_level;
|
||||||
pub mod login_result;
|
pub mod login_result;
|
||||||
|
pub mod song;
|
||||||
|
pub mod token;
|
||||||
|
pub mod types;
|
||||||
pub mod user;
|
pub mod user;
|
||||||
|
|
||||||
pub fn add(left: u64, right: u64) -> u64 {
|
pub fn add(left: u64, right: u64) -> u64 {
|
||||||
|
73
src/song.rs
Normal file
73
src/song.rs
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
use std::default::Default;
|
||||||
|
use std::io::Read;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct Song {
|
||||||
|
#[serde(alias = "id")]
|
||||||
|
pub id: Option<i32>,
|
||||||
|
pub title: Option<String>,
|
||||||
|
pub artist: Option<String>,
|
||||||
|
pub album: Option<String>,
|
||||||
|
pub album_artist: Option<String>,
|
||||||
|
pub genre: Option<String>,
|
||||||
|
pub year: Option<i32>,
|
||||||
|
pub duration: Option<i32>,
|
||||||
|
pub track: Option<i32>,
|
||||||
|
pub disc: Option<i32>,
|
||||||
|
pub disc_count: Option<i32>,
|
||||||
|
pub track_count: Option<i32>,
|
||||||
|
pub audio_type: Option<String>,
|
||||||
|
pub date_created: Option<String>,
|
||||||
|
pub filename: Option<String>,
|
||||||
|
pub user_id: Option<i32>,
|
||||||
|
#[serde(skip)]
|
||||||
|
pub data: Option<Vec<u8>>,
|
||||||
|
#[serde(skip)]
|
||||||
|
pub directory: Option<String>,
|
||||||
|
#[serde(skip)]
|
||||||
|
pub album_id: Option<i32>,
|
||||||
|
#[serde(skip)]
|
||||||
|
pub artist_id: Option<i32>,
|
||||||
|
#[serde(skip)]
|
||||||
|
pub genre_id: Option<i32>,
|
||||||
|
#[serde(skip)]
|
||||||
|
pub coverart_id: Option<i32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Song {
|
||||||
|
fn default() -> Self {
|
||||||
|
Song {
|
||||||
|
id: None,
|
||||||
|
title: None,
|
||||||
|
artist: None,
|
||||||
|
album: None,
|
||||||
|
album_artist: None,
|
||||||
|
genre: None,
|
||||||
|
year: None,
|
||||||
|
duration: None,
|
||||||
|
track: None,
|
||||||
|
disc: None,
|
||||||
|
disc_count: None,
|
||||||
|
track_count: None,
|
||||||
|
audio_type: None,
|
||||||
|
date_created: None,
|
||||||
|
filename: None,
|
||||||
|
user_id: None,
|
||||||
|
data: None,
|
||||||
|
directory: None,
|
||||||
|
album_id: None,
|
||||||
|
artist_id: None,
|
||||||
|
genre_id: None,
|
||||||
|
coverart_id: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Song {
|
||||||
|
// TODO: Implement
|
||||||
|
pub fn to_metadata_json(&self) -> Result<String, serde_json::Error> {
|
||||||
|
return serde_json::to_string_pretty(&self);
|
||||||
|
}
|
||||||
|
}
|
40
src/token.rs
Normal file
40
src/token.rs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
use std::default::Default;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
|
pub struct Token {
|
||||||
|
pub scope: String,
|
||||||
|
pub expiration: i32,
|
||||||
|
pub audience: String,
|
||||||
|
pub issuer: String,
|
||||||
|
pub issued: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Token {
|
||||||
|
fn default() -> Self {
|
||||||
|
Token {
|
||||||
|
scope: String::new(),
|
||||||
|
expiration: -1,
|
||||||
|
audience: String::new(),
|
||||||
|
issuer: String::new(),
|
||||||
|
issued: -1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Token {
|
||||||
|
pub fn _to_json(&self) -> Result<String, serde_json::Error> {
|
||||||
|
return serde_json::to_string_pretty(&self);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Implement
|
||||||
|
pub fn token_expired(&self) -> bool {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Implement
|
||||||
|
pub fn contains_scope(&self, des_scope: String) -> bool {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
9
src/types.rs
Normal file
9
src/types.rs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
use std::default::Default;
|
||||||
|
|
||||||
|
mod types {
|
||||||
|
pub enum Types {
|
||||||
|
WAV_EXTENSION,
|
||||||
|
FLAC_EXTENSION,
|
||||||
|
MP_EXTENSION,
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user