chore: update dependencies
This commit is contained in:
parent
297658124b
commit
41c0001c08
12 changed files with 341 additions and 399 deletions
622
Cargo.lock
generated
622
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -89,9 +89,9 @@ http = "1.0.0"
|
|||
http-body-util = "0.1.2"
|
||||
hyper = "1.0.0"
|
||||
tower = "0.5.0"
|
||||
tower-http = { version = "0.5.0", features = ["trace"] }
|
||||
utoipa = "4.0.0"
|
||||
utoipa-rapidoc = { version = "4.0.0", features = ["axum"] }
|
||||
tower-http = { version = "0.6.0", features = ["trace"] }
|
||||
utoipa = "5.0.0"
|
||||
utoipa-rapidoc = { version = "5.0.0", features = ["axum"] }
|
||||
web-lang = "0.1.0"
|
||||
|
||||
# Web services
|
||||
|
@ -113,7 +113,7 @@ spotify-genrebase = { version = "0.1.0", registry = "thetadev" } # crates: disab
|
|||
|
||||
# Dev dependencies
|
||||
sqlx-database-tester = { path = "crates/sqlx-database-tester" }
|
||||
rstest = { version = "0.22.0", default-features = false }
|
||||
rstest = { version = "0.23.0", default-features = false }
|
||||
insta = { version = "1.30.0", features = ["ron", "redactions"] }
|
||||
|
||||
[profile.dev.package]
|
||||
|
|
|
@ -109,6 +109,7 @@ pub enum UserType {
|
|||
|
||||
/// Data sources to be synchronized
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "utoipa", derive(ToSchema))]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum SyncKind {
|
||||
/// Synchronization of the main item
|
||||
|
@ -133,6 +134,7 @@ pub enum SearchFilterType {
|
|||
|
||||
/// Description text format
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "utoipa", derive(ToSchema))]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum TextFormat {
|
||||
/// HTML
|
||||
|
|
|
@ -82,6 +82,7 @@ pub struct TreeGenre {
|
|||
pub metagenre: bool,
|
||||
/// List of subgenres
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
#[cfg_attr(feature = "utoipa", schema(no_recursion))]
|
||||
pub children: Vec<TreeGenre>,
|
||||
}
|
||||
|
||||
|
|
|
@ -122,30 +122,26 @@ impl<'de> Deserialize<'de> for TId<'static> {
|
|||
}
|
||||
|
||||
#[cfg(feature = "utoipa")]
|
||||
impl<'s> utoipa::ToSchema<'s> for TId<'_> {
|
||||
fn schema() -> (
|
||||
&'s str,
|
||||
utoipa::openapi::RefOr<utoipa::openapi::schema::Schema>,
|
||||
) {
|
||||
(
|
||||
"TId",
|
||||
utoipa::openapi::RefOr::T(utoipa::openapi::schema::Schema::Object(
|
||||
utoipa::openapi::schema::ObjectBuilder::new()
|
||||
.schema_type(utoipa::openapi::SchemaType::String)
|
||||
.nullable(false)
|
||||
.pattern(Some(r"^[a-z]{2}:.+$"))
|
||||
.example(Some("yt:dQw4w9WgXcQ".into()))
|
||||
.description(Some(r#"Every Tiraya entity has its unique ID which consists of a service code and source id, separated by a colon.
|
||||
impl utoipa::PartialSchema for TId<'_> {
|
||||
fn schema() -> utoipa::openapi::RefOr<utoipa::openapi::schema::Schema> {
|
||||
utoipa::openapi::RefOr::T(utoipa::openapi::schema::Schema::Object(
|
||||
utoipa::openapi::schema::ObjectBuilder::new()
|
||||
.schema_type(utoipa::openapi::schema::SchemaType::Type(utoipa::openapi::Type::String))
|
||||
.pattern(Some(r"^[a-z]{2}:.+$"))
|
||||
.examples(["yt:dQw4w9WgXcQ"])
|
||||
.description(Some(r#"Every Tiraya entity has its unique ID which consists of a service code and source id, separated by a colon.
|
||||
|
||||
Service codes are 2-letter identifiers for the streaming services supported by Tiraya. `ty` is Tiraya's own service code and is used for local users and playlists.
|
||||
|
||||
The source ID is the identifier used by the actual streaming service. Tiraya's own source IDs are base58-encoded UUIDs."#))
|
||||
.build(),
|
||||
)),
|
||||
)
|
||||
.build(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "utoipa")]
|
||||
impl utoipa::ToSchema for TId<'_> {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
|
@ -11,9 +11,9 @@ use spotify_genrebase::GenreDb;
|
|||
use sqlx::PgPool;
|
||||
use tiraya_api_model::{
|
||||
Album, AlbumSlim, AlbumTag, AlbumType, ApiError, ApiErrorKind, Artist, ArtistSlim, ArtistTag,
|
||||
DatePrecision, Genre, MusicService, Playlist, PlaylistEntry, PlaylistSlim, PlaylistType,
|
||||
SearchFilterType, SearchResult, TId, Track, TrackPlaybackInfo, TrackSlim, TreeGenre, User,
|
||||
UserSlim, UserType,
|
||||
DatePrecision, FormattedText, Genre, MusicService, Playlist, PlaylistEntry, PlaylistSlim,
|
||||
PlaylistType, SearchFilterType, SearchResult, SyncEntry, SyncKind, TId, TextFormat, TirayaItem,
|
||||
Track, TrackPlaybackInfo, TrackSlim, TreeGenre, User, UserSlim, UserType,
|
||||
};
|
||||
use tiraya_extractor::Extractor;
|
||||
use tiraya_proxy::Proxy;
|
||||
|
@ -59,9 +59,14 @@ use utoipa::OpenApi;
|
|||
TId,
|
||||
MusicService,
|
||||
DatePrecision,
|
||||
FormattedText,
|
||||
AlbumType,
|
||||
UserType,
|
||||
SearchFilterType,
|
||||
SyncEntry,
|
||||
SyncKind,
|
||||
TextFormat,
|
||||
TirayaItem,
|
||||
ApiError,
|
||||
ApiErrorKind,
|
||||
))
|
||||
|
|
|
@ -30,9 +30,9 @@ pub struct GetAlbumQuery {
|
|||
tag = "Album",
|
||||
responses(
|
||||
(status = 200, description = "Returns an album", body = Album),
|
||||
(status = 400, description = "Bad request", body = ApiError),
|
||||
(status = 404, description = "Album not found", body = ApiError),
|
||||
(status = 500, description = "Internal error", body = ApiError),
|
||||
(status = 400, description = "Bad request", body = tiraya_api_model::ApiError),
|
||||
(status = 404, description = "Album not found", body = tiraya_api_model::ApiError),
|
||||
(status = 500, description = "Internal error", body = tiraya_api_model::ApiError),
|
||||
)
|
||||
)]
|
||||
pub async fn get_album(
|
||||
|
|
|
@ -24,9 +24,9 @@ use crate::{
|
|||
tag = "Artist",
|
||||
responses(
|
||||
(status = 200, description = "Returns an artist", body = Artist),
|
||||
(status = 400, description = "Bad request", body = ApiError),
|
||||
(status = 404, description = "Artist not found", body = ApiError),
|
||||
(status = 500, description = "Internal error", body = ApiError),
|
||||
(status = 400, description = "Bad request", body = tiraya_api_model::ApiError),
|
||||
(status = 404, description = "Artist not found", body = tiraya_api_model::ApiError),
|
||||
(status = 500, description = "Internal error", body = tiraya_api_model::ApiError),
|
||||
)
|
||||
)]
|
||||
pub async fn get_artist(
|
||||
|
@ -60,9 +60,9 @@ pub async fn get_artist(
|
|||
tag = "Artist",
|
||||
responses(
|
||||
(status = 200, description = "Returns artist albums", body = Vec<AlbumSlim>),
|
||||
(status = 400, description = "Bad request", body = ApiError),
|
||||
(status = 404, description = "Artist not found", body = ApiError),
|
||||
(status = 500, description = "Internal error", body = ApiError),
|
||||
(status = 400, description = "Bad request", body = tiraya_api_model::ApiError),
|
||||
(status = 404, description = "Artist not found", body = tiraya_api_model::ApiError),
|
||||
(status = 500, description = "Internal error", body = tiraya_api_model::ApiError),
|
||||
)
|
||||
)]
|
||||
pub async fn get_artist_albums(
|
||||
|
@ -98,9 +98,9 @@ pub struct GetArtistTracksQuery {
|
|||
tag = "Artist",
|
||||
responses(
|
||||
(status = 200, description = "Returns artist tracks", body = Vec<TrackSlim>),
|
||||
(status = 400, description = "Bad request", body = ApiError),
|
||||
(status = 404, description = "Artist not found", body = ApiError),
|
||||
(status = 500, description = "Internal error", body = ApiError),
|
||||
(status = 400, description = "Bad request", body = tiraya_api_model::ApiError),
|
||||
(status = 404, description = "Artist not found", body = tiraya_api_model::ApiError),
|
||||
(status = 500, description = "Internal error", body = tiraya_api_model::ApiError),
|
||||
)
|
||||
)]
|
||||
pub async fn get_artist_tracks(
|
||||
|
@ -139,9 +139,9 @@ pub async fn get_artist_tracks(
|
|||
tag = "Artist",
|
||||
responses(
|
||||
(status = 200, description = "Returns artist playlists", body = Vec<PlaylistSlim>),
|
||||
(status = 400, description = "Bad request", body = ApiError),
|
||||
(status = 404, description = "Artist not found", body = ApiError),
|
||||
(status = 500, description = "Internal error", body = ApiError),
|
||||
(status = 400, description = "Bad request", body = tiraya_api_model::ApiError),
|
||||
(status = 404, description = "Artist not found", body = tiraya_api_model::ApiError),
|
||||
(status = 500, description = "Internal error", body = tiraya_api_model::ApiError),
|
||||
)
|
||||
)]
|
||||
pub async fn get_artist_playlists(
|
||||
|
@ -168,9 +168,9 @@ pub async fn get_artist_playlists(
|
|||
tag = "Artist",
|
||||
responses(
|
||||
(status = 200, description = "Returns related artists", body = Vec<ArtistSlim>),
|
||||
(status = 400, description = "Bad request", body = ApiError),
|
||||
(status = 404, description = "Artist not found", body = ApiError),
|
||||
(status = 500, description = "Internal error", body = ApiError),
|
||||
(status = 400, description = "Bad request", body = tiraya_api_model::ApiError),
|
||||
(status = 404, description = "Artist not found", body = tiraya_api_model::ApiError),
|
||||
(status = 500, description = "Internal error", body = tiraya_api_model::ApiError),
|
||||
)
|
||||
)]
|
||||
pub async fn get_artist_related(
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::collections::HashMap;
|
|||
|
||||
use axum::extract::State;
|
||||
use serde::Deserialize;
|
||||
use tiraya_api_model::{Playlist, UserSlim};
|
||||
use tiraya_api_model::{Artist, Playlist, UserSlim};
|
||||
use tiraya_db::models::{self as tdb};
|
||||
use tiraya_extractor::parse_validate_tid;
|
||||
use tiraya_utils::EntityType;
|
||||
|
@ -35,9 +35,9 @@ pub struct GetPlaylistQuery {
|
|||
tag = "Playlist",
|
||||
responses(
|
||||
(status = 200, description = "Returns a playlist", body = Artist),
|
||||
(status = 400, description = "Bad request", body = ApiError),
|
||||
(status = 404, description = "Playlist not found", body = ApiError),
|
||||
(status = 500, description = "Internal error", body = ApiError),
|
||||
(status = 400, description = "Bad request", body = tiraya_api_model::ApiError),
|
||||
(status = 404, description = "Playlist not found", body = tiraya_api_model::ApiError),
|
||||
(status = 500, description = "Internal error", body = tiraya_api_model::ApiError),
|
||||
)
|
||||
)]
|
||||
pub async fn get_playlist(
|
||||
|
|
|
@ -31,8 +31,8 @@ pub struct SearchQuery {
|
|||
tag = "Search",
|
||||
responses(
|
||||
(status = 200, description = "Returns the search result", body = SearchResult),
|
||||
(status = 400, description = "Bad request", body = ApiError),
|
||||
(status = 500, description = "Internal error", body = ApiError),
|
||||
(status = 400, description = "Bad request", body = tiraya_api_model::ApiError),
|
||||
(status = 500, description = "Internal error", body = tiraya_api_model::ApiError),
|
||||
)
|
||||
)]
|
||||
pub async fn search(
|
||||
|
|
|
@ -19,9 +19,9 @@ use crate::{
|
|||
tag = "Track",
|
||||
responses(
|
||||
(status = 200, description = "Returns a track", body = Track),
|
||||
(status = 400, description = "Bad request", body = ApiError),
|
||||
(status = 404, description = "Track not found", body = ApiError),
|
||||
(status = 500, description = "Internal error", body = ApiError),
|
||||
(status = 400, description = "Bad request", body = tiraya_api_model::ApiError),
|
||||
(status = 404, description = "Track not found", body = tiraya_api_model::ApiError),
|
||||
(status = 500, description = "Internal error", body = tiraya_api_model::ApiError),
|
||||
)
|
||||
)]
|
||||
pub async fn get_track(
|
||||
|
|
|
@ -20,9 +20,9 @@ use crate::{
|
|||
tag = "User",
|
||||
responses(
|
||||
(status = 200, description = "Returns a user", body = User),
|
||||
(status = 400, description = "Bad request", body = ApiError),
|
||||
(status = 404, description = "User not found", body = ApiError),
|
||||
(status = 500, description = "Internal error", body = ApiError),
|
||||
(status = 400, description = "Bad request", body = tiraya_api_model::ApiError),
|
||||
(status = 404, description = "User not found", body = tiraya_api_model::ApiError),
|
||||
(status = 500, description = "Internal error", body = tiraya_api_model::ApiError),
|
||||
)
|
||||
)]
|
||||
pub async fn get_user(
|
||||
|
@ -45,9 +45,9 @@ pub async fn get_user(
|
|||
tag = "User",
|
||||
responses(
|
||||
(status = 200, description = "Returns user playlists", body = Vec<PlaylistSlim>),
|
||||
(status = 400, description = "Bad request", body = ApiError),
|
||||
(status = 404, description = "User not found", body = ApiError),
|
||||
(status = 500, description = "Internal error", body = ApiError),
|
||||
(status = 400, description = "Bad request", body = tiraya_api_model::ApiError),
|
||||
(status = 404, description = "User not found", body = tiraya_api_model::ApiError),
|
||||
(status = 500, description = "Internal error", body = tiraya_api_model::ApiError),
|
||||
)
|
||||
)]
|
||||
pub async fn get_user_playlists(
|
||||
|
|
Loading…
Add table
Reference in a new issue