Documentation
¶
Index ¶
- Constants
- Variables
- func AppVersion() string
- func ApplyBookTagPreferences(ctx context.Context, bookID int64, tags []int64)
- func ArrInt64StringToInt64(v []Int64String) []int64
- func GenID() int64
- func HiddenSearchTagIDs(ctx context.Context, included []int64) []int64
- func HiddenTagIDs(ctx context.Context) []int64
- func IsBookCensored(ctx context.Context, bookID int64) bool
- func IsCommonPageSize(pageSize int32) bool
- func IsTagCensored(ctx context.Context, id int64) bool
- func MapSlice[T, U any](ts []T, f func(T) U) []U
- func MoveItem[T comparable](arr []T, item T, newPositionIndex int) (int, bool)
- func ResolveCensoredTags(ctx context.Context, queries *store.Queries, values []string) ([]int64, error)
- func ValidateEmail(email string) error
- func ValidateUserName(value string) error
- func ValidateUserRoleChange(current, next UserRole) error
- func WithContentPreferences(ctx context.Context, prefs *ContentPreferences) context.Context
- type AddCommentCommand
- type AddCommentResult
- type AddToCollectionsCommand
- type AdultContentService
- type AgeRating
- type AuthService
- type BanUserCommand
- type BookActionType
- type BookAdultWarning
- type BookBackgroundService
- type BookCollectionDto
- type BookCover
- type BookDetailsAuthorDto
- type BookDetailsDto
- type BookExternalLinkDto
- type BookExtremes
- type BookLibraryDto
- type BookListDto
- type BookLogResult
- type BookManagerService
- type BookManagerServiceDeps
- type BookModerationChapter
- type BookModerationInfo
- type BookModerationLog
- type BookPendingReport
- type BookReadingListDto
- type BookReadingListItemLastChapterDto
- type BookRecalculationIngest
- type BookReindexService
- type BookReviewsDistribution
- type BookSearchItem
- type BookSearchQuery
- type BookSearchResult
- type BookSearchResultMeta
- type BookSearchSort
- type BookService
- type BookTags
- type BookUserPermissions
- type CensorMode
- type ChapterDto
- type ChapterListDto
- type ChapterNextPrevDto
- type ChapterOrderModification
- type CollectionBook2Dto
- type CollectionBookDto
- type CollectionDto
- type CollectionService
- type CommentDto
- type CommentSort
- type CommentUserDto
- type CommentsService
- type ContentModerationRepository
- type ContentModerationService
- type ContentPreferences
- type CreateBookChapterCommand
- type CreateBookChapterCommand_Result
- type CreateBookCommand
- type CreateCollectionCommand
- type CreateDraftCommand
- type CreateReportCommand
- type CreateSessionCommand
- type CreateTagsCommand
- type DBdeprecated
- type DecideModerationReportCommand
- type DefinedTagDto
- type DeleteCollectionCommand
- type DeleteDraftCommand
- type DeleteReviewCommand
- type DetailedBookSearchQuery
- type DraftDto
- type DraftPublishingService
- type EmailVerificationStatus
- type FollowUserCommand
- type GenericNotification
- type GetBookChapterQuery
- type GetBookChapterResult
- type GetBookChaptersQuery
- type GetBookCollectionsQuery
- type GetBookDraftsQuery
- type GetBookInfoQuery
- type GetBookLogQuery
- type GetBookQuery
- type GetBookReviewsDistributionResult
- type GetBookReviewsQuery
- type GetBookReviewsResult
- type GetCollectionBooksQuery
- type GetCollectionBooksResult
- type GetCommentRepliesQuery
- type GetCommentRepliesResult
- type GetCommentsQuery
- type GetCommentsResult
- type GetDraftQuery
- type GetLatestDraftQuery
- type GetLoginHistoryQuery
- type GetModerationReportQuery
- type GetModerationUserQuery
- type GetPinnedUserBooksQuery
- type GetPinnedUserBooksResult
- type GetReadingListItemsQuery
- type GetRecentCollectionsQuery
- type GetReviewQuery
- type GetSetupDataResult
- type GetUserCollectionsQuery
- type GetUserCollectionsResult
- type GetUserDataQuery
- type GetUserQuery
- type IPLocation
- type IPLocationService
- type Int32
- type Int32Range
- type Int64String
- type LikeCommentCommand
- type ListTagsQuery
- type ListTagsResult
- type LoginHistoryEntry
- type LoginHistoryRepository
- type LoginHistoryService
- type LoginLocation
- type ManagerBookChapterDetailsDto
- type ManagerBookChapterDto
- type ManagerBookDetailsDto
- type ManagerBookDto
- type ManagerBookDto_Stats
- type ManagerGetBookChaptersQuery
- type ManagerGetBookChaptersQuery_Result
- type ManagerGetBookQuery
- type ManagerGetBookQuery_Result
- type ManagerGetChapterQuery
- type ManagerGetChapterQuery_Result
- type ManagerGetUserBooksQuery
- type ManagerGetUserBooksQuery_Result
- type MarkChapterCommand
- type ModerateChapterCommand
- type ModerateCommentCommand
- type ModerateUserProfileCommand
- type ModerationAction
- type ModerationAuditEntry
- type ModerationAuditLogEntry
- type ModerationAuditLogQuery
- type ModerationAuditLogService
- type ModerationAuthorizer
- type ModerationBookListEntry
- type ModerationBookService
- type ModerationPage
- type ModerationPerformBookActionCommand
- type ModerationReportActivity
- type ModerationReportBookContext
- type ModerationReportBookContextData
- type ModerationReportCommentContextData
- type ModerationReportDetail
- type ModerationReportListEntry
- type ModerationReportService
- type ModerationReportUserContextData
- type ModerationUserBook
- type ModerationUserComment
- type ModerationUserHistoryEntry
- type ModerationUserInfo
- type ModerationUserListEntry
- type ModerationUserPageQuery
- type ModerationUserReport
- type ModerationUserRepository
- type ModerationUserService
- type ModerationUsersQuery
- type NormalizedSearchRequest
- type Nullable
- type PaginationOptions
- type PaginationRestrictions
- type PublishDraftCommand
- type RatingAndReview
- type RatingValue
- type ReaderFont
- type ReaderFontService
- type ReaderPreferences
- type ReaderPreferencesService
- type ReadingListService
- type ReadingListStatus
- type RemoveFromCollectionCommand
- type RenewSessionCommand
- type ReorderChaptersCommand
- type Report
- type ReportActionExecutor
- type ReportDecision
- type ReportRepository
- type ReportService
- type ReportTargetType
- type ReviewDto
- type ReviewUserDto
- type ReviewsService
- type ScheduleDraftCommand
- type SearchModerationBooksQuery
- type SearchModerationReportsQuery
- type SearchService
- type SearchUserBooksQuery
- type SearchUserBooksResult
- type SelfUserDto
- type SendEmailVerificationCommand
- type SendEmailVerificationResult
- type SessionInfo
- type SessionPublicInfo
- type SessionService
- type SetUserDataQuery
- type SetupCommand
- type SetupService
- type SignInCommand
- type SignInResult
- type SignUpCommand
- type SignUpResult
- type SignUpService
- type TagDescriptor
- type TagDetailsItemDto
- type TagsCategory
- type TagsService
- type TrashBookCommand
- type UnfollowUserCommand
- type UntrashBookCommand
- type UpdateBookChapterCommand
- type UpdateBookChapterOrdersCommand
- type UpdateBookChapterOrdersCommand_Result
- type UpdateBookCommand
- type UpdateCollectionCommand
- type UpdateCommentCommand
- type UpdateCommentResult
- type UpdateDraftChapterNameCommand
- type UpdateDraftCommand
- type UpdateDraftContentCommand
- type UpdateRatingCommand
- type UpdateReviewCommand
- type UpdateTagCommand
- type UpdateUserCommand
- type UploadBookCoverCommand
- type UploadBookCoverCommand_Result
- type UploadConfig
- type UploadService
- type UploadURI
- type UploadURIType
- type UserAboutDto
- type UserAboutSettings
- type UserAgentInfo
- type UserCustomizationSetting
- type UserDataService
- type UserDetailsDto
- type UserFromSearchRequestDto
- type UserListResponse
- type UserModerationSettings
- type UserPrivacySettings
- type UserRole
- type UserSearchItem
- type UserService
- type UsersQuery
- type VerifyEmailCommand
Constants ¶
const ( ReportDispositionNoViolation = "no_violation" ReportDispositionRequestChanges = "request_changes" ReportDispositionActionTaken = "action_taken" ReportDispositionEscalated = "escalated" )
const (
BOOK_COVER_DIRECTORY = "book-covers"
)
const MaxChapterNameLength = 200
const ReaderFontDyslexic = reader.ReaderFontDyslexic
const ReaderFontSans = reader.ReaderFontSans
const ReaderFontSerif = reader.ReaderFontSerif
const ReaderPageBackground = reader.ReaderPageBackground
const ReaderPageSurface = reader.ReaderPageSurface
const ReaderThemeDark = reader.ReaderThemeDark
const ReaderThemeLight = reader.ReaderThemeLight
const ReaderThemeOLED = reader.ReaderThemeOLED
const ReaderThemeSystem = reader.ReaderThemeSystem
const TagsCategoryFandom = tags.TagsCategoryFandom
const TagsCategoryGenre = tags.TagsCategoryGenre
const TagsCategoryOther = tags.TagsCategoryOther
const TagsCategoryRelationship = tags.TagsCategoryRelationship
const TagsCategoryRelationshipType = tags.TagsCategoryRelationshipType
const TagsCategoryWarning = tags.TagsCategoryWarning
const UploadURITypeExternal = upload.UploadURITypeExternal
const UploadURITypePrivateMinio = upload.UploadURITypePrivateMinio
const UploadURITypePublicMinio = upload.UploadURITypePublicMinio
const UploadURITypeUnknown = upload.UploadURITypeUnknown
const UserDataMaxSize = userdata.UserDataMaxSize
Variables ¶
var ( ErrTypeSignUp = apperror.AppErrors.NewType("signup") ErrUsernameTaken = ErrTypeSignUp.New("username is already taken") ErrTypeAuthenticationError = apperror.AppErrors.NewType("authentication", apperror.ErrTraitAuthorizationIssue) ErrInvalidCredentials = ErrTypeAuthenticationError.New("invalid credentials") ErrUserBanned = ErrTypeAuthenticationError.New("user is banned") )
var ( ErrTypeBookNotFound = apperror.AppErrors.NewType("book404", apperror.ErrTraitEntityNotFound) ErrTypeBookPrivated = apperror.AppErrors.NewType("access_denied_book_private", apperror.ErrTraitForbidden) )
var ( ErrTypeBookSanitizationFailed = apperror.AppErrors.NewType("content_sanitization_failed") ErrTypeChaptersReorder = apperror.AppErrors.NewType("chapters_reorder") ErrDraftNotFound = apperror.AppErrors.NewType("draft_not_found", errorx.NotFound(), apperror.ErrTraitEntityNotFound).New("draft not found") ErrTypeChapterDoesNotExist = apperror.AppErrors.NewType("chapter_not_found", apperror.ErrTraitEntityNotFound) )
var ( ErrEmptyBookName = errors.New("empty book name") ErrBookNameTooLong = errors.New("invalid book name") BookSummaryTooLong = errors.New("book summary is too long") )
var ( CollectionErrors = apperror.AppErrors.NewSubNamespace("collection") ErrCollectionNotExists = CollectionErrors.NewType("404", apperror.ErrTraitEntityNotFound).New("collection not found") )
var ( CommentErrors = apperror.AppErrors.NewSubNamespace("comment") ErrTypeCommentNotFound = CommentErrors.NewType("not_found", apperror.ErrTraitEntityNotFound) ErrTypeCommentContentInvalid = CommentErrors.NewType("invalid_content", apperror.ErrTraitValidationError) ErrCommentUpdateForbidden = CommentErrors.NewType("update_forbidden", apperror.ErrTraitForbidden).New("only the comment author can edit this comment") ErrCommentContentEmpty = ErrTypeCommentContentInvalid.New("comment content is empty") ErrCommentContentTooLarge = ErrTypeCommentContentInvalid.New("comment content is too large") )
var ( ErrModerationForbidden = apperror.AppErrors.NewType("moderation_forbidden", apperror.ErrTraitAuthorizationIssue).New("moderator privileges are required") ErrModerationReason = apperror.AppErrors.NewType("moderation_reason_required").New("a moderation reason is required") ErrInvalidLoginHistoryFilter = apperror.AppErrors.NewType("invalid_login_history_filter").New("invalid login history filter") )
var ( ModerationBookErrors = apperror.AppErrors.NewSubNamespace("mod_books") InvalidModerationActionError = ModerationBookErrors.NewType("invalid_mod_action") ErrInvalidModerationAction_NoReason = InvalidModerationActionError.New("no reason provided") ModerationBookNotFoundError = ModerationBookErrors.NewType("book_404", apperror.ErrTraitEntityNotFound) )
var ( ErrInvalidReportDisposition = apperror.AppErrors.NewType("invalid_report_disposition").New("invalid report disposition") ErrReportAlreadyResolved = apperror.AppErrors.NewType("report_already_resolved").New("report is already resolved") ErrReportPolicyReason = apperror.AppErrors.NewType("report_policy_reason_required").New("a policy reason is required") ErrReportInternalNote = apperror.AppErrors.NewType("report_internal_note_too_long").New("internal note must not exceed 1000 characters") )
var ( ReadingListErrors = apperror.AppErrors.NewSubNamespace("reading_list") ReadingListInvalidTransition = ReadingListErrors.NewType("invalid_transition") ErrReadingListEmptyBook = ReadingListInvalidTransition.NewSubtype("empty_book").New("cannot update reading list for empty book") ReadingListChapterNotFound = ReadingListErrors.NewType("chapter404") )
var ( ErrInvalidReportTarget = apperror.AppErrors.NewType("invalid_report_target").New("report target must be a user, book, or comment") ErrReportReason = apperror.AppErrors.NewType("report_reason_required").New("a report reason is required") ErrReportTargetMissing = apperror.AppErrors.NewType("report_target_not_found", apperror.ErrTraitEntityNotFound).New("report target not found") ErrReportNotFound = apperror.AppErrors.NewType("report_not_found", apperror.ErrTraitEntityNotFound).New("report not found") )
var ( SignUpErrors = apperror.AppErrors.NewSubNamespace("signup") SignUpInvalidInput = SignUpErrors.NewType("invalid") SignUpEmailVerificationErrors = SignUpErrors.NewSubNamespace("email_verification") SignUpEmailVerificationNA = SignUpEmailVerificationErrors.NewType("na") SignUpEmailVerificationRateLimit = SignUpEmailVerificationErrors.NewType("rate_limit") SignUpEmailVerificationTimedOut = SignUpEmailVerificationErrors.NewType("timedout") SignUpEmailVerificationInvalidCode = SignUpEmailVerificationErrors.NewType("invalid_code") )
var ( RoleUser = UserRole("user") RoleAdmin = UserRole("admin") RoleSystem = UserRole("system") RoleModerator = UserRole("moderator") AllRoles = []UserRole{ RoleUser, RoleAdmin, RoleSystem, RoleModerator, } )
var ( ErrUserNotFound = apperror.AppErrors.NewType("user_not_found", apperror.ErrTraitEntityNotFound).New("user not found") ErrFollowYourself = apperror.AppErrors.NewType("follow_yourself").New("you can't follow yourself") ErrInvalidUserRole = apperror.AppErrors.NewType("invalid_user_role").New("invalid user role") ErrUserNameInvalid = apperror.AppErrors.NewType("invalid_username") ErrEmailInvalid = apperror.AppErrors.NewType("invalid_email") )
var AllRatings []AgeRating = []AgeRating{ AgeRatingG, AgeRatingPG, AgeRatingPG13, AgeRatingR, AgeRatingNC17, AgeRatingUnknown, }
var (
DefaultPaginationRestrictions = PaginationRestrictions{
MaxPageSize: 100,
MaxPageCount: 1000,
}
)
var ErrInvalidCensoredTags = errors.New("invalid censored tags")
var ErrInvalidReportAction = apperror.AppErrors.NewType("invalid_report_action").New("action is not valid for this report target")
var ErrInvalidUploadURI = upload.ErrInvalidUploadURI
var (
ErrSessionNotFound = apperror.AppErrors.NewType("session_not_found").New("session not found")
)
var ErrSetupInvalidInput = errors.New("invalid setup input")
var ErrTagNotFound = tags.ErrTagNotFound
var ErrTypeUserDataKeyNotAllowed = userdata.ErrTypeUserDataKeyNotAllowed
var ErrUserDataKeyNotAllowed = userdata.ErrUserDataKeyNotAllowed
var ErrUserDataTooLarge = userdata.ErrUserDataTooLarge
var FXModule = fx.Module("ol_app", fx.Decorate(), analytics.FXModule, bookfont.FXModule, content.FXModule, siteconfig.FXModule, tags.FXModule, reader.FXModule, upload.FXModule, userdata.FXModule, fx.Provide( NewSetupService, NewUserService, NewAuthService, NewSignUpService, NewBookService, NewAdultContentService, NewBookFullReindexService, fx.Annotate( NewBookBackgroundService, fx.As(fx.Self()), fx.As(new(BookRecalculationIngest)), ), NewBookManagerService, NewDraftPublishingService, NewReviewsService, NewSearchService, NewCommentsService, NewReadingListService, NewCollectionsService, NewIPLocationService, NewSessionService, NewModerationAuthorizer, NewModerationBookService, NewModerationAuditLogService, NewContentModerationRepository, NewContentModerationService, NewLoginHistoryRepository, NewLoginHistoryService, NewModerationUserRepository, NewModerationUserService, NewReportRepository, NewReportService, NewReportActionExecutor, NewModerationReportService, func(db DB) store.DBTX { return db }, ), cronRunnerModule, fx.Invoke(func(srv BookBackgroundService, draftPublishing *DraftPublishingService) {}), )
var ( GlobalFeatureFlags struct { DisableCache bool } )
var TagsCategoryList = tags.TagsCategoryList
var UserDataErrors = userdata.UserDataErrors
Functions ¶
func AppVersion ¶
func AppVersion() string
func ApplyBookTagPreferences ¶
ApplyBookTagPreferences matches any selected tag (including expanded synonyms).
func ArrInt64StringToInt64 ¶
func ArrInt64StringToInt64(v []Int64String) []int64
func HiddenSearchTagIDs ¶
An explicit include is an intentional request; those matches remain blurred.
func HiddenTagIDs ¶
func IsCommonPageSize ¶
func MoveItem ¶
func MoveItem[T comparable](arr []T, item T, newPositionIndex int) (int, bool)
MoveItem moves an item in the list, returns new position of item and a boolean representing the successfullness of the operation (true if successful), if operation was unsuccessful then newPosition returned SHOULD be -1
func ResolveCensoredTags ¶
func ResolveCensoredTags(ctx context.Context, queries *store.Queries, values []string) ([]int64, error)
ResolveCensoredTags supports legacy names while storing stable decimal IDs. Unknown/deleted selections are reported so they can be removed explicitly.
func ValidateEmail ¶
func ValidateUserName ¶
func ValidateUserRoleChange ¶
ValidateUserRoleChange reserves system roles for provisioning and prevents normal account updates from removing an existing system role.
func WithContentPreferences ¶
func WithContentPreferences(ctx context.Context, prefs *ContentPreferences) context.Context
Types ¶
type AddCommentCommand ¶
type AddCommentCommand struct {
UserID uuid.UUID
ChapterID int64
ParentCommentID Nullable[int64]
Content string
}
func (*AddCommentCommand) Validate ¶
func (c *AddCommentCommand) Validate() error
type AddCommentResult ¶
type AddCommentResult struct {
Comment CommentDto
}
type AddToCollectionsCommand ¶
type AdultContentService ¶
type AdultContentService interface {
IsAdult(rating AgeRating, tags []DefinedTagDto) bool
}
AdultContentService owns audience classification so callers do not encode rating boundaries or tag rules. Replace its Fx provider to customize policy.
func NewAdultContentService ¶
func NewAdultContentService() AdultContentService
type AuthService ¶
type AuthService interface {
SignIn(ctx context.Context, input SignInCommand) (SignInResult, error)
CreateSessionForUser(ctx context.Context, userID uuid.UUID, userAgent, ip string) (string, error)
SignOut(ctx context.Context, sessionID string) error
EnsureAdminUserExists(ctx context.Context) error
}
func NewAuthService ¶
func NewAuthService(db DB, sessions SessionService) AuthService
type BanUserCommand ¶
type BookActionType ¶
type BookActionType string
const ( BookActionTypeBan BookActionType = "ban" BookActionTypeShadowBan BookActionType = "shadow_ban" BookActionTypePermRemoval BookActionType = "perm_removal" BookActionTypeUnBan BookActionType = "un_ban" BookActionTypeUnShadowBan BookActionType = "un_shadow_ban" )
type BookAdultWarning ¶
type BookAdultWarning struct {
IsBookAdult bool
}
func (BookAdultWarning) ShouldShowWarning ¶
func (w BookAdultWarning) ShouldShowWarning() bool
type BookBackgroundService ¶
type BookBackgroundService interface {
BookRecalculationIngest
Start() error
Stop()
}
func NewBookBackgroundService ¶
func NewBookBackgroundService(db DB, lc fx.Lifecycle, log *zap.SugaredLogger) BookBackgroundService
func NewDummyBookBackgroundService ¶
func NewDummyBookBackgroundService() BookBackgroundService
type BookCollectionDto ¶
type BookCollectionDto struct {
ID int64 `json:"id,string"`
Name string `json:"name"`
Position int `json:"pos"`
Size int `json:"size"`
}
go2tsdef:generate
type BookDetailsAuthorDto ¶
go2tsdef:generate
type BookDetailsDto ¶
type BookDetailsDto struct {
AdminOverride bool `json:"-"`
VisibilityReasons []string `json:"visibilityReasons"`
IsBanned bool `json:"isBanned"`
IsShadowBanned bool `json:"isShadowBanned"`
IsTrashed bool `json:"isTrashed"`
IsPermRemoved bool `json:"isPermRemoved"`
ID int64 `json:"id,string"`
Name string `json:"name"`
AgeRating AgeRating `json:"ageRating"`
IsAdult bool `json:"adult"`
Tags []DefinedTagDto `json:"tags"`
Words int `json:"words"`
WordsPerChapter int `json:"wordsPerChapter"`
Chapters int `json:"chapters"`
CreatedAt time.Time `json:"createdAt"`
ExternalLinks []BookExternalLinkDto `json:"externalLinks"`
Collections []BookCollectionDto `json:"collections"`
Author BookDetailsAuthorDto `json:"author"`
Permissions BookUserPermissions `json:"permissions"`
Summary string `json:"summary"`
Notifications []GenericNotification `json:"notifications,omitempty"`
Cover BookCover `json:"cover"`
Rating Nullable[float64] `json:"rating"`
Votes int32 `json:"votes"`
Reviews int32 `json:"reviews"`
IsPubliclyAvailable bool `json:"isPubliclyAvailable"`
Slug string `json:"slug"`
FirstChapterID Nullable[int64] `json:"firstChapterId"`
}
func (BookDetailsDto) GetAdultWarning ¶
func (d BookDetailsDto) GetAdultWarning() BookAdultWarning
type BookExternalLinkDto ¶
BookExternalLinkDto is a link to a book hosted or supported elsewhere. Persistence for these links will be added separately; keeping the page DTO ready lets the UI render any supported source without source-specific markup.
type BookExtremes ¶
type BookExtremes struct {
Words Int32Range `json:"words"`
Chapters Int32Range `json:"chapters"`
WordsPerChapter Int32Range `json:"wordsPerChapter"`
Favorites Int32Range `json:"favorites"`
}
type BookLibraryDto ¶
type BookListDto ¶
type BookListDto struct {
ID int64 `json:"id,string"`
Slug string `json:"slug"`
Name string `json:"name"`
Author BookDetailsAuthorDto `json:"-"`
CreatedAt time.Time `json:"createdAt"`
AgeRating AgeRating `json:"ageRating"`
Words int `json:"words"`
WordsPerChapter int `json:"wordsPerChapter"`
Chapters int `json:"chapters"`
Cover BookCover `json:"cover"`
IsPinned bool `json:"isPinned"`
}
type BookLogResult ¶
type BookManagerService ¶
type BookManagerService interface {
GetUserBooks(ctx context.Context, input ManagerGetUserBooksQuery) (ManagerGetUserBooksQuery_Result, error)
GetBook(ctx context.Context, query ManagerGetBookQuery) (ManagerGetBookQuery_Result, error)
CreateBook(ctx context.Context, input CreateBookCommand) (int64, error)
UpdateBook(ctx context.Context, input UpdateBookCommand) error
UploadBookCover(ctx context.Context, input UploadBookCoverCommand) (UploadBookCoverCommand_Result, error)
TrashBook(ctx context.Context, input TrashBookCommand) error
UntrashBook(ctx context.Context, input UntrashBookCommand) error
UpdateBookChaptersOrder(ctx context.Context, input UpdateBookChapterOrdersCommand) (UpdateBookChapterOrdersCommand_Result, error)
CreateBookChapter(ctx context.Context, input CreateBookChapterCommand) (CreateBookChapterCommand_Result, error)
ReorderChapters(ctx context.Context, input ReorderChaptersCommand) error
GetBookChapters(ctx context.Context, query ManagerGetBookChaptersQuery) (ManagerGetBookChaptersQuery_Result, error)
GetChapter(ctx context.Context, query ManagerGetChapterQuery) (ManagerGetChapterQuery_Result, error)
UpdateBookChapter(ctx context.Context, cmd UpdateBookChapterCommand) error
GetDraft(ctx context.Context, query GetDraftQuery) (DraftDto, error)
UpdateDraft(ctx context.Context, cmd UpdateDraftCommand) error
UpdateDraftChapterName(ctx context.Context, cmd UpdateDraftChapterNameCommand) error
UpdateDraftContent(ctx context.Context, cmd UpdateDraftContentCommand) error
DeleteDraft(ctx context.Context, cmd DeleteDraftCommand) error
PublishDraft(ctx context.Context, cmd PublishDraftCommand) error
ScheduleDraft(ctx context.Context, cmd ScheduleDraftCommand) error
CreateDraft(ctx context.Context, cmd CreateDraftCommand) (int64, error)
GetLatestDraft(ctx context.Context, cmd GetLatestDraftQuery) (Nullable[int64], error)
}
func NewBookManagerService ¶
func NewBookManagerService(deps BookManagerServiceDeps, db dal.DB) BookManagerService
type BookManagerServiceDeps ¶
type BookManagerServiceDeps struct {
fx.In
DB DB
AdultContentService AdultContentService
TagsService TagsService
UsersService UserService
UploadService *UploadService
BookReindexService BookReindexService
MetricService analytics.MetricService
Log *zap.SugaredLogger
Markup *content.MarkupEngine
FontPolicy bookfont.Policy
}
type BookModerationChapter ¶
type BookModerationInfo ¶
type BookModerationInfo struct {
ID int64
Name string
Summary string
IsBanned bool
IsShadowBanned bool
IsPermDeleted bool
AuthorUserID uuid.UUID
AuthorUserName string
CreatedAt time.Time
AgeRating string
IsPubliclyVisible bool
Words int32
Chapters int32
ReportsCount int64
LatestPendingReport *BookPendingReport
BanReason string
}
type BookModerationLog ¶
type BookModerationLog struct {
Time time.Time
Action BookActionType
Payload json.RawMessage
Reason string
ActorUserID uuid.UUID
ActorUserName string
}
type BookPendingReport ¶
type BookReadingListDto ¶
type BookReadingListDto struct {
Status ReadingListStatus `json:"status"`
ChapterID Nullable[Int64String] `json:"chapterId"`
ChapterName string `json:"chapterName"`
ChapterOrder int32 `json:"chapterOrder"`
LastUpdatedAt time.Time `json:"lastUpdatedAt"`
}
go2tsdef:generate
type BookRecalculationIngest ¶
type BookRecalculationIngest interface {
ScheduleBookRecalculation(bookID int64)
}
type BookReindexService ¶
type BookReindexService interface {
Reindex(ctx context.Context, id int64) error
ScheduleReindex(ctx context.Context, id int64)
ScheduleReindexAll() error
}
func NewBookFullReindexService ¶
func NewBookFullReindexService(db store.DBTX, osClient *opensearchapi.Client, log *zap.SugaredLogger) BookReindexService
func NewDummyBookReindexService ¶
func NewDummyBookReindexService() BookReindexService
type BookReviewsDistribution ¶
type BookReviewsDistribution [10]int32
type BookSearchItem ¶
type BookSearchItem struct {
ID int64 `json:"id,string"`
Name string `json:"name"`
Slug string `json:"slug"`
CreatedAt time.Time `json:"createdAt"`
AgeRating AgeRating `json:"ageRating"`
Words int `json:"words"`
WordsPerChapter int `json:"wordsPerChapter"`
Chapters int `json:"chapters"`
Summary string `json:"summary"`
Author BookDetailsAuthorDto `json:"author"`
Cover BookCover `json:"cover"`
Tags []Int64String `json:"tags"`
Collections []BookCollectionDto `json:"collections"`
}
type BookSearchQuery ¶
type BookSearchQuery struct {
UserID Nullable[uuid.UUID]
Query string
Sort BookSearchSort
Words Int32Range
Chapters Int32Range
WordsPerChapter Int32Range
IncludeTags []int64
ExcludeTags []int64
IncludeUsers []uuid.UUID
ExcludeUsers []uuid.UUID
IncludeBanned bool
IncludeHidden bool
IncludeEmpty bool
Page uint32
PageSize uint
}
type BookSearchResult ¶
type BookSearchResult struct {
TookUSTotal int64
TookUS int64
Meta BookSearchResultMeta
Books []BookSearchItem
PageSize uint32
Page uint32
TotalPages uint32
Total int64
Tags []DefinedTagDto
}
type BookSearchResultMeta ¶
type BookSearchSort ¶
type BookSearchSort string
const ( BookSearchSortRelevance BookSearchSort = "" BookSearchSortChapters BookSearchSort = "chapters" BookSearchSortWords BookSearchSort = "words" BookSearchSortWordsPerChapter BookSearchSort = "words-per-chapter" BookSearchSortLastUpdated BookSearchSort = "last-updated" BookSearchSortCreatedAt BookSearchSort = "created-at" BookSearchSortReviews BookSearchSort = "reviews" BookSearchSortReaders BookSearchSort = "readers" BookSearchSortWeightedRating BookSearchSort = "weighted-rating" BookSearchSortRandom BookSearchSort = "random" )
func ParseBookSearchSort ¶
func ParseBookSearchSort(value string) BookSearchSort
func (BookSearchSort) IsImplemented ¶
func (s BookSearchSort) IsImplemented() bool
type BookService ¶
type BookService interface {
GetBookDetails(ctx context.Context, query GetBookQuery) (BookDetailsDto, error)
GetBookChapters(ctx context.Context, query GetBookChaptersQuery) ([]ChapterListDto, error)
GetBookChapter(ctx context.Context, query GetBookChapterQuery) (GetBookChapterResult, error)
GetRandomBookID(ctx context.Context) (Nullable[int64], error)
GetPinnedBooks(ctx context.Context, input GetPinnedUserBooksQuery) (GetPinnedUserBooksResult, error)
GetBooksById(ctx context.Context, ids []int64) ([]BookListDto, error)
}
func NewBookService ¶
func NewBookService( db store.DBTX, tagsService TagsService, uploadService *UploadService, readingListService ReadingListService, reviewService ReviewsService, log *zap.SugaredLogger, adultContentService AdultContentService, ) BookService
type BookUserPermissions ¶
type BookUserPermissions struct {
CanEdit bool `json:"canEdit"`
}
type CensorMode ¶
type CensorMode store.CensorMode
type ChapterDto ¶
type ChapterDto struct {
ID int64 `json:"id,string"`
Name string `json:"name"`
Words int32 `json:"words"`
Content string `json:"content"`
CreatedAt time.Time `json:"createdAt"`
Order int32 `json:"order"`
Summary string `json:"summary"`
NextChapter Nullable[ChapterNextPrevDto] `json:"nextChapter"`
PrevChapter Nullable[ChapterNextPrevDto] `json:"prevChapter"`
BookID int64 `json:"bookId"`
CommentsCount int64 `json:"commentsCount"`
Fonts []string `json:"fonts"`
}
type ChapterListDto ¶
type ChapterNextPrevDto ¶
type CollectionBook2Dto ¶
type CollectionBookDto ¶
type CollectionDto ¶
type CollectionDto struct {
ID int64
Name string
Slug string
BooksCount int
LastUpdatedAt Nullable[time.Time]
UserID uuid.UUID
UserName string
IsPublic bool
Summary string
}
go2tsdef:generate
type CollectionService ¶
type CollectionService interface {
GetUserCollections(ctx context.Context, query GetUserCollectionsQuery) (GetUserCollectionsResult, error)
GetRecentUserCollections(ctx context.Context, query GetRecentCollectionsQuery) ([]CollectionDto, error)
CreateCollection(ctx context.Context, cmd CreateCollectionCommand) (int64, error)
UpdateCollection(ctx context.Context, cmd UpdateCollectionCommand) error
AddToCollections(ctx context.Context, cmd AddToCollectionsCommand) error
RemoveFromCollection(ctx context.Context, cmd RemoveFromCollectionCommand) error
GetBookCollections(ctx context.Context, query GetBookCollectionsQuery) ([]CollectionDto, error)
GetCollectionBooks(ctx context.Context, query GetCollectionBooksQuery) (GetCollectionBooksResult, error)
GetCollectionBooksMap(ctx context.Context, collections []CollectionDto) (map[int64][]CollectionBookDto, error)
GetCollection(ctx context.Context, id int64) (Nullable[CollectionDto], error)
DeleteCollection(ctx context.Context, cmd DeleteCollectionCommand) error
}
func NewCollectionsService ¶
func NewCollectionsService(db DB, tagsService TagsService, uploadService *UploadService, log *zap.SugaredLogger) CollectionService
type CommentDto ¶
type CommentDto struct {
ID int64 `json:"id,string"`
Content string `json:"content"`
User CommentUserDto `json:"user"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt Nullable[time.Time] `json:"updatedAt"`
LikedAt Nullable[time.Time] `json:"likedAt"`
Likes int64 `json:"likes"`
LikesUpdatedAt time.Time `json:"likesUpdatedAt"`
Subcomments int `json:"subcomments"`
Deleted bool `json:"deleted"`
}
go2tsdef:generate
func (CommentDto) RealLikesCount ¶
func (c CommentDto) RealLikesCount() int64
type CommentSort ¶
type CommentSort string
const ( CommentSortNewest CommentSort = "newest" CommentSortOldest CommentSort = "oldest" CommentSortPopular CommentSort = "popular" )
func ParseCommentSort ¶
func ParseCommentSort(value string) CommentSort
type CommentUserDto ¶
type CommentUserDto struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
Avatar string `json:"avatar"`
}
go2tsdef:generate
type CommentsService ¶
type CommentsService interface {
GetList(ctx context.Context, query GetCommentsQuery) (GetCommentsResult, error)
GetReplies(ctx context.Context, query GetCommentRepliesQuery) (GetCommentRepliesResult, error)
AddComment(ctx context.Context, command AddCommentCommand) (AddCommentResult, error)
UpdateComment(ctx context.Context, command UpdateCommentCommand) (UpdateCommentResult, error)
LikeComment(ctx context.Context, command LikeCommentCommand) (bool, error)
}
func NewCommentsService ¶
func NewCommentsService(db store.DBTX) CommentsService
type ContentModerationRepository ¶
type ContentModerationRepository interface {
SetChapterVisibilityAndLog(ctx context.Context, chapterID int64, visible bool, log ModerationAuditEntry) error
SetCommentRemovedAndLog(ctx context.Context, commentID int64, removed bool, log ModerationAuditEntry) error
SetUserBanAndLog(ctx context.Context, userID uuid.UUID, expiresAt time.Time, banned bool, log ModerationAuditEntry) error
RenameUserAndLog(ctx context.Context, userID uuid.UUID, name string, log ModerationAuditEntry) error
ChangeUserAboutAndLog(ctx context.Context, userID uuid.UUID, about string, log ModerationAuditEntry) error
}
ContentModerationRepository is the persistence port for application-level moderation. Every mutation must update its target and append its audit entry atomically in the generalized moderation log.
func NewContentModerationRepository ¶
func NewContentModerationRepository(db DB) ContentModerationRepository
type ContentModerationService ¶
type ContentModerationService interface {
HideChapter(context.Context, ModerateChapterCommand) error
RestoreChapter(context.Context, ModerateChapterCommand) error
RemoveComment(context.Context, ModerateCommentCommand) error
RestoreComment(context.Context, ModerateCommentCommand) error
BanUser(context.Context, BanUserCommand) error
PermanentlyBanUser(context.Context, BanUserCommand) error
UnbanUser(context.Context, BanUserCommand) error
RenameUser(context.Context, ModerateUserProfileCommand) error
ChangeUserAbout(context.Context, ModerateUserProfileCommand) error
}
func NewContentModerationService ¶
func NewContentModerationService(auth ModerationAuthorizer, repo ContentModerationRepository) ContentModerationService
type ContentPreferences ¶
type ContentPreferences struct {
Mode CensorMode
TagIDs []int64
Families map[int64]int64
// contains filtered or unexported fields
}
ContentPreferences is request-scoped. Management calls have no preferences. Matches are recorded for server-rendered blur controls, including fragments.
func ResolveContentPreferences ¶
func ResolveContentPreferences(ctx context.Context, queries *store.Queries, settings *UserModerationSettings) (*ContentPreferences, error)
type CreateBookChapterCommand_Result ¶
type CreateBookChapterCommand_Result struct {
ID int64
}
type CreateBookCommand ¶
type CreateCollectionCommand ¶
type CreateDraftCommand ¶
type CreateReportCommand ¶
type CreateSessionCommand ¶
type CreateTagsCommand ¶
type CreateTagsCommand = tags.CreateTagsCommand
type DefinedTagDto ¶
type DefinedTagDto = tags.DefinedTagDto
type DeleteCollectionCommand ¶
type DeleteDraftCommand ¶
type DeleteReviewCommand ¶
type DetailedBookSearchQuery ¶
type DetailedBookSearchQuery struct {
Query string `json:"query"`
Sort BookSearchSort `json:"sort"`
Words Int32Range `json:"words"`
Chapters Int32Range `json:"chapters"`
WordsPerChapter Int32Range `json:"wordsPerChapter"`
IncludeTags []DefinedTagDto `json:"includeTags"`
ExcludeTags []DefinedTagDto `json:"excludeTags"`
IncludeUsers []UserFromSearchRequestDto `json:"includeUsers"`
ExcludeUsers []UserFromSearchRequestDto `json:"excludeUsers"`
IncludeBanned bool `json:"includeBanned"`
IncludeHidden bool `json:"includeHidden"`
IncludeEmpty bool `json:"includeEmpty"`
Page uint32 `json:"page"`
PageSize uint `json:"pageSize"`
}
func (*DetailedBookSearchQuery) ActiveFilters ¶
func (d *DetailedBookSearchQuery) ActiveFilters() int
type DraftDto ¶
type DraftDto struct {
ID int64 `json:"id,string"`
ChapterName string `json:"chapterName"`
Content string `json:"content"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt Nullable[time.Time] `json:"updatedAt"`
ScheduledAt Nullable[time.Time] `json:"scheduledAt"`
CreatedBy struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
} `json:"createdBy"`
Book struct {
ID int64 `json:"id,string"`
Name string `json:"name"`
} `json:"book"`
Chapter struct {
ID int64 `json:"id,string"`
ContentUpdatedAt time.Time `json:"contentUpdatedAt"`
Fonts []string `json:"fonts"`
} `json:"chapter"`
IsChapterPubliclyAvailable bool `json:"isChapterPubliclyAvailable"`
}
go2tsdef:generate
type DraftPublishingService ¶
type DraftPublishingService struct {
// contains filtered or unexported fields
}
func NewDraftPublishingService ¶
func NewDraftPublishingService( db DB, reindex BookReindexService, lifecycle fx.Lifecycle, log *zap.SugaredLogger, ) *DraftPublishingService
type EmailVerificationStatus ¶
type GenericNotification ¶
type GetBookChapterQuery ¶
type GetBookChapterResult ¶
type GetBookChapterResult struct {
VisibilityReasons []string
Chapter ChapterDto
}
type GetBookChaptersQuery ¶
type GetBookCollectionsQuery ¶
type GetBookDraftsQuery ¶
type GetBookDraftsQuery struct {
Page int
}
type GetBookInfoQuery ¶
type GetBookLogQuery ¶
type GetBookQuery ¶
type GetBookReviewsDistributionResult ¶
type GetBookReviewsDistributionResult struct {
Distribution BookReviewsDistribution
}
type GetBookReviewsQuery ¶
type GetBookReviewsResult ¶
type GetBookReviewsResult struct {
Reviews []ReviewDto
Pagination PaginationOptions
}
type GetCollectionBooksQuery ¶
type GetCollectionBooksResult ¶
type GetCollectionBooksResult struct {
Books []CollectionBook2Dto
Page int32
TotalPages int32
PageSize int32
}
type GetCommentRepliesQuery ¶
type GetCommentRepliesResult ¶
type GetCommentRepliesResult struct {
Cursor uint32 `json:"cursor"`
NextCursor uint32 `json:"nextCursor"`
Comments []CommentDto `json:"comments"`
}
type GetCommentsQuery ¶
type GetCommentsResult ¶
type GetCommentsResult struct {
Cursor uint32
NextCursor uint32
Comments []CommentDto
Total int64
}
type GetDraftQuery ¶
type GetLatestDraftQuery ¶
type GetLoginHistoryQuery ¶
type GetModerationUserQuery ¶
type GetPinnedUserBooksQuery ¶
type GetPinnedUserBooksResult ¶
type GetPinnedUserBooksResult struct {
Books []BookListDto `json:"books"`
HasMore bool `json:"hasMore"`
}
type GetReadingListItemsQuery ¶
type GetReadingListItemsQuery struct {
UserID uuid.UUID
Limit uint32
Status ReadingListStatus
}
type GetReviewQuery ¶
type GetSetupDataResult ¶
type GetUserCollectionsQuery ¶
type GetUserCollectionsResult ¶
type GetUserCollectionsResult struct {
Collections []CollectionDto
TotalPages int32
Page int32
}
type GetUserDataQuery ¶
type GetUserDataQuery = userdata.GetUserDataQuery
type IPLocation ¶
type IPLocationService ¶
type IPLocationService interface {
Locate(context.Context, string) (IPLocation, error)
}
func NewIPLocationService ¶
func NewIPLocationService() IPLocationService
type Int32Range ¶
type Int64String ¶
type Int64String int64
go2tsdef:generate go2tsdef:override_type string
func (Int64String) MarshalJSON ¶
func (i Int64String) MarshalJSON() ([]byte, error)
func (*Int64String) UnmarshalJSON ¶
func (i *Int64String) UnmarshalJSON(b []byte) error
type LikeCommentCommand ¶
type ListTagsQuery ¶
type ListTagsQuery = tags.ListTagsQuery
type ListTagsResult ¶
type ListTagsResult = tags.ListTagsResult
type LoginHistoryEntry ¶
type LoginHistoryRepository ¶
type LoginHistoryRepository interface {
Search(context.Context, GetLoginHistoryQuery, int32, int32) ([]LoginHistoryEntry, int64, error)
RecentLocations(context.Context, uuid.UUID) ([]LoginLocation, error)
}
func NewLoginHistoryRepository ¶
func NewLoginHistoryRepository(db DB) LoginHistoryRepository
type LoginHistoryService ¶
type LoginHistoryService interface {
GetUserLoginHistory(context.Context, GetLoginHistoryQuery) (ModerationPage[LoginHistoryEntry], error)
GetRecentLoginLocations(context.Context, GetLoginHistoryQuery) ([]LoginLocation, error)
}
func NewLoginHistoryService ¶
func NewLoginHistoryService(auth ModerationAuthorizer, repo LoginHistoryRepository) LoginHistoryService
type LoginLocation ¶
type LoginLocation struct {
IPLocation
LastSeenAt time.Time
}
type ManagerBookChapterDetailsDto ¶
type ManagerBookChapterDetailsDto struct {
ID int64 `json:"id,string"`
Name string `json:"name"`
CreatedAt time.Time `json:"createdAt"`
Words int `json:"words"`
Summary string `json:"summary"`
Order int32 `json:"order"`
Content string `json:"content"`
IsPubliclyVisible bool `json:"isPubliclyVisible"`
Fonts []string `json:"fonts"`
}
type ManagerBookChapterDto ¶
type ManagerBookChapterDto struct {
ID int64 `json:"id,string"`
Name string `json:"name"`
CreatedAt time.Time `json:"createdAt"`
Words int `json:"words"`
Summary string `json:"summary"`
Order int32 `json:"order"`
IsPubliclyVisible bool `json:"isPubliclyVisible"`
DraftID Nullable[Int64String] `json:"draftId"`
ScheduledAt Nullable[time.Time] `json:"scheduledAt"`
}
go2tsdef:generate
type ManagerBookDetailsDto ¶
type ManagerBookDetailsDto struct {
ID int64 `json:"id,string"`
Name string `json:"name"`
AgeRating AgeRating `json:"ageRating"`
IsAdult bool `json:"adult"`
Tags []DefinedTagDto `json:"tags"`
Words int `json:"words"`
WordsPerChapter int `json:"wordsPerChapter"`
CreatedAt time.Time `json:"createdAt"`
Collections []BookCollectionDto `json:"collections"`
Chapters []ManagerBookChapterDto `json:"chapters"`
Author BookDetailsAuthorDto `json:"author"`
Summary string `json:"summary"`
IsPubliclyVisible bool `json:"isPubliclyVisible"`
IsBanned bool `json:"isBanned"`
Cover BookCover `json:"cover"`
}
go2tsdef:generate
type ManagerBookDto ¶
type ManagerBookDto struct {
ID int64 `json:"id,string"`
Slug string `json:"slug"`
Name string `json:"name"`
CreatedAt time.Time `json:"createdAt"`
AgeRating AgeRating `json:"ageRating"`
Tags []DefinedTagDto `json:"tags"`
Words int `json:"words"`
WordsPerChapter int `json:"wordsPerChapter"`
Chapters int `json:"chapters"`
Collections []BookCollectionDto `json:"collections"`
IsPubliclyVisible bool `json:"isPubliclyVisible"`
IsBanned bool `json:"isBanned"`
IsTrashed bool `json:"isTrashed"`
Summary string `json:"summary"`
Cover BookCover `json:"cover"`
Stats ManagerBookDto_Stats `json:"stats"`
}
go2tsdef:generate
type ManagerBookDto_Stats ¶
type ManagerBookDto_Stats struct {
Views analytics.MetricValues `json:"views"`
Reviews int32 `json:"reviews"`
Ratings int32 `json:"ratings"`
}
go2tsdef:generate
type ManagerGetBookChaptersQuery_Result ¶
type ManagerGetBookChaptersQuery_Result struct {
Chapters []ManagerBookChapterDto
}
type ManagerGetBookQuery ¶
type ManagerGetBookQuery_Result ¶
type ManagerGetBookQuery_Result struct {
Book ManagerBookDetailsDto
}
type ManagerGetChapterQuery ¶
type ManagerGetChapterQuery_Result ¶
type ManagerGetChapterQuery_Result struct {
Chapter ManagerBookChapterDetailsDto
}
type ManagerGetUserBooksQuery_Result ¶
type ManagerGetUserBooksQuery_Result struct {
Books []ManagerBookDto
TotalPages uint32
PageSize uint32
Page uint32
}
type MarkChapterCommand ¶
type ModerateChapterCommand ¶
type ModerateCommentCommand ¶
type ModerationAction ¶
type ModerationAction string
const ( ModerationActionHideChapter ModerationAction = "hide_chapter" ModerationActionRestoreChapter ModerationAction = "restore_chapter" ModerationActionRemoveComment ModerationAction = "remove_comment" ModerationActionRestoreComment ModerationAction = "restore_comment" ModerationActionBanUser ModerationAction = "ban_user" ModerationActionUnbanUser ModerationAction = "unban_user" ModerationActionRenameUser ModerationAction = "rename_user" ModerationActionChangeAbout ModerationAction = "change_user_about" )
type ModerationAuditEntry ¶
type ModerationAuditLogEntry ¶
type ModerationAuditLogQuery ¶
type ModerationAuditLogService ¶
type ModerationAuditLogService interface {
GetAuditLog(context.Context, ModerationAuditLogQuery) (ModerationPage[ModerationAuditLogEntry], error)
}
func NewModerationAuditLogService ¶
func NewModerationAuditLogService(db DB, auth ModerationAuthorizer) ModerationAuditLogService
type ModerationAuthorizer ¶
type ModerationAuthorizer interface {
AuthorizeModerator(ctx context.Context, actorUserID uuid.UUID) error
}
ModerationAuthorizer centralizes the role check shared by every moderation service. Keeping it in the application layer prevents controllers from being able to accidentally bypass authorization.
func NewModerationAuthorizer ¶
func NewModerationAuthorizer(users UserService) ModerationAuthorizer
type ModerationBookListEntry ¶
type ModerationBookService ¶
type ModerationBookService interface {
SearchBooks(ctx context.Context, query SearchModerationBooksQuery) (ModerationPage[ModerationBookListEntry], error)
GetBookInfo(ctx context.Context, query GetBookInfoQuery) (BookModerationInfo, error)
GetBookLog(ctx context.Context, query GetBookLogQuery) (BookLogResult, error)
GetBookChapters(ctx context.Context, query GetBookInfoQuery) ([]BookModerationChapter, error)
ChangeAgeRating(ctx context.Context, cmd ModerationPerformBookActionCommand) error
ChangeSummary(ctx context.Context, cmd ModerationPerformBookActionCommand) error
BanBook(ctx context.Context, cmd ModerationPerformBookActionCommand) error
ShadowBanBook(ctx context.Context, cmd ModerationPerformBookActionCommand) error
PermanentlyRemoveBook(ctx context.Context, cmd ModerationPerformBookActionCommand) error
UnBanBook(ctx context.Context, cmd ModerationPerformBookActionCommand) error
UnShadowBanBook(ctx context.Context, cmd ModerationPerformBookActionCommand) error
}
func NewModerationBookService ¶
func NewModerationBookService(db DB, auth ModerationAuthorizer) ModerationBookService
type ModerationPage ¶
type ModerationPerformBookActionCommand ¶
type ModerationPerformBookActionCommand struct {
Reason string
Value string
ActorUserID uuid.UUID
BookID int64
}
func (ModerationPerformBookActionCommand) Validate ¶
func (c ModerationPerformBookActionCommand) Validate() error
type ModerationReportBookContextData ¶
type ModerationReportBookContextData struct {
Title, Author, CoverID, Excerpt, Rating string
BookID int64
ChapterID Nullable[int64]
Chapter Nullable[string]
Warnings []string
IsPermanentlyRemoved, IsBanned, IsTrashed bool
IsPubliclyVisible bool
BookCreatedAt time.Time
ChapterCreatedAt, ChapterUpdatedAt Nullable[time.Time]
ChapterContentUpdatedAt Nullable[time.Time]
RelatedReports int
}
type ModerationReportDetail ¶
type ModerationReportDetail struct {
Report
ReporterUserName string
Status string
Priority string
Activities []ModerationReportActivity
BookContext *ModerationReportBookContext
UserContext *ModerationReportUserContextData
CommentContext *ModerationReportCommentContextData
AvailableActions []string
}
type ModerationReportService ¶
type ModerationReportService interface {
GetReport(context.Context, GetModerationReportQuery) (ModerationReportDetail, error)
SearchReports(context.Context, SearchModerationReportsQuery) (ModerationPage[ModerationReportListEntry], error)
DecideReport(context.Context, DecideModerationReportCommand) error
}
func NewModerationReportService ¶
func NewModerationReportService(auth ModerationAuthorizer, repo ReportRepository, uploads *UploadService, actions ReportActionExecutor) ModerationReportService
type ModerationUserBook ¶
type ModerationUserComment ¶
type ModerationUserInfo ¶
type ModerationUserListEntry ¶
type ModerationUserPageQuery ¶
type ModerationUserReport ¶
type ModerationUserRepository ¶
type ModerationUserRepository interface {
SearchUsers(context.Context, string, *uuid.UUID, string, string, int32, int32) ([]ModerationUserListEntry, int64, error)
GetUserInfo(context.Context, uuid.UUID) (ModerationUserInfo, error)
GetBooks(context.Context, uuid.UUID, int32, int32) ([]ModerationUserBook, error)
GetComments(context.Context, uuid.UUID, int32, int32) ([]ModerationUserComment, error)
GetHistory(context.Context, uuid.UUID, int32, int32) ([]ModerationUserHistoryEntry, int64, error)
GetReports(context.Context, uuid.UUID, int32, int32) ([]ModerationUserReport, int64, error)
CreateTemporaryRandomReports(context.Context, uuid.UUID, int) error
}
func NewModerationUserRepository ¶
func NewModerationUserRepository(db DB) ModerationUserRepository
type ModerationUserService ¶
type ModerationUserService interface {
SearchUsers(context.Context, ModerationUsersQuery) (ModerationPage[ModerationUserListEntry], error)
GetUserInfo(context.Context, GetModerationUserQuery) (ModerationUserInfo, error)
GetBooks(context.Context, ModerationUserPageQuery) (ModerationPage[ModerationUserBook], error)
GetComments(context.Context, ModerationUserPageQuery) (ModerationPage[ModerationUserComment], error)
GetHistory(context.Context, ModerationUserPageQuery) (ModerationPage[ModerationUserHistoryEntry], error)
GetReports(context.Context, ModerationUserPageQuery) (ModerationPage[ModerationUserReport], error)
}
func NewModerationUserService ¶
func NewModerationUserService(auth ModerationAuthorizer, repo ModerationUserRepository) ModerationUserService
type ModerationUsersQuery ¶
type NormalizedSearchRequest ¶
type NormalizedSearchRequest struct {
UserID Nullable[uuid.UUID]
Words Int32Range
Chapters Int32Range
WordsPerChapter Int32Range
Favorites Int32Range
IncludeTags []int64
ExcludeTags []int64
IncludeUsers []uuid.UUID
ExcludeUsers []uuid.UUID
IncludeBanned bool
IncludeHidden bool
IncludeEmpty bool
Limit uint
Offset uint
}
type Nullable ¶
func NullableFromPtr ¶
type PaginationOptions ¶
func (PaginationOptions) Limit ¶
func (opt PaginationOptions) Limit() int32
func (PaginationOptions) Offset ¶
func (opt PaginationOptions) Offset() int32
type PaginationRestrictions ¶
func (PaginationRestrictions) Validate ¶
func (r PaginationRestrictions) Validate(page, pageSize int32) PaginationOptions
type PublishDraftCommand ¶
type RatingAndReview ¶
type RatingAndReview struct {
Rating Nullable[RatingValue] `json:"rating"`
Review Nullable[ReviewDto] `json:"review"`
}
go2tsdef:generate
type RatingValue ¶
type RatingValue uint8
go2tsdef:generate
func CreateRatingValue ¶
func CreateRatingValue(v int16) RatingValue
func (RatingValue) MarshalJSON ¶
func (v RatingValue) MarshalJSON() ([]byte, error)
func (RatingValue) ToUint16 ¶
func (v RatingValue) ToUint16() int16
func (*RatingValue) UnmarshalJSON ¶
func (v *RatingValue) UnmarshalJSON(data []byte) error
type ReaderFont ¶
type ReaderFont = reader.ReaderFont
type ReaderFontService ¶
type ReaderFontService = reader.ReaderFontService
func NewReaderFontService ¶
func NewReaderFontService() ReaderFontService
type ReaderPreferences ¶
type ReaderPreferences = reader.ReaderPreferences
func DefaultReaderPreferences ¶
func DefaultReaderPreferences() ReaderPreferences
type ReaderPreferencesService ¶
type ReaderPreferencesService = reader.ReaderPreferencesService
func NewReaderPreferencesService ¶
func NewReaderPreferencesService(db DB, fonts ReaderFontService) ReaderPreferencesService
type ReadingListService ¶
type ReadingListService interface {
MarksAsWantToRead(ctx context.Context, userID uuid.UUID, bookID int64) error
MarkAsDnf(ctx context.Context, userID uuid.UUID, bookID int64) error
MarkAsRead(ctx context.Context, userID uuid.UUID, bookID int64) error
MarkAsPaused(ctx context.Context, userID uuid.UUID, bookID int64) error
MarkAsReading(ctx context.Context, userID uuid.UUID, bookID int64) error
MarkAsReadingWithChapterID(ctx context.Context, userID uuid.UUID, bookID int64, chapterID int64) error
GetStatus(ctx context.Context, userID uuid.UUID, bookID int64) (Nullable[BookReadingListDto], error)
GetReadingListBooks(ctx context.Context, query GetReadingListItemsQuery) ([]BookLibraryDto, error)
MarkChapterRead(ctx context.Context, command MarkChapterCommand) error
}
func NewReadingListService ¶
func NewReadingListService(db store.DBTX, uploadService *UploadService) ReadingListService
type ReadingListStatus ¶
type ReadingListStatus store.ReadingListStatus
go2tsdef:generate go2tsdef:override_type 'dnf' | 'reading' | 'paused' | 'read' | 'want_to_read'
const ( ReadingListStatusDnf ReadingListStatus = ReadingListStatus(store.ReadingListStatusDnf) ReadingListStatusPaused ReadingListStatus = ReadingListStatus(store.ReadingListStatusPaused) ReadingListStatusRead ReadingListStatus = ReadingListStatus(store.ReadingListStatusRead) ReadingListStatusReading ReadingListStatus = ReadingListStatus(store.ReadingListStatusReading) ReadingListStatusWantToRead ReadingListStatus = ReadingListStatus(store.ReadingListStatusWantToRead) )
type RenewSessionCommand ¶
type ReorderChaptersCommand ¶
type ReportActionExecutor ¶
type ReportActionExecutor interface {
Execute(context.Context, Report, DecideModerationReportCommand) error
AvailableActions(Report) []string
}
func NewReportActionExecutor ¶
func NewReportActionExecutor(books ModerationBookService, content ContentModerationService) ReportActionExecutor
type ReportDecision ¶
type ReportRepository ¶
type ReportRepository interface {
TargetExists(context.Context, ReportTargetType, string) (bool, error)
BookChapterExists(context.Context, int64, int64) (bool, error)
Create(context.Context, Report) (Report, error)
GetByID(context.Context, int64) (Report, string, error)
GetBookContext(context.Context, int64) (*ModerationReportBookContextData, error)
GetUserContext(context.Context, int64) (*ModerationReportUserContextData, error)
GetCommentContext(context.Context, int64) (*ModerationReportCommentContextData, error)
Search(context.Context, string, string, int32, int32) ([]ModerationReportListEntry, int64, error)
GetEvents(context.Context, int64) ([]ReportDecision, error)
AddDecision(context.Context, int64, string, ReportDecision) error
}
func NewReportRepository ¶
func NewReportRepository(db DB) ReportRepository
type ReportService ¶
type ReportService interface {
Create(context.Context, CreateReportCommand) (Report, error)
GetReasons(ReportTargetType) ([]string, error)
}
func NewReportService ¶
func NewReportService(repo ReportRepository) ReportService
type ReportTargetType ¶
type ReportTargetType string
const ( ReportTargetUser ReportTargetType = "user" ReportTargetBook ReportTargetType = "book" ReportTargetComment ReportTargetType = "comment" )
type ReviewDto ¶
type ReviewDto struct {
User ReviewUserDto `json:"user"`
Rating RatingValue `json:"rating"`
Content string `json:"content"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt Nullable[time.Time] `json:"updatedAt"`
Likes int32 `json:"likes"`
}
go2tsdef:generate
type ReviewUserDto ¶
type ReviewUserDto struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
Avatar string `json:"avatar"`
}
go2tsdef:generate
type ReviewsService ¶
type ReviewsService interface {
GetBookReviewsDistribution(ctx context.Context, bookID int64) (GetBookReviewsDistributionResult, error)
GetBookReviews(ctx context.Context, query GetBookReviewsQuery) (GetBookReviewsResult, error)
UpdateReview(ctx context.Context, cmd UpdateReviewCommand) (ReviewDto, error)
UpdateRating(ctx context.Context, cmd UpdateRatingCommand) error
GetReview(ctx context.Context, query GetReviewQuery) (RatingAndReview, error)
DeleteReview(ctx context.Context, cmd DeleteReviewCommand) error
}
func NewCachedReviewsService ¶
func NewCachedReviewsService(inner ReviewsService, cache *cache.Cache, log *zap.SugaredLogger) ReviewsService
func NewReviewsService ¶
func NewReviewsService(db DB, userService UserService, backgroundService BookRecalculationIngest) ReviewsService
type ScheduleDraftCommand ¶
type SearchService ¶
type SearchService interface {
SearchBooks(ctx context.Context, req BookSearchQuery) (*BookSearchResult, error)
GetBookExtremes(ctx context.Context) (*BookExtremes, error)
ExplainSearchQuery(ctx context.Context, req BookSearchQuery) (DetailedBookSearchQuery, error)
}
func NewCachedSearchService ¶
func NewCachedSearchService(inner SearchService, cache *cache.Cache) SearchService
func NewSearchService ¶
func NewSearchService(db store.DBTX, tagsService TagsService, uploadService *UploadService, userService UserService, osClient *opensearchapi.Client, log *zap.SugaredLogger) SearchService
type SearchUserBooksQuery ¶
type SearchUserBooksResult ¶
type SearchUserBooksResult struct {
}
type SelfUserDto ¶
type SelfUserDto struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Role UserRole `json:"role"`
Avatar struct {
LG string `json:"lg"`
MD string `json:"md"`
} `json:"avatar"`
JoinedAt time.Time `json:"joinedAt"`
IsBanned bool `json:"isBanned"`
IsEmailVerified bool `json:"isEmailVerified"`
PreferredTheme string `json:"preferredTheme"`
}
type SessionInfo ¶
type SessionInfo struct {
ID int64 `json:"id"`
SID string `json:"sid"`
CreatedAt time.Time `json:"createdAt"`
ExpiresAt time.Time `json:"expiresAt"`
UserID uuid.UUID `json:"userId"`
UserAgent string `json:"userAgent"`
IpAddress string `json:"ipAddr"`
Location IPLocation `json:"location"`
UserName string `json:"userName"`
UserJoinedAt time.Time `json:"userJoinedAt"`
UserRole UserRole `json:"userRole"`
}
type SessionPublicInfo ¶
type SessionPublicInfo struct {
ID int64 `json:"id,string"`
UserAgent UserAgentInfo `json:"userAgent"`
IpAddress string `json:"ipAddress"`
Location IPLocation `json:"location"`
CreatedAt time.Time `json:"createdAt"`
ExpiresAt time.Time `json:"expiresAt"`
}
func NewSessionPublicInfo ¶
func NewSessionPublicInfo(session SessionInfo) SessionPublicInfo
func SessionPublicInfoArray ¶
func SessionPublicInfoArray(sessions []SessionInfo) []SessionPublicInfo
type SessionService ¶
type SessionService interface {
GetBySID(ctx context.Context, sessionID string) (*SessionInfo, error)
Create(ctx context.Context, command CreateSessionCommand) (*SessionInfo, error)
GetByUserID(ctx context.Context, userID uuid.UUID) ([]SessionInfo, error)
TerminateBySID(ctx context.Context, sessionID string) error
TerminateAllByUserID(ctx context.Context, userID uuid.UUID) error
Renew(ctx context.Context, command RenewSessionCommand) (*SessionInfo, error)
}
func NewCachedSessionService ¶
func NewCachedSessionService(inner SessionService, cache *cache.Cache) SessionService
func NewSessionService ¶
func NewSessionService(db DB, ipLocations IPLocationService) SessionService
type SetUserDataQuery ¶
type SetUserDataQuery = userdata.SetUserDataQuery
type SetupCommand ¶
type SetupService ¶
type SetupService interface {
IsSetup() (bool, error)
Setup(ctx context.Context, command SetupCommand) error
GetSetupState() (GetSetupDataResult, error)
}
func NewSetupService ¶
func NewSetupService(db DB, config siteconfig.Store) SetupService
type SignInCommand ¶
type SignInResult ¶
type SignUpCommand ¶
type SignUpResult ¶
type SignUpService ¶
type SignUpService interface {
SignUp(ctx context.Context, cmd SignUpCommand) (SignUpResult, error)
VerifyEmail(ctx context.Context, cmd VerifyEmailCommand) error
SendEmailVerification(ctx context.Context, cmd SendEmailVerificationCommand) (SendEmailVerificationResult, error)
GetEmailVerificationStatus(ctx context.Context, userID uuid.UUID) (EmailVerificationStatus, error)
}
func NewSignUpService ¶
func NewSignUpService(db DB, cfg *koanf.Koanf, siteConfig siteconfig.Store, emailService email.Service) SignUpService
type TagDescriptor ¶
type TagDescriptor = tags.TagDescriptor
type TagDetailsItemDto ¶
type TagDetailsItemDto = tags.TagDetailsItemDto
type TagsCategory ¶
type TagsCategory = tags.TagsCategory
func TagsCategoryFromName ¶
func TagsCategoryFromName(name string) TagsCategory
type TagsService ¶
type TagsService = tags.TagsService
func NewTagsService ¶
func NewTagsService(db store.DBTX) TagsService
type TrashBookCommand ¶
type UntrashBookCommand ¶
type UpdateBookChapterOrdersCommand ¶
type UpdateBookChapterOrdersCommand struct {
BookID int64
Modifications []ChapterOrderModification
}
type UpdateBookCommand ¶
type UpdateCollectionCommand ¶
type UpdateCommentCommand ¶
func (*UpdateCommentCommand) Validate ¶
func (c *UpdateCommentCommand) Validate() error
type UpdateCommentResult ¶
type UpdateCommentResult struct {
Comment CommentDto
}
type UpdateDraftCommand ¶
type UpdateRatingCommand ¶
type UpdateRatingCommand struct {
BookID int64
UserID uuid.UUID
Rating RatingValue
}
type UpdateReviewCommand ¶
type UpdateReviewCommand struct {
BookID int64
UserID uuid.UUID
Rating RatingValue
Content string
}
type UpdateTagCommand ¶
type UpdateTagCommand = tags.UpdateTagCommand
type UpdateUserCommand ¶
type UploadBookCoverCommand ¶
type UploadBookCoverCommand_Result ¶
type UploadBookCoverCommand_Result struct {
URL BookCover
}
type UploadConfig ¶
type UploadConfig = upload.UploadConfig
type UploadService ¶
type UploadService = upload.UploadService
func NewUploadService ¶
func NewUploadService(cfg UploadConfig) *UploadService
func NewUploadServiceFromApplicationConfig ¶
func NewUploadServiceFromApplicationConfig(cfg *koanf.Koanf) *UploadService
type UploadURI ¶
func ParseUploadURI ¶
type UploadURIType ¶
type UploadURIType = upload.UploadURIType
type UserAboutDto ¶
type UserAboutSettings ¶
type UserAgentInfo ¶
type UserDataService ¶
type UserDataService = userdata.UserDataService
func NewUserDataService ¶
func NewUserDataService(db DB) UserDataService
type UserDetailsDto ¶
type UserDetailsDto struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Avatar struct {
LG string `json:"lg"`
MD string `json:"md"`
} `json:"avatar"`
JoinedAt time.Time `json:"joinedAt"`
IsBanned bool `json:"isBanned"`
Role UserRole `json:"role"`
HasCustomTheme bool `json:"hasCustomTheme"`
About UserAboutDto `json:"about"`
Followers int32 `json:"followers"`
Following int32 `json:"following"`
BooksTotal int32 `json:"booksTotal"`
HideEmail bool `json:"hideEmail"`
HideStats bool `json:"hideStats"`
HideFavorites bool `json:"hideFavorites"`
IsFollowing bool `json:"isFollowing"`
}
type UserListResponse ¶
type UserListResponse struct {
Users []UserSearchItem `json:"users"`
Total int32 `json:"total"`
Page uint32 `json:"page"`
TotalPages int32 `json:"totalPages"`
}
type UserModerationSettings ¶
type UserModerationSettings struct {
ShowAdultContent bool `json:"showAdultContent"`
CensoredTags []string `json:"censoredTags"`
CensoredTagsMode CensorMode `json:"censoredTagsMode"`
}
type UserPrivacySettings ¶
type UserSearchItem ¶
type UserService ¶
type UserService interface {
GetUserPrivacySettings(ctx context.Context, userID uuid.UUID) (*UserPrivacySettings, error)
GetUserModerationSettings(ctx context.Context, userID uuid.UUID) (*UserModerationSettings, error)
GetUserCustomizationSettings(ctx context.Context, userID uuid.UUID) (*UserCustomizationSetting, error)
GetUserAboutSettings(ctx context.Context, userID uuid.UUID) (*UserAboutSettings, error)
UpdateUserPrivacySettings(ctx context.Context, userID uuid.UUID, settings UserPrivacySettings) error
UpdateUserModerationSettings(ctx context.Context, userID uuid.UUID, settings UserModerationSettings) error
UpdateUserCustomizationSettings(ctx context.Context, userID uuid.UUID, settings UserCustomizationSetting) error
UpdateUserAboutSettings(ctx context.Context, userID uuid.UUID, settings UserAboutSettings) error
UpdateUser(ctx context.Context, cmd UpdateUserCommand) error
GetUserDetails(ctx context.Context, query GetUserQuery) (*UserDetailsDto, error)
GetUserSelfData(ctx context.Context, userID uuid.UUID) (*SelfUserDto, error)
FollowUser(ctx context.Context, cmd FollowUserCommand) error
UnfollowUser(ctx context.Context, cmd UnfollowUserCommand) error
ListUsers(ctx context.Context, req UsersQuery) (UserListResponse, error)
}
func NewUserService ¶
func NewUserService(db DB) UserService
type UsersQuery ¶
type VerifyEmailCommand ¶
Source Files
¶
- adult_content.go
- age_rating.go
- app_version.go
- auth.go
- auth_impl.go
- book.go
- book_authorization.go
- book_background_service.go
- book_cover.go
- book_impl.go
- book_manager.go
- book_manager_impl.go
- book_search_reindex.go
- book_search_reindex_impl.go
- book_validations.go
- censored_tags.go
- collections.go
- collections_impl.go
- comments.go
- comments_impl.go
- cron.go
- db_abstraction.go
- draft_publishing_service.go
- fx.go
- global_feature_flags.go
- id.go
- id_generator.go
- ip_location.go
- login_history_repository.go
- moderation.go
- moderation_audit.go
- moderation_book.go
- moderation_book_impl.go
- moderation_report.go
- moderation_report_actions.go
- moderation_repository.go
- moderation_user.go
- moderation_user_repository.go
- notifications.go
- opensearch.go
- otel.go
- password_hashing.go
- reader_compat.go
- reading_list.go
- reading_list_impl.go
- reports.go
- reports_repository.go
- reviews.cached.go
- reviews.go
- reviews.impl.go
- search.go
- search_backend_impl.go
- search_impl.go
- search_impl_cached.go
- session.go
- session_impl.go
- session_impl_cached.go
- setup.go
- setup_impl.go
- signup.go
- signup_impl.go
- slug.go
- tags_aggregator.go
- tags_compat.go
- upload_compat.go
- user.go
- user_impl.go
- userdata_compat.go
- utils.go
- utils_pagination.go