ctrl

package
v0.30.9 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: AGPL-3.0, AGPL-3.0-only Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidInput = errors.New("invalid input")
View Source
var ErrOffsetTooBig = errors.New("limit too big")
View Source
var ErrPmBlocked = errors.New("have been blocked")
View Source
var ErrPmNotAFriend = errors.New("not a friend to some receivers")
View Source
var ErrPmNotAllReceiversExist = errors.New("some receivers not exist")
View Source
var ErrPmReceiverReject = errors.New("some receivers reject private message")
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 episode.Repo,
	cache cache.RedisCache,
	subject subject.Repo,
	person person.Repo,
	character character.Repo,
	collection collection.Repo,
	index index.Repo,
	timeline timeline.Repo,
	user user.Repo,
	tx dal.Transaction,
	dam dam.Dam,
	privateMessage pm.Repo,
	log *zap.Logger,
) Ctrl

func (Ctrl) CountEpisode

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

func (Ctrl) CreatePrivateMessage

func (ctl Ctrl) CreatePrivateMessage(
	ctx context.Context,
	senderID model.UserID,
	receiverIDs []model.UserID,
	relatedIDFilter pm.IDFilter,
	title string,
	content string) ([]pm.PrivateMessage, 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 auth.Auth, id model.CharacterID) (model.Character, error)

func (Ctrl) GetCharacterNoRedirect

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

func (Ctrl) GetCharacterRelatedSubjects

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

func (Ctrl) GetEpisode

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

func (Ctrl) GetFriends

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

func (Ctrl) GetIndexWithCache

func (ctl Ctrl) GetIndexWithCache(c context.Context, id uint32) (res.Index, bool, 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 auth.Auth, subjectID model.SubjectID) (model.Subject, error)

func (Ctrl) GetSubjectByIDs

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

func (Ctrl) GetSubjectNoRedirect

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

func (Ctrl) GetSubjectRelatedCharacters

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

func (Ctrl) GetSubjectRelatedSubjects

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

func (Ctrl) GetUser

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

func (Ctrl) GetUsersByIDs

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

func (Ctrl) ListEpisode

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

func (Ctrl) UpdateCollection

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

func (Ctrl) UpdateEpisodeCollection

func (ctl Ctrl) UpdateEpisodeCollection(
	ctx context.Context,
	u auth.Auth,
	episodeID model.EpisodeID,
	t model.EpisodeCollection,
) error

func (Ctrl) UpdateEpisodesCollection

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

type SubjectFilter

type SubjectFilter struct {
	NSFW null.Bool
}

type UpdateCollectionRequest

type UpdateCollectionRequest struct {
	IP  string
	UID model.UserID

	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