album

package
v0.0.0-...-b9f6318 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAlbumBackOfficeHandler

func NewAlbumBackOfficeHandler(r *gin.RouterGroup, service AlbumService, authHandler routing.Handler, logger log.Logger)

NewAlbumBackOfficeHandler sets up the routing of the HTTP handlers.

func NewAlbumFindAll

func NewAlbumFindAll(data *[]entity.Album) *[]AlbumFindAllResponse

Types

type AlbumDetailResponse

type AlbumDetailResponse struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

func NewAlbumDetail

func NewAlbumDetail(data *entity.Album) *AlbumDetailResponse

type AlbumFindAllResponse

type AlbumFindAllResponse struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type AlbumRepository

type AlbumRepository interface {
	// FindByID returns the album with the specified album ID.
	FindByID(ctx context.Context, id uuid.UUID) (*entity.Album, error)
	// FindAll returns the list of albums with the given offset and limit.
	FindAll(ctx context.Context, req *request.FindAllAlbumRequest) (*[]entity.Album, int64, error)
	// Upsert create or update an album in the storage.
	Upsert(ctx context.Context, album *entity.Album) error
	// Delete removes the album with given ID from the storage.
	Delete(ctx context.Context, deleteData map[string]any) error
}

AlbumRepository encapsulates the logic to access albums from the data source.

func NewRepository

func NewRepository(db *gorm.DB, logger log.Logger) AlbumRepository

NewRepository creates a new album repository

type AlbumService

type AlbumService interface {
	// FindByID returns the album with the specified the album ID.
	FindByID(ctx context.Context, id uuid.UUID) (*entity.Album, error)
	// FindAll returns the albums with the specified offset, limit and sorting.
	FindAll(ctx context.Context, req *request.FindAllAlbumRequest) (*[]entity.Album, int64, error)
	// Upsert creates or update a new album.
	Upsert(ctx context.Context, req *request.UpsertAlbumRequest) (uuid.UUID, error)
	// Delete deletes the album with the specified ID.
	Delete(ctx context.Context, id uuid.UUID) error
}

AlbumService encapsulates usecase logic for albums.

func NewAlbumService

func NewAlbumService(repo AlbumRepository, logger log.Logger) AlbumService

NewAlbumService creates a new album service.

Jump to

Keyboard shortcuts

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