mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 11:47:25 +01:00
database: Remove serde
This commit is contained in:
parent
32ecf2d4bd
commit
678367ec1a
8 changed files with 12 additions and 71 deletions
39
Cargo.lock
generated
39
Cargo.lock
generated
|
|
@ -827,12 +827,6 @@ dependencies = [
|
||||||
"either",
|
"either",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "itoa"
|
|
||||||
version = "1.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy_static"
|
name = "lazy_static"
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
|
|
@ -1026,8 +1020,6 @@ dependencies = [
|
||||||
"diesel_migrations",
|
"diesel_migrations",
|
||||||
"log",
|
"log",
|
||||||
"rand",
|
"rand",
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
"uuid",
|
"uuid",
|
||||||
|
|
@ -1318,12 +1310,6 @@ dependencies = [
|
||||||
"semver",
|
"semver",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ryu"
|
|
||||||
version = "1.0.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sanitize-filename"
|
name = "sanitize-filename"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
|
@ -1357,31 +1343,6 @@ name = "serde"
|
||||||
version = "1.0.135"
|
version = "1.0.135"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2cf9235533494ea2ddcdb794665461814781c53f19d87b76e571a1c35acbad2b"
|
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]]
|
[[package]]
|
||||||
name = "sha2"
|
name = "sha2"
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,6 @@ diesel = { version = "1.4.5", features = ["sqlite"] }
|
||||||
diesel_migrations = "1.4.0"
|
diesel_migrations = "1.4.0"
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
rand = "0.7.3"
|
rand = "0.7.3"
|
||||||
serde = { version = "1.0.117", features = ["derive"] }
|
|
||||||
serde_json = "1.0.59"
|
|
||||||
thiserror = "1.0.23"
|
thiserror = "1.0.23"
|
||||||
tokio = { version = "1.4.0", features = ["sync"] }
|
tokio = { version = "1.4.0", features = ["sync"] }
|
||||||
uuid = { version = "0.8", features = ["v4"] }
|
uuid = { version = "0.8", features = ["v4"] }
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,9 @@ use super::schema::ensembles;
|
||||||
use super::{Database, Result};
|
use super::{Database, Result};
|
||||||
use diesel::prelude::*;
|
use diesel::prelude::*;
|
||||||
use log::info;
|
use log::info;
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
/// An ensemble that takes part in recordings.
|
/// An ensemble that takes part in recordings.
|
||||||
#[derive(Serialize, Deserialize, Insertable, Queryable, PartialEq, Eq, Hash, Debug, Clone)]
|
#[derive(Insertable, Queryable, PartialEq, Eq, Hash, Debug, Clone)]
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Ensemble {
|
pub struct Ensemble {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,9 @@ use super::schema::instruments;
|
||||||
use super::{Database, Result};
|
use super::{Database, Result};
|
||||||
use diesel::prelude::*;
|
use diesel::prelude::*;
|
||||||
use log::info;
|
use log::info;
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
/// An instrument or any other possible role within a recording.
|
/// An instrument or any other possible role within a recording.
|
||||||
#[derive(Serialize, Deserialize, Insertable, Queryable, PartialEq, Eq, Hash, Debug, Clone)]
|
#[derive(Insertable, Queryable, PartialEq, Eq, Hash, Debug, Clone)]
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Instrument {
|
pub struct Instrument {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,10 @@ use super::schema::{ensembles, mediums, performances, persons, recordings, track
|
||||||
use super::{Database, Error, Recording, Result};
|
use super::{Database, Error, Recording, Result};
|
||||||
use diesel::prelude::*;
|
use diesel::prelude::*;
|
||||||
use log::info;
|
use log::info;
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
/// Representation of someting like a physical audio disc or a folder with
|
/// 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).
|
/// audio files (i.e. a collection of tracks for one or more recordings).
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)]
|
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Medium {
|
pub struct Medium {
|
||||||
/// An unique ID for the medium.
|
/// An unique ID for the medium.
|
||||||
pub id: String,
|
pub id: String,
|
||||||
|
|
@ -24,8 +22,7 @@ pub struct Medium {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A track on a medium.
|
/// A track on a medium.
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)]
|
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Track {
|
pub struct Track {
|
||||||
/// The recording on this track.
|
/// The recording on this track.
|
||||||
pub recording: Recording,
|
pub recording: Recording,
|
||||||
|
|
@ -38,9 +35,7 @@ pub struct Track {
|
||||||
/// the metadata with the audio data from the source when importing.
|
/// the metadata with the audio data from the source when importing.
|
||||||
pub source_index: usize,
|
pub source_index: usize,
|
||||||
|
|
||||||
/// The path to the audio file containing this track. This will not be
|
/// The path to the audio file containing this track.
|
||||||
/// included when communicating with the server.
|
|
||||||
#[serde(skip)]
|
|
||||||
pub path: String,
|
pub path: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,9 @@ use super::schema::persons;
|
||||||
use super::{Database, Result};
|
use super::{Database, Result};
|
||||||
use diesel::prelude::*;
|
use diesel::prelude::*;
|
||||||
use log::info;
|
use log::info;
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
/// A person that is a composer, an interpret or both.
|
/// A person that is a composer, an interpret or both.
|
||||||
#[derive(Serialize, Deserialize, Insertable, Queryable, PartialEq, Eq, Hash, Debug, Clone)]
|
#[derive(Insertable, Queryable, PartialEq, Eq, Hash, Debug, Clone)]
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Person {
|
pub struct Person {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub first_name: String,
|
pub first_name: String,
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,9 @@ use super::schema::{ensembles, performances, persons, recordings};
|
||||||
use super::{Database, Ensemble, Error, Instrument, Person, Result, Work};
|
use super::{Database, Ensemble, Error, Instrument, Person, Result, Work};
|
||||||
use diesel::prelude::*;
|
use diesel::prelude::*;
|
||||||
use log::info;
|
use log::info;
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
/// A specific recording of a work.
|
/// A specific recording of a work.
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)]
|
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Recording {
|
pub struct Recording {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub work: Work,
|
pub work: Work,
|
||||||
|
|
@ -40,8 +38,7 @@ impl Recording {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// How a person or ensemble was involved in a recording.
|
/// How a person or ensemble was involved in a recording.
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)]
|
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Performance {
|
pub struct Performance {
|
||||||
pub performer: PersonOrEnsemble,
|
pub performer: PersonOrEnsemble,
|
||||||
pub role: Option<Instrument>,
|
pub role: Option<Instrument>,
|
||||||
|
|
@ -62,7 +59,7 @@ impl Performance {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Either a person or an ensemble.
|
/// Either a person or an ensemble.
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Clone, Debug)]
|
#[derive(PartialEq, Eq, Hash, Clone, Debug)]
|
||||||
pub enum PersonOrEnsemble {
|
pub enum PersonOrEnsemble {
|
||||||
Person(Person),
|
Person(Person),
|
||||||
Ensemble(Ensemble),
|
Ensemble(Ensemble),
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ use super::{Database, Error, Instrument, Person, Result};
|
||||||
use diesel::prelude::*;
|
use diesel::prelude::*;
|
||||||
use diesel::{Insertable, Queryable};
|
use diesel::{Insertable, Queryable};
|
||||||
use log::info;
|
use log::info;
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
/// Table row data for a work.
|
/// Table row data for a work.
|
||||||
#[derive(Insertable, Queryable, Debug, Clone)]
|
#[derive(Insertable, Queryable, Debug, Clone)]
|
||||||
|
|
@ -54,23 +53,20 @@ struct WorkSectionRow {
|
||||||
pub before_index: i64,
|
pub before_index: i64,
|
||||||
}
|
}
|
||||||
/// A concrete work part that can be recorded.
|
/// A concrete work part that can be recorded.
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)]
|
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct WorkPart {
|
pub struct WorkPart {
|
||||||
pub title: String,
|
pub title: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A heading between work parts.
|
/// A heading between work parts.
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)]
|
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct WorkSection {
|
pub struct WorkSection {
|
||||||
pub title: String,
|
pub title: String,
|
||||||
pub before_index: usize,
|
pub before_index: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A specific work by a composer.
|
/// A specific work by a composer.
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)]
|
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Work {
|
pub struct Work {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue