diff --git a/Cargo.lock b/Cargo.lock index cfc625e..098628d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -827,12 +827,6 @@ dependencies = [ "either", ] -[[package]] -name = "itoa" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" - [[package]] name = "lazy_static" version = "1.4.0" @@ -1026,8 +1020,6 @@ dependencies = [ "diesel_migrations", "log", "rand", - "serde", - "serde_json", "thiserror", "tokio", "uuid", @@ -1318,12 +1310,6 @@ dependencies = [ "semver", ] -[[package]] -name = "ryu" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" - [[package]] name = "sanitize-filename" version = "0.3.0" @@ -1357,31 +1343,6 @@ name = "serde" version = "1.0.135" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cf9235533494ea2ddcdb794665461814781c53f19d87b76e571a1c35acbad2b" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.135" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dcde03d87d4c973c04be249e7d8f0b35db1c848c487bd43032808e59dd8328d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.78" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d23c1ba4cf0efd44be32017709280b32d1cea5c3f1275c3b6d9e8bc54f758085" -dependencies = [ - "itoa", - "ryu", - "serde", -] [[package]] name = "sha2" diff --git a/database/Cargo.toml b/database/Cargo.toml index f8d5e78..d467cdd 100644 --- a/database/Cargo.toml +++ b/database/Cargo.toml @@ -8,8 +8,6 @@ diesel = { version = "1.4.5", features = ["sqlite"] } diesel_migrations = "1.4.0" log = "0.4.14" rand = "0.7.3" -serde = { version = "1.0.117", features = ["derive"] } -serde_json = "1.0.59" thiserror = "1.0.23" tokio = { version = "1.4.0", features = ["sync"] } uuid = { version = "0.8", features = ["v4"] } diff --git a/database/src/ensembles.rs b/database/src/ensembles.rs index 6d41c0e..f08c9c8 100644 --- a/database/src/ensembles.rs +++ b/database/src/ensembles.rs @@ -2,11 +2,9 @@ use super::schema::ensembles; use super::{Database, Result}; use diesel::prelude::*; use log::info; -use serde::{Deserialize, Serialize}; /// An ensemble that takes part in recordings. -#[derive(Serialize, Deserialize, Insertable, Queryable, PartialEq, Eq, Hash, Debug, Clone)] -#[serde(rename_all = "camelCase")] +#[derive(Insertable, Queryable, PartialEq, Eq, Hash, Debug, Clone)] pub struct Ensemble { pub id: String, pub name: String, diff --git a/database/src/instruments.rs b/database/src/instruments.rs index 739ad6e..eb00392 100644 --- a/database/src/instruments.rs +++ b/database/src/instruments.rs @@ -2,11 +2,9 @@ use super::schema::instruments; use super::{Database, Result}; use diesel::prelude::*; use log::info; -use serde::{Deserialize, Serialize}; /// An instrument or any other possible role within a recording. -#[derive(Serialize, Deserialize, Insertable, Queryable, PartialEq, Eq, Hash, Debug, Clone)] -#[serde(rename_all = "camelCase")] +#[derive(Insertable, Queryable, PartialEq, Eq, Hash, Debug, Clone)] pub struct Instrument { pub id: String, pub name: String, diff --git a/database/src/medium.rs b/database/src/medium.rs index 7887f60..6d5b2b5 100644 --- a/database/src/medium.rs +++ b/database/src/medium.rs @@ -3,12 +3,10 @@ use super::schema::{ensembles, mediums, performances, persons, recordings, track use super::{Database, Error, Recording, Result}; use diesel::prelude::*; use log::info; -use serde::{Deserialize, Serialize}; /// Representation of someting like a physical audio disc or a folder with /// audio files (i.e. a collection of tracks for one or more recordings). -#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)] -#[serde(rename_all = "camelCase")] +#[derive(PartialEq, Eq, Hash, Debug, Clone)] pub struct Medium { /// An unique ID for the medium. pub id: String, @@ -24,8 +22,7 @@ pub struct Medium { } /// A track on a medium. -#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)] -#[serde(rename_all = "camelCase")] +#[derive(PartialEq, Eq, Hash, Debug, Clone)] pub struct Track { /// The recording on this track. pub recording: Recording, @@ -38,9 +35,7 @@ pub struct Track { /// the metadata with the audio data from the source when importing. pub source_index: usize, - /// The path to the audio file containing this track. This will not be - /// included when communicating with the server. - #[serde(skip)] + /// The path to the audio file containing this track. pub path: String, } diff --git a/database/src/persons.rs b/database/src/persons.rs index 594aa27..eaec2f3 100644 --- a/database/src/persons.rs +++ b/database/src/persons.rs @@ -2,11 +2,9 @@ use super::schema::persons; use super::{Database, Result}; use diesel::prelude::*; use log::info; -use serde::{Deserialize, Serialize}; /// A person that is a composer, an interpret or both. -#[derive(Serialize, Deserialize, Insertable, Queryable, PartialEq, Eq, Hash, Debug, Clone)] -#[serde(rename_all = "camelCase")] +#[derive(Insertable, Queryable, PartialEq, Eq, Hash, Debug, Clone)] pub struct Person { pub id: String, pub first_name: String, diff --git a/database/src/recordings.rs b/database/src/recordings.rs index aeec3b5..1838ea8 100644 --- a/database/src/recordings.rs +++ b/database/src/recordings.rs @@ -3,11 +3,9 @@ use super::schema::{ensembles, performances, persons, recordings}; use super::{Database, Ensemble, Error, Instrument, Person, Result, Work}; use diesel::prelude::*; use log::info; -use serde::{Deserialize, Serialize}; /// A specific recording of a work. -#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)] -#[serde(rename_all = "camelCase")] +#[derive(PartialEq, Eq, Hash, Debug, Clone)] pub struct Recording { pub id: String, pub work: Work, @@ -40,8 +38,7 @@ impl Recording { } /// How a person or ensemble was involved in a recording. -#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)] -#[serde(rename_all = "camelCase")] +#[derive(PartialEq, Eq, Hash, Debug, Clone)] pub struct Performance { pub performer: PersonOrEnsemble, pub role: Option, @@ -62,7 +59,7 @@ impl Performance { } /// Either a person or an ensemble. -#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Clone, Debug)] +#[derive(PartialEq, Eq, Hash, Clone, Debug)] pub enum PersonOrEnsemble { Person(Person), Ensemble(Ensemble), diff --git a/database/src/works.rs b/database/src/works.rs index 6512043..b5a193a 100644 --- a/database/src/works.rs +++ b/database/src/works.rs @@ -4,7 +4,6 @@ use super::{Database, Error, Instrument, Person, Result}; use diesel::prelude::*; use diesel::{Insertable, Queryable}; use log::info; -use serde::{Deserialize, Serialize}; /// Table row data for a work. #[derive(Insertable, Queryable, Debug, Clone)] @@ -54,23 +53,20 @@ struct WorkSectionRow { pub before_index: i64, } /// A concrete work part that can be recorded. -#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)] -#[serde(rename_all = "camelCase")] +#[derive(PartialEq, Eq, Hash, Debug, Clone)] pub struct WorkPart { pub title: String, } /// A heading between work parts. -#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)] -#[serde(rename_all = "camelCase")] +#[derive(PartialEq, Eq, Hash, Debug, Clone)] pub struct WorkSection { pub title: String, pub before_index: usize, } /// A specific work by a composer. -#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)] -#[serde(rename_all = "camelCase")] +#[derive(PartialEq, Eq, Hash, Debug, Clone)] pub struct Work { pub id: String, pub title: String,