Updated models
This commit is contained in:
+12
-2
@@ -1,6 +1,7 @@
|
||||
use std::default::Default;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
// mod models {
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct API {
|
||||
@@ -8,4 +9,13 @@ pub struct API {
|
||||
pub endpoint: String,
|
||||
pub version: String,
|
||||
}
|
||||
// }
|
||||
|
||||
impl Default for API {
|
||||
fn default() -> Self {
|
||||
API {
|
||||
url: String::from(""),
|
||||
endpoint: String::from(""),
|
||||
version: String::from(""),
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
-2
@@ -1,9 +1,18 @@
|
||||
use std::default::Default;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
// mod models {
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct Flags {
|
||||
pub flag: String,
|
||||
pub value: String,
|
||||
}
|
||||
// }
|
||||
|
||||
impl Default for Flags {
|
||||
fn default() -> Self {
|
||||
Flags {
|
||||
flag: String::new(),
|
||||
value: String::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
use std::default::Default;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::models;
|
||||
|
||||
// mod models {
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct IcarusAction {
|
||||
@@ -10,6 +11,15 @@ pub struct IcarusAction {
|
||||
pub flags: Vec<models::flags::Flags>,
|
||||
}
|
||||
|
||||
impl Default for IcarusAction {
|
||||
fn default() -> Self {
|
||||
IcarusAction {
|
||||
action: String::new(),
|
||||
flags: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl IcarusAction {
|
||||
// TODO: Implement
|
||||
pub fn retrieve_flag_value(&self, flag: &String) -> String {
|
||||
@@ -19,4 +29,3 @@ impl IcarusAction {
|
||||
// TODO: Implement
|
||||
pub fn print_action_and_flags(&self) {}
|
||||
}
|
||||
// }
|
||||
|
||||
+46
-17
@@ -1,23 +1,43 @@
|
||||
use std::default::Default;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
// mod models {
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct Song {
|
||||
pub id: i32,
|
||||
pub title: String,
|
||||
pub artist: String,
|
||||
pub album: String,
|
||||
pub genre: String,
|
||||
pub year: i32,
|
||||
pub duration: f64,
|
||||
pub track: i32,
|
||||
pub disc: i32,
|
||||
pub data: String,
|
||||
pub id: Option<i32>,
|
||||
pub title: Option<String>,
|
||||
pub artist: Option<String>,
|
||||
pub album: Option<String>,
|
||||
pub genre: Option<String>,
|
||||
pub year: Option<i32>,
|
||||
pub duration: Option<f64>,
|
||||
pub track: Option<i32>,
|
||||
pub disc: Option<i32>,
|
||||
pub data: Option<String>,
|
||||
// use filepath instead
|
||||
// pub song_path: String,
|
||||
pub filepath: String,
|
||||
pub directory: String,
|
||||
pub filepath: Option<String>,
|
||||
pub directory: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for Song {
|
||||
fn default() -> Self {
|
||||
Song {
|
||||
id: None,
|
||||
title: None,
|
||||
artist: None,
|
||||
album: None,
|
||||
genre: None,
|
||||
year: None,
|
||||
duration: None,
|
||||
track: None,
|
||||
disc: None,
|
||||
data: None,
|
||||
filepath: None,
|
||||
directory: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Song {
|
||||
@@ -42,8 +62,17 @@ impl Song {
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct CoverArt {
|
||||
pub id: i32,
|
||||
pub title: String,
|
||||
pub path: String,
|
||||
pub id: Option<i32>,
|
||||
pub title: Option<String>,
|
||||
pub path: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for CoverArt {
|
||||
fn default() -> Self {
|
||||
CoverArt {
|
||||
id: None,
|
||||
title: None,
|
||||
path: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
+15
-5
@@ -1,11 +1,21 @@
|
||||
use std::default::Default;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
// mod models {
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct Token {
|
||||
pub access_token: String,
|
||||
pub token_type: String,
|
||||
pub expiration: i32,
|
||||
pub access_token: Option<String>,
|
||||
pub token_type: Option<String>,
|
||||
pub expiration: Option<i32>,
|
||||
}
|
||||
|
||||
impl Default for Token {
|
||||
fn default() -> Self {
|
||||
Token {
|
||||
access_token: None,
|
||||
token_type: None,
|
||||
expiration: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
use std::default::Default;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
// mod models {
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct UploadForm {
|
||||
pub url: String,
|
||||
pub filepath: String,
|
||||
pub url: Option<String>,
|
||||
pub filepath: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for UploadForm {
|
||||
fn default() -> Self {
|
||||
UploadForm {
|
||||
url: None,
|
||||
filepath: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
+11
-2
@@ -1,4 +1,5 @@
|
||||
// mod models {
|
||||
use std::default::Default;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
@@ -6,4 +7,12 @@ pub struct User {
|
||||
pub username: String,
|
||||
pub password: String,
|
||||
}
|
||||
// }
|
||||
|
||||
impl Default for User {
|
||||
fn default() -> Self {
|
||||
User {
|
||||
username: String::new(),
|
||||
password: String::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user