pinakes-server: update remaining route imports and handlers

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I67206fd813d514f8903041eea0a4cd266a6a6964
This commit is contained in:
raf 2026-03-08 00:42:20 +03:00
commit eb6c0a3577
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
20 changed files with 169 additions and 87 deletions

View file

@ -5,7 +5,19 @@ use axum::{
use pinakes_core::{model::MediaId, playlists::Playlist, users::UserId};
use uuid::Uuid;
use crate::{auth::resolve_user_id, dto::*, error::ApiError, state::AppState};
use crate::{
auth::resolve_user_id,
dto::{
CreatePlaylistRequest,
MediaResponse,
PlaylistItemRequest,
PlaylistResponse,
ReorderPlaylistRequest,
UpdatePlaylistRequest,
},
error::ApiError,
state::AppState,
};
/// Check whether a user has access to a playlist.
///
@ -138,12 +150,11 @@ pub async fn add_item(
) -> Result<Json<serde_json::Value>, ApiError> {
let user_id = resolve_user_id(&state.storage, &username).await?;
check_playlist_access(&state.storage, id, user_id, true).await?;
let position = match req.position {
Some(p) => p,
None => {
let items = state.storage.get_playlist_items(id).await?;
items.len() as i32
},
let position = if let Some(p) = req.position {
p
} else {
let items = state.storage.get_playlist_items(id).await?;
items.len() as i32
};
state
.storage