Fix Build Warnings
This commit is contained in:
parent
45eb7191f0
commit
e5ce0eab76
@ -1,6 +1,5 @@
|
|||||||
use crate::models::Artist;
|
use crate::models::Artist;
|
||||||
use crate::components::dashboard_tile::DashboardTile;
|
use crate::components::dashboard_tile::DashboardTile;
|
||||||
use crate::components::album_info::AlbumInfo;
|
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
|
|
||||||
use chrono::NaiveDate;
|
use chrono::NaiveDate;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use leptos::*;
|
use leptos::*;
|
||||||
use crate::models::Album;
|
|
||||||
use crate::albumdata::AlbumData;
|
use crate::albumdata::AlbumData;
|
||||||
use crate::songdata::SongData;
|
use crate::songdata::SongData;
|
||||||
|
|
||||||
@ -9,12 +8,12 @@ cfg_if! {
|
|||||||
if #[cfg(feature = "ssr")] {
|
if #[cfg(feature = "ssr")] {
|
||||||
use leptos::server_fn::error::NoCustomError;
|
use leptos::server_fn::error::NoCustomError;
|
||||||
use crate::database::get_db_conn;
|
use crate::database::get_db_conn;
|
||||||
use crate::auth::get_user;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[server(endpoint = "album/get")]
|
#[server(endpoint = "album/get")]
|
||||||
pub async fn get_album(id: i32) -> Result<AlbumData, ServerFnError> {
|
pub async fn get_album(id: i32) -> Result<AlbumData, ServerFnError> {
|
||||||
|
use crate::models::Album;
|
||||||
let db_con = &mut get_db_conn();
|
let db_con = &mut get_db_conn();
|
||||||
let album = Album::get_album_data(id,db_con)
|
let album = Album::get_album_data(id,db_con)
|
||||||
.map_err(|e| ServerFnError::<NoCustomError>::ServerError(format!("Error getting album: {}", e)))?;
|
.map_err(|e| ServerFnError::<NoCustomError>::ServerError(format!("Error getting album: {}", e)))?;
|
||||||
@ -23,6 +22,7 @@ pub async fn get_album(id: i32) -> Result<AlbumData, ServerFnError> {
|
|||||||
|
|
||||||
#[server(endpoint = "album/get_songs")]
|
#[server(endpoint = "album/get_songs")]
|
||||||
pub async fn get_songs(id: i32) -> Result<Vec<SongData>, ServerFnError> {
|
pub async fn get_songs(id: i32) -> Result<Vec<SongData>, ServerFnError> {
|
||||||
|
use crate::models::Album;
|
||||||
use crate::auth::get_logged_in_user;
|
use crate::auth::get_logged_in_user;
|
||||||
let user = get_logged_in_user().await?;
|
let user = get_logged_in_user().await?;
|
||||||
let db_con = &mut get_db_conn();
|
let db_con = &mut get_db_conn();
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
use chrono::{NaiveDate, NaiveDateTime};
|
use chrono::{NaiveDate, NaiveDateTime};
|
||||||
use leptos::{server, ServerFnError};
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use crate::songdata::SongData;
|
|
||||||
use crate::albumdata::AlbumData;
|
|
||||||
|
|
||||||
use cfg_if::cfg_if;
|
use cfg_if::cfg_if;
|
||||||
|
|
||||||
@ -11,6 +8,8 @@ cfg_if! {
|
|||||||
use diesel::prelude::*;
|
use diesel::prelude::*;
|
||||||
use crate::database::*;
|
use crate::database::*;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
use crate::songdata::SongData;
|
||||||
|
use crate::albumdata::AlbumData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,7 +541,6 @@ impl Album {
|
|||||||
#[cfg(feature = "ssr")]
|
#[cfg(feature = "ssr")]
|
||||||
pub fn get_album_data(album_id: i32, conn: &mut PgPooledConn) -> Result<AlbumData, Box<dyn Error>> {
|
pub fn get_album_data(album_id: i32, conn: &mut PgPooledConn) -> Result<AlbumData, Box<dyn Error>> {
|
||||||
use crate::schema::*;
|
use crate::schema::*;
|
||||||
use crate::database::get_db_conn;
|
|
||||||
|
|
||||||
let album: Vec<(Album, std::option::Option<Artist>)> = albums::table
|
let album: Vec<(Album, std::option::Option<Artist>)> = albums::table
|
||||||
.find(album_id)
|
.find(album_id)
|
||||||
@ -593,7 +591,6 @@ impl Album {
|
|||||||
#[cfg(feature = "ssr")]
|
#[cfg(feature = "ssr")]
|
||||||
pub fn get_song_data(album_id: i32, user_like_dislike: Option<User>, conn: &mut PgPooledConn) -> Result<Vec<SongData>, Box<dyn Error>> {
|
pub fn get_song_data(album_id: i32, user_like_dislike: Option<User>, conn: &mut PgPooledConn) -> Result<Vec<SongData>, Box<dyn Error>> {
|
||||||
use crate::schema::*;
|
use crate::schema::*;
|
||||||
use crate::database::get_db_conn;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
let song_list = if let Some(user_like_dislike) = user_like_dislike {
|
let song_list = if let Some(user_like_dislike) = user_like_dislike {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use leptos::leptos_dom::*;
|
use leptos::leptos_dom::*;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_router::*;
|
use leptos_router::*;
|
||||||
use crate::{albumdata, models::*};
|
|
||||||
use crate::components::song_list::*;
|
use crate::components::song_list::*;
|
||||||
use crate::api::album::*;
|
use crate::api::album::*;
|
||||||
use crate::components::album_info::*;
|
use crate::components::album_info::*;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user