handlers

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertURL

func ConvertURL(c *fiber.Ctx, path string) string

func InstallAlbumHandlers added in v0.2.0

func InstallAlbumHandlers(router *fiber.App, apiConfig *ApiConfig)

func InstallArtistHandlers added in v0.2.0

func InstallArtistHandlers(router *fiber.App, apiConfig *ApiConfig)

func InstallTrackHandlers added in v0.2.0

func InstallTrackHandlers(router *fiber.App, apiConfig *ApiConfig)

Types

type ApiConfig

type ApiConfig struct {
	// contains filtered or unexported fields
}

func New

func New(db *pgxpool.Pool, queries *database.Queries, workDir string) ApiConfig

func (*ApiConfig) HandleGetAlbumById added in v0.2.0

func (api *ApiConfig) HandleGetAlbumById(c *fiber.Ctx) error

HandleGetAlbumById godoc

@Summary		Get album by id
@Description	Get album by id
@Tags			albums
@Produce		json
@Param			id	path		string	true	"Album Id"
@Success		200	{object}	types.ApiResponse[types.ApiGetAlbumByIdData]
@Failure		400	{object}	types.ApiError
@Failure		404	{object}	types.ApiError
@Failure		500	{object}	types.ApiError
@Router			/albums/{id} [get]

func (*ApiConfig) HandleGetAlbumTracksById added in v0.2.0

func (api *ApiConfig) HandleGetAlbumTracksById(c *fiber.Ctx) error

HandleGetAlbumTracksById godoc

@Summary		Get all tracks from album
@Description	Get all tracks from album
@Tags			albums
@Produce		json
@Param			id	path		string	true	"Artist Id"
@Success		200	{object}	types.ApiResponse[types.ApiGetAlbumTracksByIdData]
@Failure		400	{object}	types.ApiError
@Failure		500	{object}	types.ApiError
@Router			/albums/{id}/tracks [get]

func (*ApiConfig) HandleGetAlbums added in v0.2.0

func (api *ApiConfig) HandleGetAlbums(c *fiber.Ctx) error

HandleGetAlbums godoc

@Summary		Get all albums
@Description	Get all albums
@Tags			albums
@Produce		json
@Success		200	{object}	types.ApiResponse[types.ApiGetAlbumsData]
@Failure		400	{object}	types.ApiError
@Failure		500	{object}	types.ApiError
@Router			/albums [get]

func (*ApiConfig) HandleGetArtistAlbumsById added in v0.2.0

func (api *ApiConfig) HandleGetArtistAlbumsById(c *fiber.Ctx) error

HandleGetArtistAlbumsById godoc

@Summary		Get all albums by artist
@Description	Get all albums by artist
@Tags			artists
@Produce		json
@Param			id	path		string	true	"Artist Id"
@Success		200	{object}	types.ApiResponse[types.ApiGetArtistAlbumsByIdData]
@Failure		400	{object}	types.ApiError
@Failure		500	{object}	types.ApiError
@Router			/artists/{id}/albums [get]

func (*ApiConfig) HandleGetArtistById added in v0.2.0

func (api *ApiConfig) HandleGetArtistById(c *fiber.Ctx) error

HandleGetArtistById godoc

@Summary		Get artist by id
@Description	Get artist by id
@Tags			artists
@Produce		json
@Param			id	path		string	true	"Artist Id"
@Success		200	{object}	types.ApiResponse[types.ApiGetArtistByIdData]
@Failure		400	{object}	types.ApiError
@Failure		404	{object}	types.ApiError
@Failure		500	{object}	types.ApiError
@Router			/artists/{id} [get]

func (*ApiConfig) HandleGetArtists added in v0.2.0

func (api *ApiConfig) HandleGetArtists(c *fiber.Ctx) error

HandleGetArtists godoc

@Summary		Get all artists
@Description	Get all artists
@Tags			artists
@Produce		json
@Success		200	{object}	types.ApiResponse[types.ApiGetArtistsData]
@Failure		400	{object}	types.ApiError
@Failure		500	{object}	types.ApiError
@Router			/artists [get]

func (*ApiConfig) HandleGetTrackById added in v0.2.0

func (api *ApiConfig) HandleGetTrackById(c *fiber.Ctx) error

HandleGetTrackById godoc

@Summary		Get track by id
@Description	Get track by id
@Tags			tracks
@Produce		json
@Param			id	path		string	true	"Track Id"
@Success		200	{object}	types.ApiResponse[types.ApiGetTrackByIdData]
@Failure		400	{object}	types.ApiError
@Failure		404	{object}	types.ApiError
@Failure		500	{object}	types.ApiError
@Router			/tracks/{id} [get]

func (*ApiConfig) HandleGetTracks added in v0.2.0

func (api *ApiConfig) HandleGetTracks(c *fiber.Ctx) error

HandleGetTracks godoc

@Summary		Get all tracks
@Description	Get all tracks
@Tags			tracks
@Produce		json
@Success		200	{object}	types.ApiResponse[types.ApiGetTracksData]
@Failure		400	{object}	types.ApiError
@Failure		500	{object}	types.ApiError
@Router			/tracks [get]

func (*ApiConfig) HandlePostAlbum added in v0.2.0

func (api *ApiConfig) HandlePostAlbum(c *fiber.Ctx) error

HandlePostAlbum godoc

@Summary		Create new album
@Description	Create new album
@Tags			albums
@Accept			mpfd
@Produce		json
@Param			name		formData	string	true	"Album name"
@Param			artistId	formData	string	true	"Artist Id"
@Success		200			{object}	types.ApiResponse[types.ApiPostAlbumData]
@Failure		400			{object}	types.ApiError
@Failure		500			{object}	types.ApiError
@Router			/albums [post]

func (*ApiConfig) HandlePostArtist added in v0.2.0

func (api *ApiConfig) HandlePostArtist(c *fiber.Ctx) error

HandlePostArtist godoc

@Summary		Create new artist
@Description	Create new artist
@Tags			artists
@Accept			mpfd
@Produce		json
@Param			name	formData	string	true	"Artist name"
@Success		200		{object}	types.ApiResponse[types.ApiPostArtistData]
@Failure		400		{object}	types.ApiError
@Failure		500		{object}	types.ApiError
@Router			/artists [post]

func (*ApiConfig) HandlePostTrack added in v0.2.0

func (api *ApiConfig) HandlePostTrack(c *fiber.Ctx) error

HandlePostTrack godoc

@Summary		Create new track
@Description	Create new track
@Tags			tracks
@Accept			mpfd
@Produce		json
@Param			name				formData	string	true	"Track name"
@Param			number				formData	string	true	"Track number"
@Param			album				formData	string	true	"Album Id"
@Param			artist				formData	string	true	"Artist Id"
@Param			bestQualityFile		formData	file	true	"Best Quality File"
@Param			mobileQualityFile	formData	file	true	"Mobile Quality File"
@Param			coverArt			formData	file	true	"Cover Art"
@Success		200					{object}	types.ApiResponse[types.ApiPostTrackData]
@Failure		400					{object}	types.ApiError
@Failure		500					{object}	types.ApiError
@Router			/tracks [post]

func (*ApiConfig) HandlerCreateQueueFromAlbum

func (apiConfig *ApiConfig) HandlerCreateQueueFromAlbum(c *fiber.Ctx) error

type CreateAlbumBody

type CreateAlbumBody struct {
	Name   string `json:"name" form:"name" validate:"required"`
	Artist string `json:"artist" form:"artist" validate:"required"`
}

type CreateArtistBody

type CreateArtistBody struct {
	Name string `json:"name" form:"name" validate:"required"`
}

type CreateTrackBody

type CreateTrackBody struct {
	Name   string `json:"name" form:"name" validate:"required"`
	Number int    `json:"number" form:"number" validate:"required"`
	Album  string `json:"album" form:"album" validate:"required"`
	Artist string `json:"artist" form:"artist" validate:"required"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL