Documentation
¶
Index ¶
- type AddArtistIdentifierRequest
- type AddSongToPlaylistRequest
- type Album
- type AlbumHasCoverResponse
- type Artist
- type ArtistIdentifier
- type AssignAlbumCoverByPathRequest
- type AssignAlbumCoverResponse
- type AssignFileByPathRequest
- type AssignFileToSongRequest
- type AssignFileToSongResponse
- type BatchIDRequest
- type CategoriesResponse
- type CompleteSetupRequest
- type CreateAlbumRequest
- type CreateArtistRequest
- type CreatePlaylistFolderRequest
- type CreatePlaylistRequest
- type CreatePlaylistWithContentsRequest
- type CreateRequestMailRequest
- type CreateSongRequest
- type EntityIDs
- type ErrorResponse
- type FolderResponse
- type GetSongsResponse
- type Handler
- func (h *Handler) AddArtistIdentifier(c echo.Context) error
- func (h *Handler) AddSongToPlaylist(c *middleware.CustomContext) error
- func (h *Handler) AlbumHasCover(c echo.Context) error
- func (h *Handler) AssignAlbumCover(c echo.Context) error
- func (h *Handler) AssignAlbumCoverByPath(c echo.Context) error
- func (h *Handler) AssignFileToSong(c echo.Context) error
- func (h *Handler) AssignFileToSongByPath(c echo.Context) error
- func (h *Handler) BandwidthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func (h *Handler) ChangePassword(c echo.Context) error
- func (h *Handler) CleanSongFiles(c echo.Context) error
- func (h *Handler) CompleteSetup(c echo.Context) error
- func (h *Handler) CreateAlbum(c echo.Context) error
- func (h *Handler) CreateArtist(c echo.Context) error
- func (h *Handler) CreatePlaylist(c *middleware.CustomContext) error
- func (h *Handler) CreatePlaylistFolder(c *middleware.CustomContext) error
- func (h *Handler) CreatePlaylistWithContents(c *middleware.CustomContext) error
- func (h *Handler) CreateRequestMail(c echo.Context) error
- func (h *Handler) CreateSong(c echo.Context) error
- func (h *Handler) CreateUser(c echo.Context) error
- func (h *Handler) DeleteAlbum(c echo.Context) error
- func (h *Handler) DeleteArtist(c echo.Context) error
- func (h *Handler) DeletePlaylist(c *middleware.CustomContext) error
- func (h *Handler) DeletePlaylistByID(c echo.Context) error
- func (h *Handler) DeletePlaylistFolder(c *middleware.CustomContext) error
- func (h *Handler) DeleteSong(c echo.Context) error
- func (h *Handler) DeleteSongFile(c echo.Context) error
- func (h *Handler) DeleteUser(c *middleware.CustomContext) error
- func (h *Handler) DownloadFile(c *middleware.CustomContext) error
- func (h *Handler) GetAlbum(c echo.Context) error
- func (h *Handler) GetAlbumSongs(c echo.Context) error
- func (h *Handler) GetAlbums(c echo.Context) error
- func (h *Handler) GetAlbumsBatch(c echo.Context) error
- func (h *Handler) GetArtist(c echo.Context) error
- func (h *Handler) GetArtists(c echo.Context) error
- func (h *Handler) GetArtistsBatch(c echo.Context) error
- func (h *Handler) GetBandwidth(c echo.Context) error
- func (h *Handler) GetCategories(c echo.Context) error
- func (h *Handler) GetFoldersBatch(c *middleware.CustomContext) error
- func (h *Handler) GetLibrary(c *middleware.CustomContext) error
- func (h *Handler) GetMe(c echo.Context) error
- func (h *Handler) GetNextRequestMail(c echo.Context) error
- func (h *Handler) GetPlaylist(c *middleware.CustomContext) error
- func (h *Handler) GetPlaylistByID(c echo.Context) error
- func (h *Handler) GetPlaylists(c echo.Context) error
- func (h *Handler) GetPlaylistsBatch(c *middleware.CustomContext) error
- func (h *Handler) GetRequestMails(c echo.Context) error
- func (h *Handler) GetServerInfo(c echo.Context) error
- func (h *Handler) GetServerLogs(c echo.Context) error
- func (h *Handler) GetSettings(c echo.Context) error
- func (h *Handler) GetSong(c echo.Context) error
- func (h *Handler) GetSongFiles(c echo.Context) error
- func (h *Handler) GetSongs(c echo.Context) error
- func (h *Handler) GetSongsBatch(c echo.Context) error
- func (h *Handler) GetStats(c echo.Context) error
- func (h *Handler) GetSync(c *middleware.CustomContext) error
- func (h *Handler) GetUserPlaylists(c *middleware.CustomContext) error
- func (h *Handler) GetUsers(c echo.Context) error
- func (h *Handler) HealthCheckHandler(c echo.Context) error
- func (h *Handler) LoginUser(c echo.Context) error
- func (h *Handler) MoveFolderToFolder(c *middleware.CustomContext) error
- func (h *Handler) MovePlaylistToFolder(c *middleware.CustomContext) error
- func (h *Handler) RebalanceAllPlaylists(c *middleware.CustomContext) error
- func (h *Handler) Register(public *echo.Group)
- func (h *Handler) ReindexSearch(c echo.Context) error
- func (h *Handler) RemoveOrphans(c echo.Context) error
- func (h *Handler) RemoveSongFromPlaylist(c *middleware.CustomContext) error
- func (h *Handler) RenamePlaylist(c *middleware.CustomContext) error
- func (h *Handler) RenamePlaylistFolder(c *middleware.CustomContext) error
- func (h *Handler) RunDoctor(c echo.Context) error
- func (h *Handler) SearchItems(c echo.Context) error
- func (h *Handler) ServeAlbumCover(c echo.Context) error
- func (h *Handler) SetMailStatus(c echo.Context) error
- func (h *Handler) SetupStatus(c echo.Context) error
- func (h *Handler) UpdateAlbum(c echo.Context) error
- func (h *Handler) UpdateArtist(c echo.Context) error
- func (h *Handler) UpdatePlaylistByID(c echo.Context) error
- func (h *Handler) UpdatePlaylistSongOrder(c *middleware.CustomContext) error
- func (h *Handler) UpdateSettings(c echo.Context) error
- func (h *Handler) UpdateSong(c echo.Context) error
- type HealthResponse
- type LibraryResponse
- type LoginRequest
- type LoginResponse
- type MessageResponse
- type MoveFolderRequest
- type MovePlaylistRequest
- type Playlist
- type PlaylistFolder
- type PlaylistResponse
- type PlaylistSongResponse
- type RenameFolderRequest
- type RenamePlaylistRequest
- type RequestMail
- type ServerInfoResponse
- type SetMailStatusRequest
- type SignupRequest
- type SignupResponse
- type Song
- type SongFile
- type StatsResponse
- type StatusResponse
- type StorageStats
- type SyncManifest
- type UpdateAlbumRequest
- type UpdateArtistRequest
- type UpdateSongRequest
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Album ¶
type Album struct {
ID uuid.UUID `json:"id"`
Title string `json:"title"`
ReleaseDate time.Time `json:"release_date"`
ArtistName string `json:"artist_name"` // Computed
Songs []Song `json:"songs"`
CreatedAt time.Time `json:"created_at"`
}
func FromAlbumModel ¶
type AlbumHasCoverResponse ¶
type AlbumHasCoverResponse struct {
HasCover bool `json:"has_cover" example:"true"`
}
type Artist ¶
type Artist struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
Albums []Album `json:"albums"`
Identifiers []ArtistIdentifier `json:"identifiers"`
CreatedAt time.Time `json:"created_at"`
}
func FromArtistModel ¶
type ArtistIdentifier ¶
type AssignAlbumCoverResponse ¶
type AssignAlbumCoverResponse struct {
Status string `json:"status" example:"Cover assigned to album successfully"`
}
type AssignFileByPathRequest ¶
type AssignFileToSongRequest ¶
type BatchIDRequest ¶
type CategoriesResponse ¶
type CategoriesResponse struct {
Categories []string `json:"categories" example:"general,rock"`
}
type CompleteSetupRequest ¶
type CompleteSetupRequest struct {
Username string `json:"username" validate:"required"`
Password string `json:"password" validate:"required"`
ServerURL string `json:"server_url" validate:"required,url"`
MailCategories string `json:"mail_categories"` // comma separated
RequestMailAnnouncement string `json:"request_mail_announcement"`
}
type CreateAlbumRequest ¶
type CreateArtistRequest ¶
type CreatePlaylistFolderRequest ¶
type CreatePlaylistFolderRequest struct {
ID uuid.UUID `json:"id" validate:"required" example:"00000000-0000-0000-0000-000000000000"`
Name string `json:"name" validate:"required" example:"Favourites"`
ParentID uuid.UUID `json:"parent_folder_id" validate:"required" example:"00000000-0000-0000-0000-000000000000"`
}
type CreatePlaylistRequest ¶
type CreatePlaylistRequest struct {
ID uuid.UUID `json:"id" validate:"required" example:"00000000-0000-0000-0000-000000000000"`
Name string `json:"name" validate:"required" example:"My Playlist"`
ParentFolder uuid.UUID `json:"parent_folder_id" validate:"required" example:"00000000-0000-0000-0000-000000000000"`
SongIDs []uuid.UUID `json:"song_ids" example:"[\"00000000-0000-0000-0000-000000000000\"]"`
}
type CreateSongRequest ¶
type CreateSongRequest struct {
Title string `json:"title" validate:"required,max=255" example:"Song Title"`
Artists []service.SongCreationArtist `json:"artists" validate:"required,min=1"`
AlbumTitle string `json:"album_title" example:"Abbey Road"`
AlbumID uuid.UUID `json:"album_id" example:"00000000-0000-0000-0000-000000000000"`
}
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error" example:"Validation failed"`
}
type FolderResponse ¶
type GetSongsResponse ¶
type GetSongsResponse struct {
Songs []Song `json:"songs"`
}
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func GigaHandler ¶
func NewHandler ¶
func NewHandler( version string, db *gorm.DB, song_svc *service.SongService, mail_svc *service.MailService, artist_svc *service.ArtistService, album_svc *service.AlbumService, user_svc *service.UserService, playlist_svc *service.PlaylistService, search_svc *service.SearchService, stats_svc *service.StatsService, settings_svc *store.SettingsStore, ) *Handler
func (*Handler) AddArtistIdentifier ¶
AddArtistIdentifier godoc @Summary Add artist identifier @Description Adds an identifier to an existing artist. Requires an admin JWT. @Tags artists @Security BearerAuth @Accept json @Produce json @Param request body AddArtistIdentifierRequest true "Identifier payload" @Success 200 {object} StatusResponse @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /artists/identifiers [post]
func (*Handler) AddSongToPlaylist ¶
func (h *Handler) AddSongToPlaylist(c *middleware.CustomContext) error
AddSongToPlaylist godoc @Summary Add song to playlist @Description Adds a song to a playlist. @Tags playlists @Security BearerAuth @Accept json @Produce json @Param playlist_id path string true "Playlist ID (UUID)" @Param request body AddSongToPlaylistRequest true "Song payload" @Success 200 {object} LibraryResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /playlists/{playlist_id}/songs [post]
func (*Handler) AlbumHasCover ¶
AlbumHasCover godoc @Summary Check if album cover exists @Description Returns whether a JPG cover exists for the album. @Tags albums @Produce json @Param id path string true "Album ID (UUID)" @Success 200 {object} AlbumHasCoverResponse @Failure 400 {object} ErrorResponse @Router /albums/covers/{id} [get]
func (*Handler) AssignAlbumCover ¶
AssignAlbumCover godoc @Summary Upload album cover @Description Uploads a JPG album cover for the album. Requires an admin JWT. @Tags albums @Security BearerAuth @Accept multipart/form-data @Produce json @Param id path string true "Album ID (UUID)" @Param cover formData file true "JPG cover image" @Success 200 {object} AssignAlbumCoverResponse @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /albums/covers/{id} [post]
func (*Handler) AssignAlbumCoverByPath ¶
AssignAlbumCoverByPath godoc @Summary Assign album cover by path @Description Moves an album cover file from a shared volume path and associates it to an existing album. Requires an admin JWT. @Tags albums @Security BearerAuth @Accept json @Produce json @Param request body AssignAlbumCoverByPathRequest true "Request body" @Success 200 {object} AssignAlbumCoverResponse @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /albums/covers-by-path [post]
func (*Handler) AssignFileToSong ¶
AssignFileToSong godoc @Summary Assign audio file to song @Description Uploads an audio file and associates it to an existing song. Requires an admin JWT. @Tags songs @Security BearerAuth @Accept multipart/form-data @Produce json @Param song_id formData string true "Song ID (UUID)" @Param file formData file true "Audio file" @Success 200 {object} AssignFileToSongResponse @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /songs/assign-file [post]
func (*Handler) AssignFileToSongByPath ¶
AssignFileToSongByPath godoc @Summary Assign audio file to song by path @Description Moves an audio file from a shared volume path and associates it to an existing song. Requires an admin JWT. @Tags songs @Security BearerAuth @Accept json @Produce json @Param request body AssignFileByPathRequest true "Request body" @Success 200 {object} AssignFileToSongResponse @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /songs/assign-file-by-path [post]
func (*Handler) BandwidthMiddleware ¶
func (h *Handler) BandwidthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
func (*Handler) ChangePassword ¶
ChangePassword godoc @Summary Change password @Description Updates the authenticated user's password. @Tags users @Security BearerAuth @Accept json @Produce json @Param user_id path string true "User ID (UUID)" @Param request body object true "New password" @Success 200 {string} string "Success" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/{user_id}/password [put]
func (*Handler) CleanSongFiles ¶
CleanSongFiles godoc @Summary Remove invalid song files @Description Removes SongFile records where the physical file is missing from storage. Requires an admin JWT. @Tags admin @Security BearerAuth @Success 200 {object} map[string]int64 @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Router /admin/files/cleanup [delete]
func (*Handler) CompleteSetup ¶
CompleteSetup godoc @Summary Complete initial setup @Description Sets up the admin user and initial configuration. available only if not setup. @Tags setup @Accept json @Produce json @Param request body CompleteSetupRequest true "Setup payload" @Success 200 {string} string "Success" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Router /setup/complete [post]
func (*Handler) CreateAlbum ¶
CreateAlbum godoc @Summary Create album @Description Creates a new album. Requires an admin JWT. @Tags albums @Security BearerAuth @Accept json @Produce json @Param request body CreateAlbumRequest true "Album metadata" @Success 201 {object} Album @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /albums [post]
func (*Handler) CreateArtist ¶
CreateArtist godoc @Summary Create artist @Description Creates an artist with one or more aliases. Requires an admin JWT. @Tags artists @Security BearerAuth @Accept json @Produce json @Param request body CreateArtistRequest true "Artist payload" @Success 201 {object} Artist @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /artists [post]
func (*Handler) CreatePlaylist ¶
func (h *Handler) CreatePlaylist(c *middleware.CustomContext) error
CreatePlaylist godoc @Summary Create playlist @Description Creates a playlist under the given folder for the given user. Requires that the JWT subject matches user_id or that the token has admin privileges. @Tags playlists @Security BearerAuth @Accept json @Produce json @Param request body CreatePlaylistRequest true "Playlist payload" @Success 201 {object} Playlist @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 409 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /playlists [post]
func (*Handler) CreatePlaylistFolder ¶
func (h *Handler) CreatePlaylistFolder(c *middleware.CustomContext) error
CreatePlaylistFolder godoc @Summary Create folder @Description Creates a playlist folder. Requires that the JWT subject matches user_id or that the token has admin privileges. @Tags folders @Security BearerAuth @Accept json @Produce json @Param user_id path string true "User ID (UUID)" @Param request body CreatePlaylistFolderRequest true "Folder payload" @Success 201 {object} PlaylistFolder @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/{user_id}/folders [post]
func (*Handler) CreatePlaylistWithContents ¶
func (h *Handler) CreatePlaylistWithContents(c *middleware.CustomContext) error
CreatePlaylistWithContents godoc @Summary Create playlist with contents @Description Creates a new playlist for the given user in their root folder with the given songs. Requires admin privileges. @Tags admin @Security BearerAuth @Accept json @Produce json @Param request body CreatePlaylistWithContentsRequest true "Create playlist with contents payload" @Success 201 {object} Playlist @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /admin/fulfill-request [post]
func (*Handler) CreateRequestMail ¶
CreateRequestMail godoc @Summary Create request mail @Description Creates a new music request mail entry. Requires authentication. @Tags mails @Security BearerAuth @Accept json @Produce json @Param request body CreateRequestMailRequest true "Request mail payload" @Success 201 {object} RequestMail @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /mails [post]
func (*Handler) CreateSong ¶
@Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /songs [post]
func (*Handler) CreateUser ¶
CreateUser godoc @Summary Sign up @Description Creates a new user and initializes their root playlist folder. @Tags users @Accept json @Produce json @Param request body SignupRequest true "Signup payload" @Success 201 {string} string "Success" @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/signup [post]
func (*Handler) DeleteAlbum ¶
DeleteAlbum godoc @Summary Delete album @Description Deletes an album by ID. Requires an admin JWT. @Tags albums @Security BearerAuth @Param id path string true "Album ID (UUID)" @Success 204 {string} string "No Content" @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /albums/{id} [delete]
func (*Handler) DeleteArtist ¶
DeleteArtist godoc @Summary Delete artist @Description Deletes an artist by ID. Requires an admin JWT. @Tags artists @Security BearerAuth @Param id path string true "Artist ID (UUID)" @Success 204 {string} string "No Content" @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /artists/{id} [delete]
func (*Handler) DeletePlaylist ¶
func (h *Handler) DeletePlaylist(c *middleware.CustomContext) error
DeletePlaylist godoc (DEPRECATED: Use DeletePlaylistByID)
func (*Handler) DeletePlaylistByID ¶
DeletePlaylist (Global) godoc @Summary Delete playlist (Global) @Description Deletes a playlist by ID. Requires admin JWT or ownership. @Tags playlists @Security BearerAuth @Param id path string true "Playlist ID (UUID)" @Success 204 {string} string "No Content" @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /playlists/{id} [delete]
func (*Handler) DeletePlaylistFolder ¶
func (h *Handler) DeletePlaylistFolder(c *middleware.CustomContext) error
DeletePlaylistFolder godoc @Summary Delete folder @Description Deletes a playlist folder. Admin tokens can delete any folder; non-admin tokens are restricted to their own. @Tags folders @Security BearerAuth @Param user_id path string true "User ID (UUID)" @Param folder_id path string true "Folder ID (UUID)" @Success 204 {string} string "No Content" @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/{user_id}/folders/{folder_id} [delete]
func (*Handler) DeleteSong ¶
DeleteSong godoc @Summary Delete song @Description Deletes a song by ID. Requires an admin JWT. @Tags songs @Security BearerAuth @Param id path string true "Song ID (UUID)" @Success 204 {string} string "No Content" @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /songs/{id} [delete]
func (*Handler) DeleteSongFile ¶
DeleteSongFile godoc @Summary Delete song file @Description Deletes a song file by ID. Requires an admin JWT. @Tags songs @Security BearerAuth @Param id path string true "File ID (UUID)" @Success 204 {string} string "No Content" @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /songs/files/{id} [delete]
func (*Handler) DeleteUser ¶
func (h *Handler) DeleteUser(c *middleware.CustomContext) error
DeleteUser godoc @Summary Delete user @Description Deletes a user by ID. Users can delete their own account, or admins can delete any user. @Tags users @Security BearerAuth @Param user_id path string true "User ID (UUID)" @Success 204 {string} string "No Content" @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/{user_id} [delete]
func (*Handler) DownloadFile ¶
func (h *Handler) DownloadFile(c *middleware.CustomContext) error
DownloadFile godoc @Summary Download song file @Description Downloads a stored song file by its file ID. @Tags songs @Produce application/octet-stream @Param file_id path string true "File ID (UUID)" @Success 200 {file} file @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /songs/download/{file_id} [get]
func (*Handler) GetAlbum ¶
GetAlbum godoc @Summary Get album @Description Returns an album by ID. @Tags albums @Produce json @Param id path string true "Album ID (UUID)" @Success 200 {object} Album @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /albums/{id} [get]
func (*Handler) GetAlbumSongs ¶
GetAlbumSongs godoc @Summary List songs in album @Description Returns all songs in an album. @Tags albums @Produce json @Param id path string true "Album ID (UUID)" @Success 200 {object} GetSongsResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /albums/{id}/songs [get]
func (*Handler) GetAlbums ¶
GetAlbums godoc @Summary List albums paginated @Description Returns paginated list of albums. @Tags albums @Produce json @Param page query int false "Page number" @Param limit query int false "Items per page" @Success 200 {object} map[string]any @Failure 500 {object} ErrorResponse @Router /admin/albums [get]
func (*Handler) GetAlbumsBatch ¶
GetAlbumsBatch godoc @Summary Batch get albums @Description Returns a list of albums by IDs. @Tags albums @Accept json @Produce json @Param request body BatchIDRequest true "Album IDs" @Success 200 {array} Album @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /albums/batch [post]
func (*Handler) GetArtist ¶
GetArtist godoc @Summary Get artist @Description Returns an artist by ID. @Tags artists @Produce json @Param id path string true "Artist ID (UUID)" @Success 200 {object} Artist @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /artists/{id} [get]
func (*Handler) GetArtists ¶
GetArtists godoc @Summary List artists paginated @Description Returns paginated list of artists. @Tags artists @Produce json @Param page query int false "Page number" @Param limit query int false "Items per page" @Success 200 {object} map[string]any @Failure 500 {object} ErrorResponse @Router /artists [get]
func (*Handler) GetArtistsBatch ¶
GetArtistsBatch godoc @Summary Batch get artists @Description Returns a list of artists by IDs. @Tags artists @Accept json @Produce json @Param request body BatchIDRequest true "Artist IDs" @Success 200 {array} Artist @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /artists/batch [post]
func (*Handler) GetCategories ¶
GetCategories godoc @Summary List request mail categories @Description Returns configured request mail categories. @Tags mails @Produce json @Success 200 {object} CategoriesResponse @Router /mails/categories [get]
func (*Handler) GetFoldersBatch ¶
func (h *Handler) GetFoldersBatch(c *middleware.CustomContext) error
GetFoldersBatch godoc @Summary Batch get folders @Description Returns a list of folders by IDs. @Tags folders @Security BearerAuth @Accept json @Produce json @Param user_id path string true "User ID (UUID)" @Param request body BatchIDRequest true "Folder IDs" @Success 200 {array} FolderResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/{user_id}/folders/batch [post]
func (*Handler) GetLibrary ¶
func (h *Handler) GetLibrary(c *middleware.CustomContext) error
GetLibrary godoc @Summary Get library contents @Description Returns the user's library contents (folders and playlists). @Tags library @Security BearerAuth @Produce json @Param user_id path string true "User ID (UUID)" @Success 200 {object} LibraryResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/{user_id}/library [get]
func (*Handler) GetMe ¶
GetMe godoc @Summary Get current user @Description Returns the authenticated user's profile. @Tags users @Security BearerAuth @Produce json @Success 200 {object} User @Failure 401 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/me [get]
func (*Handler) GetNextRequestMail ¶
GetNextRequestMail godoc @Summary Get next pending request mail @Description Returns the next pending request mail (if any). Requires an admin JWT. @Tags mails @Security BearerAuth @Produce json @Success 200 {object} RequestMail @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /mails/next [get]
func (*Handler) GetPlaylist ¶
func (h *Handler) GetPlaylist(c *middleware.CustomContext) error
GetPlaylist godoc @Summary Get playlist @Description Returns a playlist with songs, song files, album and artist preloaded. @Tags playlists @Security BearerAuth @Produce json @Param user_id path string true "User ID (UUID)" @Param playlist_id path string true "Playlist ID (UUID)" @Success 200 {object} Playlist @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/{user_id}/playlists/{playlist_id} [get]
func (*Handler) GetPlaylistByID ¶
GetPlaylist (Global) godoc @Summary Get playlist (Global) @Description Returns a playlist by ID. Requires admin JWT or ownership. @Tags playlists @Security BearerAuth @Produce json @Param id path string true "Playlist ID (UUID)" @Success 200 {object} Playlist @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /playlists/{id} [get]
func (*Handler) GetPlaylists ¶
GetPlaylists godoc @Summary List playlists paginated @Description Returns paginated list of playlists. @Tags playlists @Produce json @Param page query int false "Page number" @Param limit query int false "Items per page" @Success 200 {object} map[string]any @Failure 500 {object} ErrorResponse @Router /playlists [get]
func (*Handler) GetPlaylistsBatch ¶
func (h *Handler) GetPlaylistsBatch(c *middleware.CustomContext) error
GetPlaylistsBatch godoc @Summary Batch get playlists @Description Returns a list of playlists by IDs. @Tags playlists @Security BearerAuth @Accept json @Produce json @Param user_id path string true "User ID (UUID)" @Param request body BatchIDRequest true "Playlist IDs" @Success 200 {array} Playlist @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/{user_id}/playlists/batch [post]
func (*Handler) GetRequestMails ¶
GetRequestMails godoc @Summary List request mails @Description Returns all request mails. Requires an admin JWT. @Tags mails @Security BearerAuth @Produce json @Success 200 {array} RequestMail @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Router /mails [get]
func (*Handler) GetServerInfo ¶
GetServerInfo godoc @Summary Get server info @Description Returns server version and request-mail related configuration. @Tags info @Produce json @Success 200 {object} ServerInfoResponse @Router /info [get]
func (*Handler) GetServerLogs ¶
GetServerLogs godoc @Summary Get server logs @Description Returns the last 100 lines of the server log file. @Tags admin @Security BearerAuth @Produce json @Success 200 {array} string @Failure 500 {object} ErrorResponse @Router /admin/logs [get]
func (*Handler) GetSettings ¶
GetSettings godoc @Summary Get system settings @Description Returns all system settings. Requires admin JWT. @Tags admin @Security BearerAuth @Produce json @Success 200 {object} map[string]string @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /admin/settings [get]
func (*Handler) GetSong ¶
GetSong godoc @Summary Get song @Description Returns a song by ID. @Tags songs @Produce json @Param id path string true "Song ID (UUID)" @Success 200 {object} Song @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /songs/{id} [get]
func (*Handler) GetSongFiles ¶
GetSongFiles godoc @Summary List files for a song @Description Returns all files associated with a song. @Tags songs @Produce json @Param id path string true "Song ID (UUID)" @Success 200 {array} model.SongFile @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /songs/{id}/files [get]
func (*Handler) GetSongs ¶
GetSongs godoc @Summary List songs @Description Returns the 50 latest songs, or paginated list if page/limit params are provided. @Tags songs @Produce json @Param page query int false "Page number" @Param limit query int false "Items per page" @Success 200 {object} GetSongsResponse @Failure 500 {object} ErrorResponse @Router /songs [get]
func (*Handler) GetSongsBatch ¶
GetSongsBatch godoc @Summary Batch get songs @Description Returns a list of songs by IDs. @Tags songs @Accept json @Produce json @Param request body BatchIDRequest true "Song IDs" @Success 200 {array} Song @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /songs/batch [post]
func (*Handler) GetSync ¶
func (h *Handler) GetSync(c *middleware.CustomContext) error
GetSync godoc @Summary Sync changes @Description Returns a manifest of changed and removed entities since the given timestamp. @Tags users @Security BearerAuth @Produce json @Param since query string false "Since timestamp (RFC3339)" @Success 200 {object} SyncManifest @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/me/sync [get]
func (*Handler) GetUserPlaylists ¶
func (h *Handler) GetUserPlaylists(c *middleware.CustomContext) error
GetUserPlaylists godoc @Summary List user playlists @Description Lists playlists owned by the given user. @Tags playlists @Security BearerAuth @Produce json @Param user_id path string true "User ID (UUID)" @Success 200 {array} Playlist @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/{user_id}/playlists [get]
func (*Handler) GetUsers ¶
GetUsers godoc @Summary List users @Description Returns a list of users with pagination. @Tags admin @Security BearerAuth @Produce json @Param page query int false "Page number" @Param limit query int false "Items per page" @Success 200 {array} User @Failure 500 {object} ErrorResponse @Router /admin/users [get]
func (*Handler) HealthCheckHandler ¶
HealthCheckHandler godoc @Summary Health check @Description Basic liveness endpoint. @Tags info @Produce plain @Success 200 {string} string "Service is running" @Router /info/health [get]
func (*Handler) LoginUser ¶
LoginUser godoc @Summary Login @Description Validates credentials and returns a JWT Bearer token and user object @Tags users @Accept json @Produce json @Param request body LoginRequest true "Login payload" @Success 200 {object} LoginResponse @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/login [post]
func (*Handler) MoveFolderToFolder ¶
func (h *Handler) MoveFolderToFolder(c *middleware.CustomContext) error
MoveFolderToFolder godoc @Summary Move folder to another folder @Description Moves a folder to a different parent folder and returns the updated library. Requires that the JWT subject matches user_id or that the token has admin privileges. @Tags folders @Security BearerAuth @Accept json @Produce json @Param user_id path string true "User ID (UUID)" @Param folder_id path string true "Folder ID (UUID)" @Param request body MoveFolderRequest true "Move payload" @Success 200 {object} LibraryResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/{user_id}/folders/{folder_id}/move [put]
func (*Handler) MovePlaylistToFolder ¶
func (h *Handler) MovePlaylistToFolder(c *middleware.CustomContext) error
MovePlaylistToFolder godoc @Summary Move playlist to folder @Description Moves a playlist to a different folder. @Tags playlists @Security BearerAuth @Accept json @Produce json @Param playlist_id path string true "Playlist ID (UUID)" @Param request body MovePlaylistRequest true "Move payload" @Success 200 {object} LibraryResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /playlists/{playlist_id}/move [put]
func (*Handler) RebalanceAllPlaylists ¶
func (h *Handler) RebalanceAllPlaylists(c *middleware.CustomContext) error
RebalanceAllPlaylists godoc @Summary Rebalance all playlists @Description Rebalances the song order keys for all playlists in the system using the new Base62 alphabet. Requires admin privileges. @Tags admin @Security BearerAuth @Produce json @Success 200 {string} string "OK" @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /admin/rebalance-playlists [post]
func (*Handler) ReindexSearch ¶
ReindexSearch godoc @Summary Re-index search database @Description Deletes all documents in Meilisearch and re-indexes them from the database. Requires an admin JWT. @Tags admin @Security BearerAuth @Success 200 {string} string "OK" @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Router /search/reindex [post]
func (*Handler) RemoveOrphans ¶
RemoveOrphans godoc @Summary Remove orphan entities @Description Removes orphan songs, albums, artists, broken links, and related metadata (identifiers, files). Requires an admin JWT. @Tags admin @Security BearerAuth @Success 200 {object} map[string]int64 @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Router /admin/orphans [delete]
func (*Handler) RemoveSongFromPlaylist ¶
func (h *Handler) RemoveSongFromPlaylist(c *middleware.CustomContext) error
RemoveSongFromPlaylist godoc @Summary Remove song from playlist @Description Removes a song from a playlist. @Tags playlists @Security BearerAuth @Produce json @Param playlist_id path string true "Playlist ID (UUID)" @Param song_id path string true "Song ID (UUID)" @Success 200 {object} LibraryResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /playlists/{playlist_id}/songs/{song_id} [delete]
func (*Handler) RenamePlaylist ¶
func (h *Handler) RenamePlaylist(c *middleware.CustomContext) error
RenamePlaylist godoc (DEPRECATED: Use UpdatePlaylistByID)
func (*Handler) RenamePlaylistFolder ¶
func (h *Handler) RenamePlaylistFolder(c *middleware.CustomContext) error
RenamePlaylistFolder godoc @Summary Rename folder @Description Renames a playlist folder and returns the updated library. Requires that the JWT subject matches user_id or that the token has admin privileges. @Tags folders @Security BearerAuth @Accept json @Produce json @Param user_id path string true "User ID (UUID)" @Param folder_id path string true "Folder ID (UUID)" @Param request body RenameFolderRequest true "Rename payload" @Success 200 {object} LibraryResponse @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /users/{user_id}/folders/{folder_id}/rename [put]
func (*Handler) RunDoctor ¶
RunDoctor godoc @Summary Run maintenance tasks @Description Runs server-side maintenance (ensures song file durations). Requires an admin JWT. @Tags admin @Security BearerAuth @Success 200 {string} string "OK" @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Router /doctor [post]
func (*Handler) SearchItems ¶
SearchItems godoc @Summary Global search @Description Searches for songs, artists, and playlists using Meilisearch. @Tags search @Produce json @Param q query string true "Search query" @Param limit query int false "Results limit" @Success 200 {array} service.SearchResult @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /search [get]
func (*Handler) ServeAlbumCover ¶
ServeAlbumCover godoc @Summary Serve album cover image @Description Serves a JPG album cover. The `res` parameter selects low or high quality. @Tags images @Produce image/jpeg @Param id path string true "Album ID (UUID)" @Param res path string true "Resolution (lq|hq)" Enums(lq,hq) @Success 200 {file} file @Failure 400 {string} string "Invalid parameters" @Router /images/covers/{id}/{res} [get]
func (*Handler) SetMailStatus ¶
SetMailStatus godoc @Summary Set request mail status @Description Updates the status of a request mail. Requires an admin JWT. Status values: 0=pending, 1=processing, 2=completed, 3=rejected. @Tags mails @Security BearerAuth @Accept json @Produce json @Param id path int true "Mail ID" @Param request body SetMailStatusRequest true "Status payload" @Success 200 {object} MessageResponse @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /mails/{id}/status [put]
func (*Handler) SetupStatus ¶
SetupStatus godoc @Summary Check setup status @Description Returns whether the server setup has been completed. @Tags setup @Produce json @Success 200 {object} map[string]bool @Router /setup/status [get]
func (*Handler) UpdateAlbum ¶
UpdateAlbum godoc @Summary Update album @Description Updates album metadata. Requires an admin JWT. @Tags albums @Security BearerAuth @Accept json @Produce json @Param id path string true "Album ID (UUID)" @Param request body UpdateAlbumRequest true "Album metadata" @Success 200 {object} Album @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /albums/{id} [put]
func (*Handler) UpdateArtist ¶
UpdateArtist godoc @Summary Update artist @Description Updates artist metadata. Requires an admin JWT. @Tags artists @Security BearerAuth @Accept json @Produce json @Param id path string true "Artist ID (UUID)" @Param request body UpdateArtistRequest true "Artist metadata" @Success 200 {object} Artist @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /artists/{id} [put]
func (*Handler) UpdatePlaylistByID ¶
UpdatePlaylist (Global) godoc @Summary Update playlist (Global) @Description Renames a playlist. Requires admin JWT or ownership. @Tags playlists @Security BearerAuth @Accept json @Produce json @Param id path string true "Playlist ID (UUID)" @Param request body RenamePlaylistRequest true "Rename payload" @Success 200 {object} Playlist @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /playlists/{id} [put]
func (*Handler) UpdatePlaylistSongOrder ¶
func (h *Handler) UpdatePlaylistSongOrder(c *middleware.CustomContext) error
UpdatePlaylistSongOrder godoc @Summary Update song order in playlist @Description Updates the order of a song in a playlist. @Tags playlists @Security BearerAuth @Produce json @Param playlist_id path string true "Playlist ID (UUID)" @Param song_id path string true "Song ID (UUID)" @Param request body map[string]string true "Order payload" @Success 200 {object} nil @Failure 400 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /playlists/{playlist_id}/songs/{song_id} [put]
func (*Handler) UpdateSettings ¶
UpdateSettings godoc @Summary Update system settings @Description Updates system settings (partial update). Requires admin JWT. @Tags admin @Security BearerAuth @Accept json @Produce json @Param request body map[string]string true "Settings kv pairs" @Success 200 {object} map[string]string @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /admin/settings [put]
func (*Handler) UpdateSong ¶
UpdateSong godoc @Summary Update song @Description Updates song metadata. Requires an admin JWT. @Tags songs @Security BearerAuth @Accept json @Produce json @Param id path string true "Song ID (UUID)" @Param request body UpdateSongRequest true "Song metadata" @Success 200 {object} Song @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 403 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /songs/{id} [put]
type HealthResponse ¶
type HealthResponse string
type LibraryResponse ¶
type LibraryResponse struct {
Folders []FolderResponse `json:"folders"`
Playlists []PlaylistResponse `json:"playlists"`
}
type LoginRequest ¶
type LoginResponse ¶
type MessageResponse ¶
type MessageResponse struct {
Message string `json:"message" example:"Status updated"`
}
type MoveFolderRequest ¶
type MovePlaylistRequest ¶
type Playlist ¶
type Playlist struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
FolderID uuid.UUID `json:"folder_id"`
UserID uuid.UUID `json:"user_id"`
PlaylistSongs []PlaylistSongResponse `json:"playlist_songs"`
// Songs []Song `json:"songs"`
User *User `json:"user,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
func FromPlaylistModel ¶
type PlaylistFolder ¶
type PlaylistFolder struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
UserID uuid.UUID `json:"user_id"`
ParentID *uuid.UUID `json:"parent_id"`
Children []*PlaylistFolder `json:"children"`
Playlists []Playlist `json:"playlists"`
}
func FromPlaylistFolderModel ¶
func FromPlaylistFolderModel(m model.PlaylistFolder) PlaylistFolder
type PlaylistResponse ¶
type PlaylistSongResponse ¶
type RenameFolderRequest ¶
type RenameFolderRequest struct {
Name string `json:"name" validate:"required" example:"New Folder Name"`
}
type RenamePlaylistRequest ¶
type RenamePlaylistRequest struct {
Name string `json:"name" validate:"required" example:"New Name"`
}
type RequestMail ¶
type RequestMail struct {
ID uint `json:"id"`
Category string `json:"category"`
Message string `json:"message"`
UserID uuid.UUID `json:"user_id"`
Status int `json:"status"`
}
func FromRequestMailModel ¶
func FromRequestMailModel(m model.RequestMail) RequestMail
type ServerInfoResponse ¶
type SetMailStatusRequest ¶
type SetMailStatusRequest struct {
Status int `json:"status" validate:"required" example:"2"`
}
type SignupRequest ¶
type SignupResponse ¶
type SignupResponse string
type Song ¶
type Song struct {
ID uuid.UUID `json:"id" example:"00000000-0000-0000-0000-000000000000"`
CreatedAt time.Time `json:"created_at"`
Title string `json:"title" example:"Song Title"`
AlbumID uuid.UUID `json:"album_id"`
Album Album `json:"album"`
Artists []Artist `json:"artists"`
}
func FromSongModel ¶
type SongFile ¶
type SongFile struct {
ID uuid.UUID `json:"id"`
CreatedAt time.Time `json:"created_at"`
Format string `json:"format"`
Duration uint `json:"duration"`
}
func FromSongFileModels ¶
type StatsResponse ¶
type StatsResponse struct {
TotalSongs int64 `json:"total_songs"`
TotalAlbums int64 `json:"total_albums"`
TotalArtists int64 `json:"total_artists"`
TotalUsers int64 `json:"total_users"`
TotalPlaylists int64 `json:"total_playlists"`
Goroutines int `json:"goroutines"`
Memory string `json:"memory"`
Uptime int64 `json:"uptime"`
Cpu float64 `json:"cpu"`
Storage StorageStats `json:"storage"`
}
type StatusResponse ¶
type StatusResponse struct {
Status string `json:"status" example:"ok"`
}
type StorageStats ¶
type SyncManifest ¶
type UpdateAlbumRequest ¶
type UpdateArtistRequest ¶
type UpdateArtistRequest struct {
Name string `json:"name"`
}