ctrl

package
v0.29.13 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2022 License: AGPL-3.0, AGPL-3.0-only Imports: 23 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 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 domain.EpisodeRepo,
	cache cache.RedisCache,
	subject subject.Repo,
	person domain.PersonRepo,
	character domain.CharacterRepo,
	collection domain.CollectionRepo,
	index domain.IndexRepo,
	timeline domain.TimeLineRepo,
	user domain.UserRepo,
	topic domain.TopicRepo,
	tx dal.Transaction,
	dam dam.Dam,
	privateMessage domain.PrivateMessageRepo,
	log *zap.Logger,
) Ctrl

func (Ctrl) CountEpisode

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

func (Ctrl) CreatePrivateMessage added in v0.29.0

func (ctl Ctrl) CreatePrivateMessage(
	ctx context.Context,
	senderID model.UserID,
	receiverIDs []model.UserID,
	relatedIDFilter domain.PrivateMessageIDFilter,
	title string,
	content string) ([]model.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 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) GetIndexWithCache added in v0.28.0

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 domain.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 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.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,
	episodeID model.EpisodeID,
	t model.EpisodeCollection,
) error

func (Ctrl) UpdateEpisodesCollection added in v0.27.1

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

type SubjectFilter added in v0.27.4

type SubjectFilter struct {
	NSFW null.Bool
}

type UpdateCollectionRequest added in v0.23.8

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