Ensure track is specified if album is specified
This commit is contained in:
parent
3934a25900
commit
b4054aa2b7
@ -239,6 +239,11 @@ pub async fn upload(data: MultipartData) -> Result<(), ServerFnError> {
|
|||||||
let track = track.unwrap_or(None);
|
let track = track.unwrap_or(None);
|
||||||
let release_date = release_date.unwrap_or(None);
|
let release_date = release_date.unwrap_or(None);
|
||||||
|
|
||||||
|
if album_id.is_some() != track.is_some() {
|
||||||
|
return Err(ServerFnError::<NoCustomError>
|
||||||
|
::ServerError("Album id and track number must both be present or both be absent".to_string()));
|
||||||
|
}
|
||||||
|
|
||||||
// Create the song
|
// Create the song
|
||||||
use crate::models::Song;
|
use crate::models::Song;
|
||||||
let song = Song {
|
let song = Song {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user