Documentation ¶
Index ¶
- Constants
- Variables
- type ArticleCreateRequest
- type ArticleCreateResponse
- type ArticleDetail
- type ArticleListRequest
- type ArticleListResponse
- type ArticleUpdateRequest
- type DashboardData
- type KnowledgeCreateRequest
- type KnowledgeInfo
- type KnowledgeItemCreateRequest
- type KnowledgeItemCreateResponse
- type KnowledgeItemDetail
- type KnowledgeItemInfo
- type KnowledgeItemUpdateContentRequest
- type KnowledgeItemUpdateContentResponse
- type KnowledgeItemUpdateInfoRequest
- type KnowledgeList
- type KnowledgeUpdateRequest
- type ListTheme
- type LoginRequest
- type MediaDetail
- type MediaInfo
- type MediaList
- type MediaListRequest
- type MediaListResponse
- type MediaUpdateRequest
- type MediaUploadResponse
- type OptionListResponse
- type OptionUpdateRequest
- type PageCreateRequest
- type PageCreateResponse
- type PageDetail
- type PageListRequest
- type PageListResponse
- type PageUpdateRequest
- type PostInfo
- type PostList
- type Service
- func (svc *Service) CheckKnowledgeType(knowledgeType string) bool
- func (svc Service) CheckPageSlugExist(pageID uint64, slug string) bool
- func (svc Service) CheckSubjectNameExist(subjectID uint64, name string) bool
- func (svc Service) CheckTaxonomyNameExist(name, taxonomy string) bool
- func (svc *Service) CleanCacheAfterEditArticle(articleID uint64)
- func (svc *Service) CleanCacheAfterEditPage(pageID uint64)
- func (svc *Service) CleanCacheAfterUpdateKnowledge(slug string)
- func (svc *Service) CleanCacheAfterUpdateKnowledgeItemContent(kiSymbol uint64)
- func (svc *Service) CleanCacheKnowledgeItemList(kID uint64)
- func (svc Service) CreateArticle(r *ArticleCreateRequest, userID uint64) (*ArticleCreateResponse, error)
- func (svc *Service) CreateKnowledge(r *KnowledgeCreateRequest) error
- func (svc *Service) CreateKnowledgeItem(r *KnowledgeItemCreateRequest, userID uint64) (*KnowledgeItemCreateResponse, error)
- func (svc Service) CreatePage(r *PageCreateRequest, userID uint64) (*PageCreateResponse, error)
- func (svc Service) CreateSubject(r *SubjectCreateRequest) error
- func (svc Service) CreateTaxonomy(r *TaxonomyCreateRequest) error
- func (svc Service) CreateUser(u *UserCreateRequest) (string, string, error)
- func (svc *Service) DeleteCache(key string)
- func (svc *Service) DeleteKnowledgeItem(kItemID uint64) error
- func (svc Service) DeleteMedia(userID uint64) error
- func (svc Service) DeletePost(postType string, articleID uint64) error
- func (svc Service) DeleteSubject(subjectID uint64) error
- func (svc Service) DeleteTaxonomy(termID uint64, taxonomyType string) error
- func (svc Service) DeleteUser(userID int) error
- func (svc Service) GetArticleDetail(articleID uint64) (*ArticleDetail, error)
- func (svc Service) GetArticleSubjectID(articleID uint64) ([]uint64, error)
- func (svc Service) GetDashboardStatisticsData() (*DashboardData, error)
- func (svc Service) GetDefaultOptionNamesByType(settingType string) []string
- func (svc *Service) GetKnowledgeInfo(kID uint64) (*KnowledgeInfo, error)
- func (svc *Service) GetKnowledgeItemInfo(kiID int) (*KnowledgeItemDetail, error)
- func (svc *Service) GetKnowledgeItemList(kID int) ([]*KnowledgeItemInfo, error)
- func (svc *Service) GetKnowledgeList() (map[string][]*KnowledgeInfo, error)
- func (svc Service) GetMediaByID(ID uint64) (*model.Media, error)
- func (svc Service) GetMediaDetail(ID uint64) (*MediaDetail, error)
- func (svc Service) GetOptionsByType(settingType string) (map[string]string, error)
- func (svc Service) GetPageDetail(pageID uint64) (*PageDetail, error)
- func (svc Service) GetSubjectInfo(subjectID uint64) (*SubjectDetail, error)
- func (svc Service) GetSubjectList() ([]*SubjectTreeNode, error)
- func (svc Service) GetTaxonomyInfo(termID uint64) (*TermInfo, error)
- func (svc Service) GetTaxonomyList(taxonomyType string) (taxonomyTree []*TreeNode, err error)
- func (svc Service) GetTaxonomyTree(allTermTaxonomy []*model.TermTaxonomy, pid uint64) []*TreeNode
- func (svc Service) GetUser(username string) (*UserInfo, error)
- func (svc Service) GetUserByToken(t string) (*UserInfo, error)
- func (svc Service) IfTaxonomyHasChild(termID uint64, taxonomyType string) (bool, error)
- func (svc Service) ListArticle(postType string, r *ArticleListRequest) ([]*PostInfo, int64, error)
- func (svc Service) ListMedia(limit, page int) ([]*MediaInfo, int64, error)
- func (svc Service) ListOption(settingType string) (*OptionListResponse, error)
- func (svc Service) ListPage(postType string, r *PageListRequest) ([]*PostInfo, int64, error)
- func (svc Service) ListPost(postType, title string, page, number int, sort, status string) ([]*PostInfo, int64, error)
- func (svc Service) ListUser(username, role string, number, page, status int) ([]*UserInfo, int64, error)
- func (svc *Service) LoginAuth(c *gin.Context, username string, password string) (*Token, error)
- func (svc Service) RestorePost(postID uint64) error
- func (svc Service) TrashPost(postID uint64) error
- func (svc *Service) UpdateArticle(a *ArticleUpdateRequest) error
- func (svc Service) UpdateKnowledge(r *KnowledgeUpdateRequest) error
- func (svc *Service) UpdateKnowledgeItemContent(cr *KnowledgeItemUpdateContentRequest, kItemID uint64) (*KnowledgeItemUpdateContentResponse, error)
- func (svc *Service) UpdateKnowledgeItemInfo(ir *KnowledgeItemUpdateInfoRequest, kItemID uint64) error
- func (svc Service) UpdateMedia(r *MediaUpdateRequest, userID int) (err error)
- func (svc Service) UpdateOptions(options map[string]interface{}) error
- func (svc *Service) UpdatePage(p *PageUpdateRequest) (err error)
- func (svc Service) UpdateSubject(r *SubjectUpdateRequest) error
- func (svc Service) UpdateTaxonomy(r *TaxonomyUpdateRequest, termID uint64) error
- func (svc Service) UpdateUser(u *UserUpdateRequest, userID int) error
- func (svc Service) UpdateUserAvatar(c *gin.Context, userID string, file *multipart.FileHeader) error
- func (svc Service) UpdateUserPassword(u *UserUpdatePasswordRequest, userID int) error
- func (svc Service) UpdateUserStatus(u *UserUpdateStatusRequest, userID int) error
- func (svc Service) UploadMedia(c *gin.Context, userID, usage string, file *multipart.FileHeader) (ID uint64, GUID string, err error)
- type SubjectCreateRequest
- type SubjectDetail
- type SubjectTreeNode
- type SubjectUpdateRequest
- type TaxonomyCreateRequest
- type TaxonomyUpdateRequest
- type TermInfo
- type Token
- type TreeNode
- type UserCreateRequest
- type UserCreateResponse
- type UserInfo
- type UserList
- type UserListRequest
- type UserListResponse
- type UserUpdatePasswordRequest
- type UserUpdateRequest
- type UserUpdateStatusRequest
Constants ¶
const ( // KnowledgeItemUpdateTypeSave update type of 'save', only save current version content KnowledgeItemUpdateTypeSave = "save" // KnowledgeItemUpdateTypePublish update type of 'publish', publish will set now version as the published version KnowledgeItemUpdateTypePublish = "publish" )
Variables ¶
var OptionNamesMap = map[string][]string{
"general": {
"blog_name",
"blog_description",
"site_url",
"admin_email",
"users_can_register",
"timezone_string",
"site_language",
},
"property": {
"site_description",
"site_keywords",
"footer_copyright",
},
"menu": {},
"theme": {
"current_theme",
},
"output": {
"show_on_front",
"show_on_front_page",
"posts_per_page",
},
"pubic-account": {},
"github": {},
"discuss": {
"article_comment_status",
"page_comment_status",
"comment_need_register",
"show_comment_page",
"comment_per_page",
"comment_page_first",
"comment_page_top",
"comment_before_show",
"show_avatar",
},
"media": {
"image_thumbnail_width",
"image_thumbnail_height",
"image_medium_width",
"image_medium_height",
"image_large_width",
"image_large_height",
},
"reading": {
"open_XML",
},
"writing": {
"default_category",
"default_link_category",
},
}
OptionNamesMap option keys for those setting type
var OptionSettingTypeMap = []string{
"general",
"property",
"menu",
"theme",
"output",
"pubic-account",
"github",
"discuss",
"media",
"reading",
"writing",
}
OptionSettingTypeMap option setting type that support
Functions ¶
This section is empty.
Types ¶
type ArticleCreateRequest ¶
type ArticleCreateRequest struct { Status string `json:"status"` Title string `json:"title"` Content string `json:"content"` ContentHTML string `json:"content_html"` Description string `json:"description"` CommentStatus uint64 `json:"comment_status"` CoverPicture string `json:"cover_picture"` PostedTime string `json:"posted_time"` IfTop uint64 `json:"if_top"` Category []uint64 `json:"category"` Tag []uint64 `json:"tag"` Subject []uint64 `json:"subject"` }
ArticleCreateRequest struct of article create params
type ArticleCreateResponse ¶
ArticleCreateResponse return the new article id and url
type ArticleDetail ¶
type ArticleDetail struct { ID uint64 `json:"id"` Title string `json:"title"` ContentMarkdown string `json:"content_markdown"` Status string `json:"status"` CommentStatus uint64 `json:"comment_status"` IfTop uint64 `json:"if_top"` GUID string `json:"guid"` CoverPicture string `json:"cover_picture"` PostDate string `json:"post_date"` MetaData map[string]interface{} `json:"meta_date"` Category []uint64 `json:"category"` Tag []uint64 `json:"tag"` Subject []uint64 `json:"subject"` }
ArticleDetail struct for article info detail
type ArticleListRequest ¶
type ArticleListRequest struct { Title string `form:"title"` Page int `form:"page"` Number int `form:"number"` Sort string `form:"sort"` Status string `form:"status"` }
ArticleListRequest is the article list request struct
type ArticleListResponse ¶
type ArticleListResponse struct { TotalCount int64 `json:"totalCount"` TotalPage uint64 `json:"totalPage"` ArticleList []*PostInfo `json:"articleList"` }
ArticleListResponse is the article list response struct
type ArticleUpdateRequest ¶
type ArticleUpdateRequest struct { ID uint64 `json:"id"` Status string `json:"status"` Title string `json:"title"` Content string `json:"content"` ContentHTML string `json:"content_html"` Description string `json:"description"` CommentStatus uint64 `json:"comment_status"` CoverPicture string `json:"cover_picture"` PostedTime string `json:"posted_time"` IfTop uint64 `json:"if_top"` Category []uint64 `json:"category"` Tag []uint64 `json:"tag"` Subject []uint64 `json:"subject"` }
ArticleUpdateRequest struct for update article
type DashboardData ¶
type DashboardData struct { TotalViews int64 TotalComments int64 TotalArticles int64 TotalMedia int64 }
DashboardData some statistics index
type KnowledgeCreateRequest ¶ added in v0.4.0
type KnowledgeCreateRequest struct { Name string `json:"name"` Slug string `json:"slug"` Type string `json:"type"` Description string `json:"description"` CoverImage uint64 `json:"cover_image"` }
KnowledgeCreateRequest struct bind to create knowledge
type KnowledgeInfo ¶ added in v0.4.0
type KnowledgeInfo struct { ID uint64 `json:"id"` Name string `json:"name"` Slug string `json:"slug"` Description string `json:"description"` CoverImageID uint64 `json:"cover_image_id"` CoverImageName string `json:"cover_image_name"` CoverImageURL string `json:"cover_image_url"` LastUpdated string `json:"last_updated"` CreatedTime string `json:"created_time"` }
KnowledgeInfo struct of knowledge list for output
type KnowledgeItemCreateRequest ¶ added in v0.4.0
type KnowledgeItemCreateRequest struct { CreateType string `json:"create_type" binding:"required,oneof=doc note"` KnowledgeID uint64 `json:"knowledge_id"` Title string `json:"title"` ParentID uint64 `json:"parent_id"` }
KnowledgeItemCreateRequest struct for binding knowledge item create
type KnowledgeItemCreateResponse ¶ added in v0.4.0
type KnowledgeItemCreateResponse struct { ID uint64 `json:"knowledge_item_id"` Title string `json:"title"` ParentID uint64 `json:"parent_id"` Level uint64 `json:"level"` Index int64 `json:"index"` Content string `json:"content"` Version uint64 `json:"version"` VersionStatus uint8 `json:"version_status"` }
KnowledgeItemCreateResponse struct for return after created knowledge item
type KnowledgeItemDetail ¶ added in v0.4.0
type KnowledgeItemDetail struct { ID uint64 `json:"knowledge_item_id"` Title string `json:"title"` Content string `json:"content"` ContentStatus uint8 `json:"content_status"` ContentPublishedVersion uint64 `json:"content_published_version"` ContentNowVersion uint64 `json:"content_now_version,string"` ContentUpdatedTime string `json:"content_updated_time"` }
KnowledgeItemDetail knowledge detail info include content
type KnowledgeItemInfo ¶ added in v0.4.0
type KnowledgeItemInfo struct { ID uint64 `json:"knowledge_item_id"` Title string `json:"title"` ParentID uint64 `json:"parent_id"` Level uint64 `json:"level"` Index int64 `json:"index"` Children []*KnowledgeItemInfo `json:"children"` }
KnowledgeItemInfo knowledge info for list tree
type KnowledgeItemUpdateContentRequest ¶ added in v0.4.0
type KnowledgeItemUpdateContentRequest struct { ID uint64 `json:"knowledge_item_id" binding:"required"` EditType string `json:"edit_type" binding:"required,oneof=doc note"` // doc or note SaveType string `json:"save_type" binding:"required,oneof=save publish"` // save or publish Content string `json:"content" binding:"required"` Version string `json:"version" binding:"required"` }
KnowledgeItemUpdateContentRequest struct bind to update knowledge item content
type KnowledgeItemUpdateContentResponse ¶ added in v0.4.0
type KnowledgeItemUpdateContentResponse struct { ID uint64 `json:"knowledge_item_id"` Version uint64 `json:"version,string"` }
KnowledgeItemUpdateContentResponse update knowledge item content response
type KnowledgeItemUpdateInfoRequest ¶ added in v0.4.0
type KnowledgeItemUpdateInfoRequest struct { ID uint64 `json:"knowledge_item_id" binding:"required"` Title string `json:"title" binding:"required"` NodeChange bool `json:"node_change"` ParentID uint64 `json:"parent_id"` IndexChange string `json:"index_change"` IndexRelatedNode uint64 `json:"index_related_node"` }
KnowledgeItemUpdateInfoRequest struct bind to update knowledge item info
type KnowledgeList ¶ added in v0.4.0
type KnowledgeList struct { Lock *sync.Mutex TypeMap map[string][]*KnowledgeInfo }
KnowledgeList knowledge list
type KnowledgeUpdateRequest ¶ added in v0.4.0
type KnowledgeUpdateRequest struct { ID uint64 `json:"id"` Name string `json:"name"` Slug string `json:"slug"` Type string `json:"type"` Description string `json:"description"` CoverImage uint64 `json:"cover_image"` }
KnowledgeUpdateRequest struct bind to update knowledge
type LoginRequest ¶
type LoginRequest struct { Username string `json:"username" binding:"required"` Password string `json:"password" binding:"required"` }
LoginRequest is the login request params struct
type MediaDetail ¶
type MediaDetail struct { MediaInfo Slug string `json:"slug"` Description string `json:"description"` }
MediaDetail media info in detail inclue Mediainfo struct
type MediaInfo ¶
type MediaInfo struct { ID uint64 `json:"id"` Title string `json:"title"` GUID string `json:"url"` Type string `json:"type"` UploadTime string `json:"upload_time"` }
MediaInfo is the media struct for media list
type MediaListRequest ¶
MediaListRequest is the media list request struct
type MediaListResponse ¶
type MediaListResponse struct { TotalCount int64 `json:"totalCount"` MediaList []*MediaInfo `json:"mediaList"` }
MediaListResponse returns total number of media and current page of media
type MediaUpdateRequest ¶
type MediaUpdateRequest struct { ID uint64 `json:"id"` Title string `json:"title"` Slug string `json:"slug"` Description string `json:"description"` }
MediaUpdateRequest is the update media request params struct
type MediaUploadResponse ¶
MediaUploadResponse is the upload media request's response struct
type OptionListResponse ¶
type OptionListResponse struct { Options map[string]string `json:"options"` ExtraData interface{} `json:"extraData"` }
OptionListResponse option list and extra data if exist
type OptionUpdateRequest ¶
type OptionUpdateRequest struct {
Params map[string]interface{}
}
OptionUpdateRequest update request include params which are dynamitly
type PageCreateRequest ¶
type PageCreateRequest struct { Status string `json:"status"` Title string `json:"title"` Content string `json:"content"` ContentHTML string `json:"content_html"` Description string `json:"description"` CommentStatus uint64 `json:"comment_status"` CoverPicture string `json:"cover_picture"` PostedTime string `json:"posted_time"` Slug string `json:"slug"` PageTemplate string `json:"page_template"` ParentID uint64 `json:"parent_id"` }
PageCreateRequest struct of page create params
type PageCreateResponse ¶
PageCreateResponse return the new page id and url
type PageDetail ¶
type PageDetail struct { ID uint64 `json:"id"` Title string `json:"title"` ContentMarkdown string `json:"content_markdown"` Slug string `json:"slug"` ParentID uint64 `json:"parent_id"` Status string `json:"status"` CommentStatus uint64 `json:"comment_status"` GUID string `json:"guid"` CoverPicture string `json:"cover_picture"` PostDate string `json:"post_date"` MetaData map[string]interface{} `json:"meta_date"` }
PageDetail struct for page info detail
type PageListRequest ¶
type PageListRequest struct { Title string `form:"title"` Page int `form:"page"` Number int `form:"number"` Sort string `form:"sort"` Status string `form:"status"` }
PageListRequest is the page list request struct
type PageListResponse ¶
type PageListResponse struct { TotalCount int64 `json:"totalCount"` TotalPage uint64 `json:"totalPage"` PageList []*PostInfo `json:"pageList"` }
PageListResponse is the page list response struct
type PageUpdateRequest ¶
type PageUpdateRequest struct { ID uint64 `json:"id"` Status string `json:"status"` Title string `json:"title"` Content string `json:"content"` ContentHTML string `json:"content_html"` Description string `json:"description"` CommentStatus uint64 `json:"comment_status"` CoverPicture string `json:"cover_picture"` PostedTime string `json:"posted_time"` Slug string `json:"slug"` PageTemplate string `json:"page_template"` ParentID uint64 `json:"parent_id"` }
PageUpdateRequest struct of page update params
type PostInfo ¶
type PostInfo struct { ID uint64 `json:"id"` UserID uint64 `json:"userId"` Title string `json:"title"` Status string `json:"status"` PostDate string `json:"post_date"` CommentCount uint64 `json:"comment_count"` ViewCount uint64 `json:"view_count"` }
PostInfo is post info for post list
type Service ¶ added in v0.4.1
type Service struct {
// contains filtered or unexported fields
}
Service service layer's service
func (*Service) CheckKnowledgeType ¶ added in v0.4.1
CheckKnowledgeType check knowledge type
func (Service) CheckPageSlugExist ¶ added in v0.4.1
CheckPageSlugExist check if page slug name exist
func (Service) CheckSubjectNameExist ¶ added in v0.4.1
CheckSubjectNameExist check the subject name
func (Service) CheckTaxonomyNameExist ¶ added in v0.4.1
CheckTaxonomyNameExist check if taxonomy name are aleady exist
func (*Service) CleanCacheAfterEditArticle ¶ added in v0.4.1
CleanCacheAfterEditArticle clean cache after update article
func (*Service) CleanCacheAfterEditPage ¶ added in v0.4.1
CleanCacheAfterEditPage clean cache after update page
func (*Service) CleanCacheAfterUpdateKnowledge ¶ added in v0.4.1
CleanCacheAfterUpdateKnowledge clean cache after update knowledge info
func (*Service) CleanCacheAfterUpdateKnowledgeItemContent ¶ added in v0.4.1
CleanCacheAfterUpdateKnowledgeItemContent clean cache after update knowledge item content
func (*Service) CleanCacheKnowledgeItemList ¶ added in v0.4.1
CleanCacheKnowledgeItemList clean cache of knowledge item list
func (Service) CreateArticle ¶ added in v0.4.1
func (svc Service) CreateArticle(r *ArticleCreateRequest, userID uint64) (*ArticleCreateResponse, error)
CreateArticle create article
func (*Service) CreateKnowledge ¶ added in v0.4.1
func (svc *Service) CreateKnowledge(r *KnowledgeCreateRequest) error
CreateKnowledge create knowledge base
func (*Service) CreateKnowledgeItem ¶ added in v0.4.1
func (svc *Service) CreateKnowledgeItem(r *KnowledgeItemCreateRequest, userID uint64) (*KnowledgeItemCreateResponse, error)
CreateKnowledgeItem create knowledge item
func (Service) CreatePage ¶ added in v0.4.1
func (svc Service) CreatePage(r *PageCreateRequest, userID uint64) (*PageCreateResponse, error)
CreatePage create page
func (Service) CreateSubject ¶ added in v0.4.1
func (svc Service) CreateSubject(r *SubjectCreateRequest) error
CreateSubject create a subject
func (Service) CreateTaxonomy ¶ added in v0.4.1
func (svc Service) CreateTaxonomy(r *TaxonomyCreateRequest) error
CreateTaxonomy create term taxonomy
func (Service) CreateUser ¶ added in v0.4.1
func (svc Service) CreateUser(u *UserCreateRequest) (string, string, error)
CreateUser create a new user
func (*Service) DeleteCache ¶ added in v0.4.1
DeleteCache delete cache by key during service engine
func (*Service) DeleteKnowledgeItem ¶ added in v0.4.1
DeleteKnowledgeItem delete knowledge item Note: content will not be deleted
func (Service) DeleteMedia ¶ added in v0.4.1
DeleteMedia delete media
func (Service) DeletePost ¶ added in v0.4.1
DeletePost delete post by soft delete Note: meta data was reserved
func (Service) DeleteSubject ¶ added in v0.4.1
DeleteSubject delete subject directly
func (Service) DeleteTaxonomy ¶ added in v0.4.1
DeleteTaxonomy delete term directly
func (Service) DeleteUser ¶ added in v0.4.1
DeleteUser delete user by ID
func (Service) GetArticleDetail ¶ added in v0.4.1
func (svc Service) GetArticleDetail(articleID uint64) (*ArticleDetail, error)
GetArticleDetail get article detail by id
func (Service) GetArticleSubjectID ¶ added in v0.4.1
GetArticleSubjectID get article's subject by article id
func (Service) GetDashboardStatisticsData ¶ added in v0.4.1
func (svc Service) GetDashboardStatisticsData() (*DashboardData, error)
GetDashboardStatisticsData get dashboard statistics data TODO store in cache first
func (Service) GetDefaultOptionNamesByType ¶ added in v0.4.1
GetDefaultOptionNamesByType get default setting's option name
func (*Service) GetKnowledgeInfo ¶ added in v0.4.1
func (svc *Service) GetKnowledgeInfo(kID uint64) (*KnowledgeInfo, error)
GetKnowledgeInfo get knowledge info by knowledge ID
func (*Service) GetKnowledgeItemInfo ¶ added in v0.4.1
func (svc *Service) GetKnowledgeItemInfo(kiID int) (*KnowledgeItemDetail, error)
GetKnowledgeItemInfo get knowledge item info
func (*Service) GetKnowledgeItemList ¶ added in v0.4.1
func (svc *Service) GetKnowledgeItemList(kID int) ([]*KnowledgeItemInfo, error)
GetKnowledgeItemList get knowledge item list as a tree
func (*Service) GetKnowledgeList ¶ added in v0.4.1
func (svc *Service) GetKnowledgeList() (map[string][]*KnowledgeInfo, error)
GetKnowledgeList get knowledge base list
func (Service) GetMediaByID ¶ added in v0.4.1
GetMediaByID get media by ID
func (Service) GetMediaDetail ¶ added in v0.4.1
func (svc Service) GetMediaDetail(ID uint64) (*MediaDetail, error)
GetMediaDetail return media info if database select success
func (Service) GetOptionsByType ¶ added in v0.4.1
GetOptionsByType get default options by setting type
func (Service) GetPageDetail ¶ added in v0.4.1
func (svc Service) GetPageDetail(pageID uint64) (*PageDetail, error)
GetPageDetail get page detail by id
func (Service) GetSubjectInfo ¶ added in v0.4.1
func (svc Service) GetSubjectInfo(subjectID uint64) (*SubjectDetail, error)
GetSubjectInfo get subject detail by id
func (Service) GetSubjectList ¶ added in v0.4.1
func (svc Service) GetSubjectList() ([]*SubjectTreeNode, error)
GetSubjectList get subject list by tree struct
func (Service) GetTaxonomyInfo ¶ added in v0.4.1
GetTaxonomyInfo get term info by term_id
func (Service) GetTaxonomyList ¶ added in v0.4.1
GetTaxonomyList get taxonomy tree by type and return a tree structure
func (Service) GetTaxonomyTree ¶ added in v0.4.1
func (svc Service) GetTaxonomyTree(allTermTaxonomy []*model.TermTaxonomy, pid uint64) []*TreeNode
GetTaxonomyTree return a taxonomy tree
func (Service) GetUserByToken ¶ added in v0.4.1
GetUserByToken get userInfo by token(JWT)
func (Service) IfTaxonomyHasChild ¶ added in v0.4.1
IfTaxonomyHasChild check the taxonomy has children or not
func (Service) ListArticle ¶ added in v0.4.1
ListArticle article list
func (Service) ListMedia ¶ added in v0.4.1
ListMedia returns current page media list and the total number of media
func (Service) ListOption ¶ added in v0.4.1
func (svc Service) ListOption(settingType string) (*OptionListResponse, error)
ListOption get option list by setting type
func (Service) ListPost ¶ added in v0.4.1
func (svc Service) ListPost(postType, title string, page, number int, sort, status string) ([]*PostInfo, int64, error)
ListPost post list
func (Service) ListUser ¶ added in v0.4.1
func (svc Service) ListUser(username, role string, number, page, status int) ([]*UserInfo, int64, error)
ListUser show the user list in page
func (Service) RestorePost ¶ added in v0.4.1
RestorePost restore the post which had been put to the trash this restore action will set the post as a draft status
func (Service) TrashPost ¶ added in v0.4.1
TrashPost put the post into the trash by "delete" button The different between DeleteArticle and TrashPost is that TrashPost just set the status to deleted
func (*Service) UpdateArticle ¶ added in v0.4.1
func (svc *Service) UpdateArticle(a *ArticleUpdateRequest) error
UpdateArticle update article TODO: In this version, article meta data just update description, it should be more than one choise.
func (Service) UpdateKnowledge ¶ added in v0.4.1
func (svc Service) UpdateKnowledge(r *KnowledgeUpdateRequest) error
UpdateKnowledge update knowledge base info
func (*Service) UpdateKnowledgeItemContent ¶ added in v0.4.1
func (svc *Service) UpdateKnowledgeItemContent(cr *KnowledgeItemUpdateContentRequest, kItemID uint64) (*KnowledgeItemUpdateContentResponse, error)
UpdateKnowledgeItemContent update knowledge item content
func (*Service) UpdateKnowledgeItemInfo ¶ added in v0.4.1
func (svc *Service) UpdateKnowledgeItemInfo(ir *KnowledgeItemUpdateInfoRequest, kItemID uint64) error
UpdateKnowledgeItemInfo update knowledge item info
func (Service) UpdateMedia ¶ added in v0.4.1
func (svc Service) UpdateMedia(r *MediaUpdateRequest, userID int) (err error)
UpdateMedia update media info
func (Service) UpdateOptions ¶ added in v0.4.1
UpdateOptions update options
func (*Service) UpdatePage ¶ added in v0.4.1
func (svc *Service) UpdatePage(p *PageUpdateRequest) (err error)
UpdatePage update page
func (Service) UpdateSubject ¶ added in v0.4.1
func (svc Service) UpdateSubject(r *SubjectUpdateRequest) error
UpdateSubject update subject info
func (Service) UpdateTaxonomy ¶ added in v0.4.1
func (svc Service) UpdateTaxonomy(r *TaxonomyUpdateRequest, termID uint64) error
UpdateTaxonomy update term and term taxonomy
func (Service) UpdateUser ¶ added in v0.4.1
func (svc Service) UpdateUser(u *UserUpdateRequest, userID int) error
UpdateUser update user info by id
func (Service) UpdateUserAvatar ¶ added in v0.4.1
func (svc Service) UpdateUserAvatar(c *gin.Context, userID string, file *multipart.FileHeader) error
UpdateUserAvatar update user avatar
func (Service) UpdateUserPassword ¶ added in v0.4.1
func (svc Service) UpdateUserPassword(u *UserUpdatePasswordRequest, userID int) error
UpdateUserPassword just reset user's password
func (Service) UpdateUserStatus ¶ added in v0.4.1
func (svc Service) UpdateUserStatus(u *UserUpdateStatusRequest, userID int) error
UpdateUserStatus update user status
type SubjectCreateRequest ¶
type SubjectCreateRequest struct { Name string `json:"name"` Slug string `json:"slug"` ParentID uint64 `json:"parent_id"` CoverImage uint64 `json:"cover_image"` Description string `json:"description"` }
SubjectCreateRequest struct bind to create subject
type SubjectDetail ¶
type SubjectDetail struct { ID uint64 `json:"id"` ParentID uint64 `json:"parent_id"` Name string `json:"name"` Slug string `json:"slug"` Description string `json:"description"` CoverImage uint64 `json:"cover_image"` CoverImageStatus string `json:"cover_image_status"` CoverURL string `json:"cover_url"` }
SubjectDetail subject info
type SubjectTreeNode ¶
type SubjectTreeNode struct { ID uint64 `json:"id"` ParentID uint64 `json:"parent_id"` Name string `json:"name"` Slug string `json:"slug"` Description string `json:"description"` Count uint64 `json:"count"` LastUpdated string `json:"last_updated"` Children []*SubjectTreeNode `json:"children"` }
SubjectTreeNode tree struct of subject list
type SubjectUpdateRequest ¶
type SubjectUpdateRequest struct { ID uint64 `json:"ID"` Name string `json:"name"` Slug string `json:"slug"` ParentID uint64 `json:"parent_id"` CoverImage uint64 `json:"cover_image"` Description string `json:"description"` }
SubjectUpdateRequest struct bind to update subject
type TaxonomyCreateRequest ¶
type TaxonomyCreateRequest struct { Name string `json:"name"` Slug string `json:"slug"` Description string `json:"description"` ParentID uint64 `json:"parentId"` Taxonomy string `json:"taxonomy"` // category or tag }
TaxonomyCreateRequest struct to crate taxonomy include category and tag
type TaxonomyUpdateRequest ¶
type TaxonomyUpdateRequest struct { ID uint64 `json:"id"` Name string `json:"name"` Slug string `json:"slug"` Description string `json:"description"` ParentID uint64 `json:"parentId"` Taxonomy string `json:"taxonomy"` // category or tag }
TaxonomyUpdateRequest param struct to update taxonomy include category and tag
type TermInfo ¶
type TermInfo struct { ID uint64 `json:"term_id"` Name string `json:"name"` Slug string `json:"slug"` Description string `json:"description"` Pid uint64 `json:"parent_term_id"` Level uint64 `json:"level"` }
TermInfo terms info
type TreeNode ¶
type TreeNode struct { ID uint64 `json:"id"` Name string `json:"name"` Slug string `json:"slug"` Description string `json:"description"` Count uint64 `json:"count"` TermID uint64 `json:"term_id"` ParentTermID uint64 `json:"pid"` Level uint64 `json:"level"` Children []*TreeNode `json:"children"` }
TreeNode TaxonomyTree's node struct
type UserCreateRequest ¶
type UserCreateRequest struct { Account string `form:"account"` Nickname string `form:"nickname"` Email string `form:"email"` Role string `form:"role"` Password string `form:"password"` PasswordAgain string `form:"passwordAgain"` Website string `form:"website"` }
UserCreateRequest is the create user request params struct
type UserCreateResponse ¶
UserCreateResponse is the create user request's response struct
type UserInfo ¶
type UserInfo struct { ID uint64 `json:"id"` Account string `json:"account"` Nickname string `json:"nickname"` Email string `json:"email"` Avatar string `json:"avatar"` Roles string `json:"roles"` Status int `json:"status"` Website string `json:"website"` RegisteredTime string `json:"registered_time"` DeletedTime string `json:"deleted_time"` }
UserInfo is the user struct for user list
type UserListRequest ¶
type UserListRequest struct { Username string `form:"username"` Number int `form:"number"` Page int `form:"page"` Status int `form:"status"` Role string `form:"role"` }
UserListRequest is the user list request struct
type UserListResponse ¶
type UserListResponse struct { TotalCount int64 `json:"totalCount"` UserList []*UserInfo `json:"userList"` }
UserListResponse is the use list response struct
type UserUpdatePasswordRequest ¶
type UserUpdatePasswordRequest struct { ID uint64 `json:"id"` Password string `json:"password" binding:"required"` PasswordAgain string `json:"passwordAgain" binding:"required"` }
UserUpdatePasswordRequest user for reset user's password during the profile page
type UserUpdateRequest ¶
type UserUpdateRequest struct { ID uint64 `json:"id"` Nickname string `json:"nickname"` Email string `json:"email" binding:"required"` Role string `json:"role" binding:"required"` Website string `json:"website"` }
UserUpdateRequest is the update user request params struct
type UserUpdateStatusRequest ¶
type UserUpdateStatusRequest struct { ID uint64 `json:"id"` Status int `json:"status" binding:"required"` }
UserUpdateStatusRequest only use for update user status