catalogviews

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2024 License: AGPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlbumSize added in v1.6.4

type AlbumSize struct {
	AlbumId    catalog.AlbumId
	Users      []Availability
	MediaCount int
}

func (AlbumSize) String added in v1.6.4

func (a AlbumSize) String() string

type AlbumSizeDiff added in v1.6.4

type AlbumSizeDiff struct {
	AlbumId        catalog.AlbumId
	Users          []Availability
	MediaCountDiff int // MediaCountDiff is the difference between the number of media added, or removed, to the album
}

type AlbumView

type AlbumView struct {
	Providers []ListAlbumsProvider
}

func NewAlbumView added in v1.5.49

func NewAlbumView(
	FindAlbumByOwnerPort FindAlbumByOwnerPort,
	GetAlbumSharingGridPort GetAlbumSharingGridPort,
	FindAlbumsByIdsPort FindAlbumsByIdsPort,
	SharedWithUserPort SharedWithUserPort,
	GetAvailabilitiesByUserPort GetAvailabilitiesByUserPort,
) *AlbumView

func (*AlbumView) ListAlbums

func (v *AlbumView) ListAlbums(ctx context.Context, user usermodel.CurrentUser, filter ListAlbumsFilter) ([]*VisibleAlbum, error)

ListAlbums returns albums visible by the user (owned by current user, and shared to him)

type Availability added in v1.6.4

type Availability struct {
	UserId  usermodel.UserId
	AsOwner bool // AsOwner is true if the user is the owner of the album
}

func OwnerAvailability added in v1.6.4

func OwnerAvailability(userId usermodel.UserId) Availability

func VisitorAvailability added in v1.6.4

func VisitorAvailability(userId usermodel.UserId) Availability

type CommandHandlerAlbumSize added in v1.6.4

type CommandHandlerAlbumSize struct {
	MediaCounterPort              MediaCounterPort
	ListUserWhoCanAccessAlbumPort ListUserWhoCanAccessAlbumPort
	ViewWriteRepository           ViewWriteRepository
}

func (*CommandHandlerAlbumSize) AlbumShared added in v1.6.4

func (c *CommandHandlerAlbumSize) AlbumShared(ctx context.Context, albumId catalog.AlbumId, userId usermodel.UserId) error

func (*CommandHandlerAlbumSize) AlbumUnShared added in v1.6.4

func (c *CommandHandlerAlbumSize) AlbumUnShared(ctx context.Context, albumId catalog.AlbumId, userId usermodel.UserId) error

func (*CommandHandlerAlbumSize) OnMediasInserted added in v1.6.4

func (c *CommandHandlerAlbumSize) OnMediasInserted(ctx context.Context, medias map[catalog.AlbumId][]catalog.MediaId) error

func (*CommandHandlerAlbumSize) OnTransferredMedias added in v1.6.4

func (c *CommandHandlerAlbumSize) OnTransferredMedias(ctx context.Context, transfers catalog.TransferredMedias) error

type FindAlbumByOwnerFunc added in v1.5.49

type FindAlbumByOwnerFunc func(ctx context.Context, owner ownermodel.Owner) ([]*catalog.Album, error)

func (FindAlbumByOwnerFunc) FindAlbumsByOwner added in v1.5.49

func (f FindAlbumByOwnerFunc) FindAlbumsByOwner(ctx context.Context, owner ownermodel.Owner) ([]*catalog.Album, error)

type FindAlbumByOwnerPort

type FindAlbumByOwnerPort interface {
	FindAlbumsByOwner(ctx context.Context, owner ownermodel.Owner) ([]*catalog.Album, error)
}

type FindAlbumsByIdsFunc added in v1.5.49

type FindAlbumsByIdsFunc func(ctx context.Context, ids []catalog.AlbumId) ([]*catalog.Album, error)

func (FindAlbumsByIdsFunc) FindAlbumsById added in v1.5.49

func (f FindAlbumsByIdsFunc) FindAlbumsById(ctx context.Context, ids []catalog.AlbumId) ([]*catalog.Album, error)

type FindAlbumsByIdsPort

type FindAlbumsByIdsPort interface {
	FindAlbumsById(ctx context.Context, ids []catalog.AlbumId) ([]*catalog.Album, error)
}

type GetAlbumSharingGridFunc added in v1.5.49

type GetAlbumSharingGridFunc func(ctx context.Context, owner ownermodel.Owner) (map[catalog.AlbumId][]usermodel.UserId, error)

func (GetAlbumSharingGridFunc) GetAlbumSharingGrid added in v1.5.49

func (f GetAlbumSharingGridFunc) GetAlbumSharingGrid(ctx context.Context, owner ownermodel.Owner) (map[catalog.AlbumId][]usermodel.UserId, error)

type GetAlbumSharingGridPort added in v1.5.49

type GetAlbumSharingGridPort interface {
	GetAlbumSharingGrid(ctx context.Context, owner ownermodel.Owner) (map[catalog.AlbumId][]usermodel.UserId, error)
}

type GetAvailabilitiesByUserFunc added in v1.6.4

type GetAvailabilitiesByUserFunc func(ctx context.Context, user usermodel.UserId) ([]AlbumSize, error)

func (GetAvailabilitiesByUserFunc) GetAvailabilitiesByUser added in v1.6.4

func (f GetAvailabilitiesByUserFunc) GetAvailabilitiesByUser(ctx context.Context, user usermodel.UserId) ([]AlbumSize, error)

type GetAvailabilitiesByUserPort added in v1.6.4

type GetAvailabilitiesByUserPort interface {
	GetAvailabilitiesByUser(ctx context.Context, user usermodel.UserId) ([]AlbumSize, error)
}

type ListAlbumsFilter

type ListAlbumsFilter struct {
	OnlyDirectlyOwned bool // OnlyDirectlyOwned provides a sub-view where only resources directly owned by user are displayed and accessible
}

type ListAlbumsProvider added in v1.5.49

type ListAlbumsProvider interface {
	ListAlbums(ctx context.Context, user usermodel.CurrentUser, filter ListAlbumsFilter) ([]*VisibleAlbum, error)
}

type ListAlbumsProviderFunc added in v1.5.49

type ListAlbumsProviderFunc func(ctx context.Context, user usermodel.CurrentUser, filter ListAlbumsFilter) ([]*VisibleAlbum, error)

func (ListAlbumsProviderFunc) ListAlbums added in v1.5.49

type ListUserWhoCanAccessAlbumPort added in v1.6.4

type ListUserWhoCanAccessAlbumPort interface {
	ListUsersWhoCanAccessAlbum(ctx context.Context, albumId ...catalog.AlbumId) (map[catalog.AlbumId][]Availability, error)
}

type MediaCounterFromView added in v1.6.4

type MediaCounterFromView struct {
	AlbumSizes []AlbumSize
}

func (*MediaCounterFromView) CountMedia added in v1.6.4

func (m *MediaCounterFromView) CountMedia(ctx context.Context, album ...catalog.AlbumId) (map[catalog.AlbumId]int, error)

type MediaCounterFunc added in v1.5.50

type MediaCounterFunc func(ctx context.Context, album ...catalog.AlbumId) (map[catalog.AlbumId]int, error)

func (MediaCounterFunc) CountMedia added in v1.5.50

func (f MediaCounterFunc) CountMedia(ctx context.Context, album ...catalog.AlbumId) (map[catalog.AlbumId]int, error)

type MediaCounterInjector added in v1.6.4

type MediaCounterInjector struct {
	GetAvailabilitiesByUserPort GetAvailabilitiesByUserPort
	ProviderFactories           []ProviderFactory
}

MediaCounterInjector is covering the function while the view only contains some of the data (the counts)

func (*MediaCounterInjector) ListAlbums added in v1.6.4

type MediaCounterPort added in v1.5.50

type MediaCounterPort interface {
	CountMedia(ctx context.Context, album ...catalog.AlbumId) (map[catalog.AlbumId]int, error)
}

type OwnedAlbumListProvider added in v1.5.49

type OwnedAlbumListProvider struct {
	FindAlbumByOwnerPort    FindAlbumByOwnerPort
	GetAlbumSharingGridPort GetAlbumSharingGridPort
	MediaCounterPort        MediaCounterPort
}

func (*OwnedAlbumListProvider) ListAlbums added in v1.5.49

type ProviderFactory added in v1.6.4

type ProviderFactory interface {
	NewProvider(ctx context.Context, mediaCounterPort MediaCounterPort) ListAlbumsProvider
}

type ProviderFactoryFunc added in v1.6.4

type ProviderFactoryFunc func(ctx context.Context, mediaCounterPort MediaCounterPort) ListAlbumsProvider

func (ProviderFactoryFunc) NewProvider added in v1.6.4

func (f ProviderFactoryFunc) NewProvider(ctx context.Context, mediaCounterPort MediaCounterPort) ListAlbumsProvider

type SharedAlbumListProvider added in v1.5.49

type SharedAlbumListProvider struct {
	FindAlbumsByIdsPort FindAlbumsByIdsPort
	SharedWithUserPort  SharedWithUserPort
	MediaCounterPort    MediaCounterPort
}

func (*SharedAlbumListProvider) ListAlbums added in v1.5.49

type SharedWithUserFunc added in v1.5.49

type SharedWithUserFunc func(ctx context.Context, userId usermodel.UserId) ([]catalog.AlbumId, error)

func (SharedWithUserFunc) ListAlbumIdsSharedWithUser added in v1.5.49

func (f SharedWithUserFunc) ListAlbumIdsSharedWithUser(ctx context.Context, userId usermodel.UserId) ([]catalog.AlbumId, error)

type SharedWithUserPort

type SharedWithUserPort interface {
	ListAlbumIdsSharedWithUser(ctx context.Context, userId usermodel.UserId) ([]catalog.AlbumId, error)
}

type ViewWriteRepository added in v1.6.4

type ViewWriteRepository interface {
	InsertAlbumSize(ctx context.Context, albumSize []AlbumSize) error
	UpdateAlbumSize(ctx context.Context, albumCountUpdates []AlbumSizeDiff) error
	DeleteAlbumSize(ctx context.Context, availability Availability, albumId catalog.AlbumId) error
}

type VisibleAlbum

type VisibleAlbum struct {
	catalog.Album
	MediaCount         int                // MediaCount is the number of medias on the album
	Visitors           []usermodel.UserId // Visitors are the users that can see the album ; only visible to the owner of the album
	OwnedByCurrentUser bool               // OwnedByCurrentUser is set to true when the user is an owner of the album
}

Jump to

Keyboard shortcuts

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