Skip to content

Commit

Permalink
refactor(music-folder): move music folder related endpoint to another… (
Browse files Browse the repository at this point in the history
  • Loading branch information
vnghia authored Apr 14, 2024
1 parent 9716e76 commit 3cb9a77
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 12 deletions.
4 changes: 3 additions & 1 deletion frontend/src/components/folder/list.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use dioxus::prelude::*;
use nghe_types::browsing::get_folder_stats::{GetFolderStatsParams, SubsonicGetFolderStatsBody};
use nghe_types::music_folder::get_folder_stats::{
GetFolderStatsParams, SubsonicGetFolderStatsBody,
};
use readable::byte::*;
use readable::num::*;

Expand Down
4 changes: 2 additions & 2 deletions src/models/music_folders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use uuid::Uuid;

pub use crate::schema::music_folders;

#[add_convert_types(into = nghe_types::browsing::MusicFolder, skips(path))]
#[add_convert_types(into = nghe_types::browsing::MusicFolderPath)]
#[add_convert_types(into = nghe_types::music_folder::MusicFolder, skips(path))]
#[add_convert_types(into = nghe_types::music_folder::MusicFolderPath)]
#[derive(Debug, Queryable, Selectable)]
#[diesel(table_name = music_folders)]
#[diesel(check_for_backend(diesel::pg::Pg))]
Expand Down
3 changes: 0 additions & 3 deletions src/open_subsonic/browsing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ mod get_album_info2;
mod get_artist;
mod get_artist_info2;
mod get_artists;
mod get_folder_stats;
mod get_genres;
mod get_indexes;
mod get_music_directory;
Expand Down Expand Up @@ -43,6 +42,4 @@ pub fn router() -> Router<crate::Database> {
.route("/rest/getAlbumInfo2.view", get(get_album_info2::get_album_info2_handler))
.route("/rest/getArtistInfo2", get(get_artist_info2::get_artist_info2_handler))
.route("/rest/getArtistInfo2.view", get(get_artist_info2::get_artist_info2_handler))
.route("/rest/getFolderStats", get(get_folder_stats::get_folder_stats_handler))
.route("/rest/getFolderStats.view", get(get_folder_stats::get_folder_stats_handler))
}
1 change: 1 addition & 0 deletions src/open_subsonic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pub mod extension;
pub mod media_annotation;
pub mod media_list;
pub mod media_retrieval;
pub mod music_folder;
pub mod permission;
pub mod scan;
pub mod searching;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::{Database, DatabasePool};
add_common_validate!(GetFolderStatsParams, admin);
add_axum_response!(GetFolderStatsBody);

#[add_convert_types(into = nghe_types::browsing::get_folder_stats::FolderStats)]
#[add_convert_types(into = nghe_types::music_folder::get_folder_stats::FolderStats)]
#[derive(Debug, Queryable)]
#[diesel(table_name = music_folders)]
#[diesel(check_for_backend(diesel::pg::Pg))]
Expand Down
10 changes: 10 additions & 0 deletions src/open_subsonic/music_folder/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
mod get_folder_stats;

use axum::routing::get;
use axum::Router;

pub fn router() -> Router<crate::Database> {
Router::new()
.route("/rest/getFolderStats", get(get_folder_stats::get_folder_stats_handler))
.route("/rest/getFolderStats.view", get(get_folder_stats::get_folder_stats_handler))
}
2 changes: 1 addition & 1 deletion types/src/browsing/get_music_folders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use nghe_proc_macros::{
add_common_convert, add_request_types_test, add_subsonic_response, add_types_derive,
};

use super::MusicFolder;
use crate::music_folder::MusicFolder;

#[add_common_convert]
pub struct GetMusicFoldersParams {}
Expand Down
4 changes: 0 additions & 4 deletions types/src/browsing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ pub mod get_album_info2;
pub mod get_artist;
pub mod get_artist_info2;
pub mod get_artists;
pub mod get_folder_stats;
pub mod get_genres;
pub mod get_indexes;
pub mod get_music_directory;
pub mod get_music_folders;
pub mod get_song;
pub mod get_top_songs;
pub mod music_folder;

pub use music_folder::{MusicFolder, MusicFolderPath};
1 change: 1 addition & 0 deletions types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub mod extension;
pub mod media_annotation;
pub mod media_list;
pub mod media_retrieval;
pub mod music_folder;
pub mod permission;
pub mod scan;
pub mod searching;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pub mod get_folder_stats;

use nghe_proc_macros::add_types_derive;
use uuid::Uuid;

Expand Down

0 comments on commit 3cb9a77

Please sign in to comment.