Documentation ¶
Index ¶
- type AdminService
- type AttachmentService
- type AuthenticateService
- type BackupService
- type BackupType
- type BaseCommentService
- type BaseMFAService
- type BasePostService
- type CategoryService
- type ClientOptionService
- type EmailService
- type ExportImport
- type InstallService
- type JournalCommentService
- type JournalService
- type LinkService
- type LogService
- type MenuService
- type MetaService
- type OneTimeTokenService
- type OptionService
- type PhotoService
- type PostCategoryService
- type PostCommentService
- type PostService
- type PostTagService
- type SheetCommentService
- type SheetService
- type StatisticService
- type TagService
- type ThemeService
- type TwoFactorTOTPMFAService
- type UserService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminService ¶
type AdminService interface { Authenticate(ctx context.Context, loginParam param.LoginParam) (*entity.User, error) Auth(ctx context.Context, loginParam param.LoginParam) (*dto.AuthTokenDTO, error) ClearToken(ctx context.Context) error SendResetPasswordCode(ctx context.Context, resetParam param.ResetPasswordParam) error RefreshToken(ctx context.Context, refreshToken string) (*dto.AuthTokenDTO, error) GetEnvironments(ctx context.Context) *dto.EnvironmentDTO GetLogFiles(ctx context.Context, lines int64) (string, error) }
type AttachmentService ¶
type AttachmentService interface { Page(ctx context.Context, queryParam *param.AttachmentQuery) ([]*entity.Attachment, int64, error) GetAttachment(ctx context.Context, attachmentID int32) (*entity.Attachment, error) Upload(ctx context.Context, fileHeader *multipart.FileHeader) (*dto.AttachmentDTO, error) Delete(ctx context.Context, attachmentID int32) (*entity.Attachment, error) DeleteBatch(ctx context.Context, ids []int32) ([]*entity.Attachment, error) Update(ctx context.Context, id int32, updateParam *param.AttachmentUpdate) (*entity.Attachment, error) GetAllMediaTypes(ctx context.Context) ([]string, error) GetAllTypes(ctx context.Context) ([]consts.AttachmentType, error) ConvertToDTO(ctx context.Context, attachment *entity.Attachment) (*dto.AttachmentDTO, error) ConvertToDTOs(ctx context.Context, attachments []*entity.Attachment) ([]*dto.AttachmentDTO, error) }
type AuthenticateService ¶
type BackupService ¶
type BackupService interface { // GetBackup Get backup data by backup file name. GetBackup(ctx context.Context, filename string, backupType BackupType) (*dto.BackupDTO, error) // BackupWholeSite Zips work directory BackupWholeSite(ctx context.Context, toBackupItems []string) (*dto.BackupDTO, error) // ListFiles list all files under path ListFiles(ctx context.Context, path string, backupType BackupType) ([]*dto.BackupDTO, error) // GetBackupFilePath get filepath and check if the file exist GetBackupFilePath(ctx context.Context, path string, filename string) (string, error) // DeleteFile delete file DeleteFile(ctx context.Context, path string, filename string) error // ExportData export database data to json file ExportData(ctx context.Context) (*dto.BackupDTO, error) // ImportMarkdown import markdown file as post ImportMarkdown(ctx context.Context, fileHeader *multipart.FileHeader) error // ExportMarkdown export posts to markdown files ExportMarkdown(ctx context.Context, needFrontMatter bool) (*dto.BackupDTO, error) ListToBackupItems(ctx context.Context) ([]string, error) }
type BackupType ¶
type BackupType string
const ( WholeSite BackupType = "/api/admin/backups/work-dir" JSONData BackupType = "/api/admin/backups/data" Markdown BackupType = "/api/admin/backups/markdown/export" )
type BaseCommentService ¶
type BaseCommentService interface { CreateBy(ctx context.Context, commentParam *param.Comment) (*entity.Comment, error) Page(ctx context.Context, commentQuery param.CommentQuery, commentType consts.CommentType) ([]*entity.Comment, int64, error) GetByID(ctx context.Context, commentID int32) (*entity.Comment, error) LGetByIDs(ctx context.Context, commentIDs []int32) ([]*entity.Comment, error) GetByContentID(ctx context.Context, contentID int32, contentType consts.CommentType, sort *param.Sort) ([]*entity.Comment, error) Create(ctx context.Context, comment *entity.Comment) (*entity.Comment, error) UpdateStatus(ctx context.Context, commentID int32, commentStatus consts.CommentStatus) (*entity.Comment, error) UpdateStatusBatch(ctx context.Context, commentIDs []int32, commentStatus consts.CommentStatus) ([]*entity.Comment, error) Delete(ctx context.Context, commentID int32) error DeleteBatch(ctx context.Context, commentIDs []int32) error Update(ctx context.Context, comment *entity.Comment) (*entity.Comment, error) BuildAvatarURL(ctx context.Context, gravatarMD5 string, gravatarSource, gravatarDefault *string) (string, error) ConvertParam(commentParam *param.Comment) *entity.Comment CountByContentID(ctx context.Context, contentID int32, commentType consts.CommentType, status consts.CommentStatus) (int64, error) CountByStatusAndContentIDs(ctx context.Context, status consts.CommentStatus, contentIDs []int32) (map[int32]int64, error) CountChildren(ctx context.Context, parentCommentIDs []int32) (map[int32]int64, error) GetChildren(ctx context.Context, parentCommentID int32, contentID int32, commentType consts.CommentType) ([]*entity.Comment, error) }
type BaseMFAService ¶
type BasePostService ¶
type BasePostService interface { GetByStatus(ctx context.Context, status []consts.PostStatus, postType consts.PostType, sort *param.Sort) ([]*entity.Post, error) GetByPostID(ctx context.Context, postID int32) (*entity.Post, error) GetByPostIDs(ctx context.Context, postIDs []int32) (map[int32]*entity.Post, error) GetBySlug(ctx context.Context, slug string) (*entity.Post, error) GenerateSummary(ctx context.Context, htmlContent string) string BuildFullPath(ctx context.Context, post *entity.Post) (string, error) Delete(ctx context.Context, postID int32) error DeleteBatch(ctx context.Context, postIDs []int32) error UpdateDraftContent(ctx context.Context, postID int32, content, originalContent string) (*entity.Post, error) UpdateStatus(ctx context.Context, postID int32, status consts.PostStatus) (*entity.Post, error) UpdateStatusBatch(ctx context.Context, status consts.PostStatus, postIDs []int32) ([]*entity.Post, error) CreateOrUpdate(ctx context.Context, post *entity.Post, categoryIDs, tagIDs []int32, metas []param.Meta) (*entity.Post, error) IncreaseVisit(ctx context.Context, postID int32) }
type CategoryService ¶
type CategoryService interface { GetByID(ctx context.Context, id int32) (*entity.Category, error) GetBySlug(ctx context.Context, slug string) (*entity.Category, error) GetByName(ctx context.Context, name string) (*entity.Category, error) ListCategoryWithPostCountDTO(ctx context.Context, sort *param.Sort) ([]*dto.CategoryWithPostCount, error) ListAll(ctx context.Context, sort *param.Sort) ([]*entity.Category, error) ConvertToCategoryDTO(ctx context.Context, e *entity.Category) (*dto.CategoryDTO, error) ConvertToCategoryDTOs(ctx context.Context, categories []*entity.Category) ([]*dto.CategoryDTO, error) ListAsTree(ctx context.Context, sort *param.Sort, fillPassword bool) ([]*vo.CategoryVO, error) Create(ctx context.Context, categoryParam *param.Category) (*entity.Category, error) Update(ctx context.Context, categoryParam *param.Category) (*entity.Category, error) UpdateBatch(ctx context.Context, categoryParams []*param.Category) ([]*entity.Category, error) Delete(ctx context.Context, categoryID int32) error ListByIDs(ctx context.Context, categoryIDs []int32) ([]*entity.Category, error) IsCategoriesEncrypt(ctx context.Context, categoryIDs ...int32) (bool, error) Count(ctx context.Context) (int64, error) GetChildCategory(ctx context.Context, parentCategoryID int32) ([]*entity.Category, error) }
type ClientOptionService ¶
type ClientOptionService interface { OptionService }
type EmailService ¶
type ExportImport ¶ added in v1.0.5
type InstallService ¶
type JournalCommentService ¶
type JournalCommentService interface { BaseCommentService CountByStatusAndJournalID(ctx context.Context, status consts.CommentStatus, journalIDs []int32) (map[int32]int64, error) UpdateBy(ctx context.Context, commentID int32, commentParam *param.Comment) (*entity.Comment, error) CountByStatus(ctx context.Context, status consts.CommentStatus) (int64, error) }
type JournalService ¶
type JournalService interface { Page(ctx context.Context, page param.Page, sort *param.Sort) ([]*entity.Journal, int64, error) ListJournal(ctx context.Context, journalQuery param.JournalQuery) ([]*entity.Journal, int64, error) ConvertToDTO(journal *entity.Journal) *dto.Journal ConvertToWithCommentDTOList(ctx context.Context, journals []*entity.Journal) ([]*dto.JournalWithComment, error) Create(ctx context.Context, journalParam *param.Journal) (*entity.Journal, error) Update(ctx context.Context, journalID int32, journalParam *param.Journal) (*entity.Journal, error) Delete(ctx context.Context, journalID int32) error GetByJournalIDs(ctx context.Context, journalIDs []int32) (map[int32]*entity.Journal, error) Count(ctx context.Context) (int64, error) IncreaseLike(ctx context.Context, journalID int32) error }
type LinkService ¶
type LinkService interface { List(ctx context.Context, sort *param.Sort) ([]*entity.Link, error) GetByID(ctx context.Context, id int32) (*entity.Link, error) Create(ctx context.Context, linkParam *param.Link) (*entity.Link, error) Update(ctx context.Context, id int32, linkParam *param.Link) (*entity.Link, error) Delete(ctx context.Context, id int32) error ConvertToDTO(ctx context.Context, link *entity.Link) *dto.Link ConvertToDTOs(ctx context.Context, links []*entity.Link) []*dto.Link ConvertToLinkTeamVO(ctx context.Context, links []*entity.Link) []*vo.LinkTeamVO ListTeams(ctx context.Context) ([]string, error) Count(ctx context.Context) (int64, error) }
type LogService ¶
type MenuService ¶
type MenuService interface { List(ctx context.Context, sort *param.Sort) ([]*entity.Menu, error) ListByTeam(ctx context.Context, team string, sort *param.Sort) ([]*entity.Menu, error) ListAsTree(ctx context.Context, sort *param.Sort) ([]*vo.Menu, error) ListAsTreeByTeam(ctx context.Context, team string, sort *param.Sort) ([]*vo.Menu, error) GetByID(ctx context.Context, id int32) (*entity.Menu, error) Create(ctx context.Context, menuParam *param.Menu) (*entity.Menu, error) CreateBatch(ctx context.Context, menuParams []*param.Menu) ([]*entity.Menu, error) Update(ctx context.Context, id int32, menuParam *param.Menu) (*entity.Menu, error) UpdateBatch(ctx context.Context, menuParams []*param.Menu) ([]*entity.Menu, error) Delete(ctx context.Context, id int32) error DeleteBatch(ctx context.Context, ids []int32) error ConvertToDTO(ctx context.Context, menu *entity.Menu) *dto.Menu ConvertToDTOs(ctx context.Context, menus []*entity.Menu) []*dto.Menu ListTeams(ctx context.Context) ([]string, error) GetMenuCount(ctx context.Context) (int64, error) }
type MetaService ¶
type OneTimeTokenService ¶
type OptionService ¶
type OptionService interface { GetOrByDefaultWithErr(ctx context.Context, p property.Property, defaultValue interface{}) (interface{}, error) GetOrByDefault(ctx context.Context, p property.Property) interface{} GetBlogBaseURL(ctx context.Context) (string, error) IsEnabledAbsolutePath(ctx context.Context) (bool, error) GetPathSuffix(ctx context.Context) (string, error) GetArchivePrefix(ctx context.Context) (string, error) Save(ctx context.Context, optionMap map[string]string) error ListAllOption(ctx context.Context) ([]*dto.Option, error) GetLinksPrefix(ctx context.Context) (string, error) GetPhotoPrefix(ctx context.Context) (string, error) GetJournalPrefix(ctx context.Context) (string, error) GetActivatedThemeID(ctx context.Context) (string, error) GetPostPermalinkType(ctx context.Context) (consts.PostPermalinkType, error) GetSheetPermalinkType(ctx context.Context) (consts.SheetPermaLinkType, error) GetIndexPageSize(ctx context.Context) int GetPostSort(ctx context.Context) param.Sort GetPostSummaryLength(ctx context.Context) int GetCategoryPrefix(ctx context.Context) (string, error) GetTagPrefix(ctx context.Context) (string, error) GetLinkPrefix(ctx context.Context) (string, error) GetSheetPrefix(ctx context.Context) (string, error) GetAttachmentType(ctx context.Context) consts.AttachmentType }
type PhotoService ¶
type PhotoService interface { List(ctx context.Context, sort *param.Sort) ([]*entity.Photo, error) Page(ctx context.Context, page param.Page, sort *param.Sort) ([]*entity.Photo, int64, error) GetByID(ctx context.Context, id int32) (*entity.Photo, error) Create(ctx context.Context, photoParam *param.Photo) (*entity.Photo, error) Update(ctx context.Context, id int32, photoParam *param.Photo) (*entity.Photo, error) Delete(ctx context.Context, id int32) error ConvertToDTO(ctx context.Context, photo *entity.Photo) *dto.Photo ConvertToDTOs(ctx context.Context, photos []*entity.Photo) []*dto.Photo ListTeams(ctx context.Context) ([]string, error) ListByTeam(ctx context.Context, team string, sort *param.Sort) ([]*entity.Photo, error) IncreaseLike(ctx context.Context, id int32) error GetPhotoCount(ctx context.Context) (int64, error) }
type PostCategoryService ¶
type PostCategoryService interface { ListByCategoryID(ctx context.Context, categoryID int32, status consts.PostStatus) ([]*entity.Post, error) ListByPostIDs(ctx context.Context, postIDs []int32) ([]*entity.PostCategory, error) ListCategoryMapByPostID(ctx context.Context, postIDs []int32) (map[int32][]*entity.Category, error) ListCategoryByPostID(ctx context.Context, postID int32) ([]*entity.Category, error) }
type PostCommentService ¶
type PostCommentService interface { BaseCommentService CreateBy(ctx context.Context, commentParam *param.Comment) (*entity.Comment, error) CountByStatus(ctx context.Context, status consts.CommentStatus) (int64, error) UpdateBy(ctx context.Context, commentID int32, commentParam *param.Comment) (*entity.Comment, error) }
type PostService ¶
type PostService interface { BasePostService Page(ctx context.Context, postQuery param.PostQuery) ([]*entity.Post, int64, error) IncreaseLike(ctx context.Context, postID int32) error GetPrevPosts(ctx context.Context, post *entity.Post, size int) ([]*entity.Post, error) GetNextPosts(ctx context.Context, post *entity.Post, size int) ([]*entity.Post, error) Create(ctx context.Context, postParam *param.Post) (*entity.Post, error) Update(ctx context.Context, postID int32, postParam *param.Post) (*entity.Post, error) CountByStatus(ctx context.Context, status consts.PostStatus) (int64, error) CountVisit(ctx context.Context) (int64, error) Preview(ctx context.Context, postID int32) (string, error) CountLike(ctx context.Context) (int64, error) }
type PostTagService ¶
type PostTagService interface { PagePost(ctx context.Context, postQuery param.PostQuery) ([]*entity.Post, int64, error) ListTagMapByPostID(ctx context.Context, postIDs []int32) (map[int32][]*entity.Tag, error) ListTagByPostID(ctx context.Context, postID int32) ([]*entity.Tag, error) ListAllTagWithPostCount(ctx context.Context, sort *param.Sort) ([]*dto.TagWithPostCount, error) ListPostByTagID(ctx context.Context, tagID int32, status consts.PostStatus) ([]*entity.Post, error) }
type SheetCommentService ¶
type SheetCommentService interface { BaseCommentService CountByStatus(ctx context.Context, status consts.CommentStatus) (int64, error) }
type SheetService ¶
type SheetService interface { BasePostService Page(ctx context.Context, page param.Page, sort *param.Sort) ([]*entity.Post, int64, error) Create(ctx context.Context, sheetParam *param.Sheet) (*entity.Post, error) Update(ctx context.Context, sheetID int32, sheetParam *param.Sheet) (*entity.Post, error) Preview(ctx context.Context, sheetID int32) (string, error) CountVisit(ctx context.Context) (int64, error) CountLike(ctx context.Context) (int64, error) ListIndependentSheets(ctx context.Context) ([]*dto.IndependentSheet, error) }
type StatisticService ¶
type TagService ¶
type TagService interface { ListAll(ctx context.Context, sort *param.Sort) ([]*entity.Tag, error) ListByIDs(ctx context.Context, tagIDs []int32) ([]*entity.Tag, error) GetByID(ctx context.Context, id int32) (*entity.Tag, error) GetBySlug(ctx context.Context, slug string) (*entity.Tag, error) GetByName(ctx context.Context, name string) (*entity.Tag, error) ConvertToDTO(ctx context.Context, tag *entity.Tag) (*dto.Tag, error) ConvertToDTOs(ctx context.Context, tags []*entity.Tag) ([]*dto.Tag, error) Create(ctx context.Context, tagParam *param.Tag) (*entity.Tag, error) Update(ctx context.Context, id int32, tagParam *param.Tag) (*entity.Tag, error) Delete(ctx context.Context, id int32) error CountAllTag(ctx context.Context) (int64, error) }
type ThemeService ¶
type ThemeService interface { GetThemeByID(ctx context.Context, themeID string) (*dto.ThemeProperty, error) GetActivateTheme(ctx context.Context) (*dto.ThemeProperty, error) ListAllTheme(ctx context.Context) ([]*dto.ThemeProperty, error) ListThemeFiles(ctx context.Context, themeID string) ([]*dto.ThemeFile, error) GetThemeFileContent(ctx context.Context, themeID, absPath string) (string, error) UpdateThemeFile(ctx context.Context, themeID, absPath, content string) error ListCustomTemplates(ctx context.Context, themeID, prefix string) ([]string, error) ActivateTheme(ctx context.Context, themeID string) (*dto.ThemeProperty, error) GetThemeConfig(ctx context.Context, themeID string) ([]*dto.ThemeConfigGroup, error) GetThemeSettingMap(ctx context.Context, themeID string) (map[string]interface{}, error) GetThemeGroupSettingMap(ctx context.Context, themeID, group string) (map[string]interface{}, error) SaveThemeSettings(ctx context.Context, themeID string, settings map[string]interface{}) error DeleteThemeSettings(ctx context.Context, themeID string) error DeleteTheme(ctx context.Context, themeID string, deleteSettings bool) error UploadTheme(ctx context.Context, file *multipart.FileHeader) (*dto.ThemeProperty, error) UpdateThemeByUpload(ctx context.Context, themeID string, file *multipart.FileHeader) (*dto.ThemeProperty, error) ReloadTheme(ctx context.Context) error TemplateExist(ctx context.Context, template string) (bool, error) Render(ctx context.Context, name string) (string, error) }
type TwoFactorTOTPMFAService ¶
type UserService ¶
type UserService interface { GetAllUser(ctx context.Context) ([]*entity.User, error) GetByEmail(ctx context.Context, email string) (*entity.User, error) ConvertToDTO(ctx context.Context, user *entity.User) *dto.User GetByUsername(ctx context.Context, username string) (*entity.User, error) MustNotExpire(ctx context.Context, expireTime *time.Time) error PasswordMatch(ctx context.Context, hashedPassword, plainPassword string) bool GetByID(ctx context.Context, id int32) (*entity.User, error) CreateByParam(ctx context.Context, userParam param.User) (*entity.User, error) Update(ctx context.Context, userParam *param.User) (*entity.User, error) UpdatePassword(ctx context.Context, oldPassword string, newPassword string) error UpdateMFA(ctx context.Context, mfaKey string, mfaType consts.MFAType, mfaCode string) error EncryptPassword(ctx context.Context, plainPassword string) string }
Source Files ¶
- admin.go
- attachment.go
- authenticate.go
- backup.go
- base_post.go
- category.go
- comment_base.go
- comment_journal.go
- comment_post.go
- comment_sheet.go
- email.go
- export_import.go
- install.go
- journal.go
- link.go
- log.go
- menu.go
- meta.go
- mfa.go
- onetime_token.go
- option.go
- photo.go
- post.go
- post_category.go
- post_tag.go
- sheet.go
- statistic.go
- tag.go
- theme.go
- user.go
Click to show internal directories.
Click to hide internal directories.