ctrl

package
v0.25.7 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: AGPL-3.0, AGPL-3.0-only Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidInput = errors.New("failed")
View Source
var ErrOffsetTooBig = errors.New("limit too big")
View Source
var Module = fx.Module("controller",
	fx.Provide(New),
)

Functions

This section is empty.

Types

type Ctrl

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

func New

func New(
	episode domain.EpisodeRepo,
	cache cache.Cache,
	subject domain.SubjectRepo,
	person domain.PersonRepo,
	character domain.CharacterRepo,
	collection domain.CollectionRepo,
	metric tally.Scope,
	user domain.UserRepo,
	topic domain.TopicRepo,
	tx dal.Transaction,
	dam dam.Dam,
	log *zap.Logger,
) Ctrl

func (Ctrl) CountEpisode

func (ctl Ctrl) CountEpisode(ctx context.Context, subjectID model.SubjectID, epType *model.EpType) (int64, error)

func (Ctrl) GetActors

func (ctl Ctrl) GetActors(
	ctx context.Context,
	subjectID model.SubjectID,
	characterIDs ...model.CharacterID,
) (map[model.CharacterID][]model.Person, error)

func (Ctrl) GetCharacter

func (ctl Ctrl) GetCharacter(ctx context.Context, user domain.Auth, id model.CharacterID) (model.Character, error)

func (Ctrl) GetCharacterNoRedirect

func (ctl Ctrl) GetCharacterNoRedirect(
	ctx context.Context, user domain.Auth, id model.CharacterID,
) (model.Character, error)

func (Ctrl) GetCharacterRelatedSubjects

func (ctl Ctrl) GetCharacterRelatedSubjects(
	ctx context.Context,
	user domain.Auth,
	characterID model.CharacterID,
) (model.Character, []model.SubjectCharacterRelation, error)

func (Ctrl) GetEpisode

func (ctl Ctrl) GetEpisode(ctx context.Context, id model.EpisodeID) (model.Episode, error)

func (Ctrl) GetFriends

func (ctl Ctrl) GetFriends(ctx context.Context, id model.UserID) (map[model.UserID]domain.FriendItem, error)

func (Ctrl) GetPerson

func (ctl Ctrl) GetPerson(ctx context.Context, personID model.PersonID) (model.Person, error)

func (Ctrl) GetPersonRelated

func (ctl Ctrl) GetPersonRelated(
	ctx context.Context, personID model.PersonID,
) ([]model.SubjectPersonRelation, error)

func (Ctrl) GetPersonRelatedCharacters

func (ctl Ctrl) GetPersonRelatedCharacters(
	ctx context.Context, personID model.PersonID,
) ([]model.PersonCharacterRelation, error)

func (Ctrl) GetSubject

func (ctl Ctrl) GetSubject(ctx context.Context, user domain.Auth, subjectID model.SubjectID) (model.Subject, error)

func (Ctrl) GetSubjectByIDs

func (ctl Ctrl) GetSubjectByIDs(
	ctx context.Context,
	subjectIDs ...model.SubjectID,
) (map[model.SubjectID]model.Subject, error)

func (Ctrl) GetSubjectNoRedirect

func (ctl Ctrl) GetSubjectNoRedirect(
	ctx context.Context,
	user domain.Auth,
	subjectID model.SubjectID,
) (model.Subject, error)

func (Ctrl) GetSubjectRelatedCharacters

func (ctl Ctrl) GetSubjectRelatedCharacters(
	ctx context.Context,
	user domain.Auth,
	subjectID model.SubjectID,
) (model.Subject, []model.SubjectCharacterRelation, error)

func (Ctrl) GetSubjectRelatedSubjects

func (ctl Ctrl) GetSubjectRelatedSubjects(
	ctx context.Context,
	user domain.Auth,
	subjectID model.SubjectID,
) (model.Subject, []model.SubjectInternalRelation, error)

func (Ctrl) GetTopic

func (ctl Ctrl) GetTopic(
	ctx context.Context, u domain.Auth, topicType domain.TopicType, topicID model.TopicID, limit int, offset int,
) (model.TopicDetail, error)

func (Ctrl) GetUser

func (ctl Ctrl) GetUser(ctx context.Context, userID model.UserID) (model.User, error)

func (Ctrl) GetUsersByIDs

func (ctl Ctrl) GetUsersByIDs(ctx context.Context, userIDs ...model.UserID) (map[model.UserID]model.User, error)

func (Ctrl) ListEpisode

func (ctl Ctrl) ListEpisode(
	ctx context.Context,
	subjectID model.SubjectID,
	epType *model.EpType,
	limit, offset int,
) ([]model.Episode, int64, error)

func (Ctrl) ListReplies

func (ctl Ctrl) ListReplies(
	ctx context.Context,
	commentType domain.CommentType,
	topicID model.TopicID,
	limit, offset int,
) ([]model.Comment, int64, error)

func (Ctrl) ListTopics

func (ctl Ctrl) ListTopics(
	ctx context.Context,
	u domain.Auth,
	topicType domain.TopicType,
	objectID uint32,
	limit, offset int,
) ([]model.Topic, int64, error)

func (Ctrl) UpdateCollection added in v0.23.8

func (ctl Ctrl) UpdateCollection(
	ctx context.Context,
	u domain.Auth,
	subjectID model.SubjectID,
	req UpdateCollectionRequest,
) error

func (Ctrl) UpdateEpisodeCollection added in v0.23.8

func (ctl Ctrl) UpdateEpisodeCollection(
	ctx context.Context,
	u domain.Auth,
	subjectID model.SubjectID,
	episodeIDs []model.EpisodeID,
	t model.EpisodeCollection,
) error

type UpdateCollectionRequest added in v0.23.8

type UpdateCollectionRequest struct {
	IP string

	Comment   null.String
	Tags      []string
	VolStatus null.Uint32
	EpStatus  null.Uint32
	Type      null.Null[model.SubjectCollection]
	Rate      null.Uint8
	Private   null.Bool
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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