schema

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnswerAcceptedFailed = 1
	AnswerAcceptedEnable = 2
)
View Source
const (
	UserNormal    = "normal"
	UserSuspended = "suspended"
	UserDeleted   = "deleted"
	UserInactive  = "inactive"
)
View Source
const (
	CGDefault = 1
	CGDIY     = 2
)
View Source
const (
	DashBoardCachekey  = "answer@dashboard"
	DashBoardCacheTime = 60 * time.Minute
)
View Source
const (
	ForbiddenReasonTypeInactive      = "inactive"
	ForbiddenReasonTypeURLExpired    = "url_expired"
	ForbiddenReasonTypeUserSuspended = "suspended"
)
View Source
const (
	NotificationTypeInbox       = 1
	NotificationTypeAchievement = 2
	NotificationNotRead         = 1
	NotificationRead            = 2
	NotificationStatusNormal    = 1
	NotificationStatusDelete    = 10
)
View Source
const (
	SitemapMaxSize      = 50000
	SitemapCachekey     = "answer@sitemap"
	SitemapPageCachekey = "answer@sitemap@page%d"
)
View Source
const (
	QuestionOrderCondNewest     = "newest"
	QuestionOrderCondActive     = "active"
	QuestionOrderCondFrequent   = "frequent"
	QuestionOrderCondScore      = "score"
	QuestionOrderCondUnanswered = "unanswered"
)
View Source
const (
	QuestionPageRespOperationTypeAsked    = "asked"
	QuestionPageRespOperationTypeAnswered = "answered"
	QuestionPageRespOperationTypeModified = "modified"
)
View Source
const (
	MailStatePass   = 1
	MailStateVerifi = 2

	NoticeStatusOn  = 1
	NoticeStatusOff = 2

	ActionRecordTypeLogin    = "login"
	ActionRecordTypeEmail    = "e_mail"
	ActionRecordTypeFindPass = "find_pass"
)
View Source
const PermaLinkQuestionID = 2
View Source
const PermaLinkQuestionIDAndTitle = 1
View Source
const PermissionMemberActionTypeEdit = "edit"
View Source
const PermissionMemberActionTypeReason = "reason"
View Source
const RevisionAuditApprove = "approve"
View Source
const RevisionAuditReject = "reject"

Variables

View Source
var AppStartTime time.Time
View Source
var ErrTypeAlert = ErrTypeData{ErrType: "alert"}
View Source
var ErrTypeModal = ErrTypeData{ErrType: "modal"}
View Source
var ErrTypeToast = ErrTypeData{ErrType: "toast"}
View Source
var GetThemeOptions = []*ThemeOption{
	{
		Label: "Default",
		Value: "default",
	},
}
View Source
var NotificationType = map[string]int{
	"inbox":       NotificationTypeInbox,
	"achievement": NotificationTypeAchievement,
}
View Source
var UserStatusShow = map[int]string{
	1:  "normal",
	9:  "forbidden",
	10: "deleted",
}
View Source
var UserStatusShowMsg = map[int]string{
	1:  "",
	9:  "<strong>This user was suspended forever.</strong> This user doesn’t meet a community guideline.",
	10: "This user was deleted.",
	11: "This user is inactive.",
}

Functions

func FormatAvatarInfo

func FormatAvatarInfo(avatarJson string) string

Types

type AcceptedAnswerItem added in v1.0.0

type AcceptedAnswerItem struct {
	Type        string    `json:"@type"`
	Text        string    `json:"text"`
	DateCreated time.Time `json:"dateCreated"`
	UpvoteCount int       `json:"upvoteCount"`
	URL         string    `json:"url"`
	Author      struct {
		Type string `json:"@type"`
		Name string `json:"name"`
	} `json:"author"`
}

type ActObjectInfo added in v0.5.0

type ActObjectInfo struct {
	Title           string `json:"title"`
	ObjectType      string `json:"object_type"`
	QuestionID      string `json:"question_id"`
	AnswerID        string `json:"answer_id"`
	Username        string `json:"username"`
	DisplayName     string `json:"display_name"`
	MainTagSlugName string `json:"main_tag_slug_name"`
}

ActObjectInfo act object info

type ActObjectTimeline added in v0.5.0

type ActObjectTimeline struct {
	ActivityID      string `json:"activity_id"`
	RevisionID      string `json:"revision_id"`
	CreatedAt       int64  `json:"created_at"`
	ActivityType    string `json:"activity_type"`
	Username        string `json:"username"`
	UserDisplayName string `json:"user_display_name"`
	Comment         string `json:"comment"`
	ObjectID        string `json:"object_id"`
	ObjectType      string `json:"object_type"`
	Cancelled       bool   `json:"cancelled"`
	CancelledAt     int64  `json:"cancelled_at"`
	UserID          string `json:"id"`
}

ActObjectTimeline act object timeline

type ActionRecordReq

type ActionRecordReq struct {
	// action
	Action string `validate:"required,oneof=login e_mail find_pass" form:"action"`
	IP     string `json:"-"`
}

type ActionRecordResp

type ActionRecordResp struct {
	CaptchaID  string `json:"captcha_id"`
	CaptchaImg string `json:"captcha_img"`
	Verify     bool   `json:"verify"`
}

type ActivityMsg added in v0.5.0

type ActivityMsg struct {
	UserID           string                   `json:"user_id"`
	TriggerUserID    int64                    `json:"trigger_user_id"`
	ObjectID         string                   `json:"object_id"`
	OriginalObjectID string                   `json:"original_object_id"`
	ActivityTypeKey  constant.ActivityTypeKey `json:"activity_type_key"`
	RevisionID       string                   `json:"revision_id"`
}

ActivityMsg activity message

type AddCollectionGroupReq

type AddCollectionGroupReq struct {
	//
	UserID int64 `validate:"required" comment:"" json:"user_id"`
	// the collection group name
	Name string `validate:"required,gt=0,lte=50" comment:"the collection group name" json:"name"`
	// mark this group is default, default 1
	DefaultGroup int `validate:"required" comment:"mark this group is default, default 1" json:"default_group"`
	//
	CreateTime time.Time `validate:"required" comment:"" json:"create_time"`
	//
	UpdateTime time.Time `validate:"required" comment:"" json:"update_time"`
}

AddCollectionGroupReq add collection group request

type AddCommentReq

type AddCommentReq struct {
	// object id
	ObjectID string `validate:"required" json:"object_id"`
	// reply comment id
	ReplyCommentID string `validate:"omitempty" json:"reply_comment_id"`
	// original comment content
	OriginalText string `validate:"required,notblank,gte=2,lte=600" json:"original_text"`
	// parsed comment content
	ParsedText string `json:"-"`
	// @ user id list
	MentionUsernameList []string `validate:"omitempty" json:"mention_username_list"`
	// user id
	UserID string `json:"-"`
	// whether user can add it
	CanAdd bool `json:"-"`
	// whether user can edit it
	CanEdit bool `json:"-"`
	// whether user can delete it
	CanDelete bool `json:"-"`
}

AddCommentReq add comment request

func (*AddCommentReq) Check added in v1.0.0

func (req *AddCommentReq) Check() (errFields []*validator.FormErrorField, err error)

type AddConfigReq

type AddConfigReq struct {
	// the config key
	Key string `validate:"omitempty,gt=0,lte=32" comment:"the config key" json:"key"`
	// the config value, custom data structures and types
	Value string `validate:"omitempty,gt=0,lte=128" comment:"the config value, custom data structures and types" json:"value"`
}

AddConfigReq add config request

type AddReportReq

type AddReportReq struct {
	// object id
	ObjectID string `validate:"required,gt=0,lte=20" json:"object_id"`
	// report type
	ReportType int `validate:"required" json:"report_type"`
	// report content
	Content string `validate:"omitempty,gt=0,lte=500" json:"content"`
	// user id
	UserID string `json:"-"`
}

AddReportReq add report request

type AddRevisionDTO

type AddRevisionDTO struct {
	// user id
	UserID string
	// object id
	ObjectID string
	// title
	Title string
	// content
	Content string
	// log
	Log string
	// status
	Status int
}

AddRevisionDTO add revision request

type AddTagListReq

type AddTagListReq struct {
	// tag_id
	TagID int64 `validate:"required" comment:"tag_id" json:"tag_id"`
	// object_id
	ObjectID int64 `validate:"required" comment:"object_id" json:"object_id"`
	// tag_list_status(available: 1; deleted: 10)
	Status int `validate:"required" comment:"tag_list_status(available: 1; deleted: 10)" json:"status"`
}

AddTagListReq add tag list request

type AddUserReq added in v1.0.0

type AddUserReq struct {
	DisplayName string `validate:"required,gt=4,lte=30" json:"display_name"`
	Email       string `validate:"required,email,gt=0,lte=500" json:"email"`
	Password    string `validate:"required,gte=8,lte=32" json:"password"`
	LoginUserID string `json:"-"`
}

AddUserReq add user request

type AdminAnswerInfo

type AdminAnswerInfo struct {
	ID           string         `json:"id"`
	QuestionID   string         `json:"question_id"`
	Description  string         `json:"description"`
	CreateTime   int64          `json:"create_time"`
	UpdateTime   int64          `json:"update_time"`
	Accepted     int            `json:"accepted"`
	UserID       string         `json:"-" `
	UpdateUserID string         `json:"-" `
	UserInfo     *UserBasicInfo `json:"user_info"`
	VoteCount    int            `json:"vote_count"`
	QuestionInfo struct {
		Title string `json:"title"`
	} `json:"question_info"`
}

type AdminQuestionInfo

type AdminQuestionInfo struct {
	ID               string         `json:"id"`
	Title            string         `json:"title"`
	VoteCount        int            `json:"vote_count"`
	AnswerCount      int            `json:"answer_count"`
	AcceptedAnswerID string         `json:"accepted_answer_id"`
	CreateTime       int64          `json:"create_time"`
	UpdateTime       int64          `json:"update_time"`
	EditTime         int64          `json:"edit_time"`
	UserID           string         `json:"-" `
	UserInfo         *UserBasicInfo `json:"user_info"`
}

type AdminQuestionSearch added in v1.0.1

type AdminQuestionSearch struct {
	Page      int    `json:"page" form:"page"`           // Query number of pages
	PageSize  int    `json:"page_size" form:"page_size"` // Search page size
	Status    int    `json:"-" form:"-"`
	StatusStr string `json:"status" form:"status"`                                  // Status 1 Available 2 closed 10 UserDeleted
	Query     string `validate:"omitempty,gt=0,lte=100" json:"query" form:"query" ` //Query string
}

type AdminSetAnswerStatusRequest added in v0.5.0

type AdminSetAnswerStatusRequest struct {
	StatusStr string `json:"status"`
	AnswerID  string `json:"answer_id"`
	UserID    string `json:"-" `
}

type AdminSetQuestionStatusRequest

type AdminSetQuestionStatusRequest struct {
	StatusStr  string `json:"status" form:"status"`
	QuestionID string `json:"question_id" form:"question_id"`
}

type AnswerAcceptedReq added in v1.0.1

type AnswerAcceptedReq struct {
	QuestionID string `json:"question_id"`
	AnswerID   string `json:"answer_id"`
	UserID     string `json:"-" `
}

type AnswerAddReq

type AnswerAddReq struct {
	QuestionID string `json:"question_id"`
	Content    string `validate:"required,notblank,gte=6,lte=65535" json:"content"`
	HTML       string `json:"-"`
	UserID     string `json:"-"`
}

func (*AnswerAddReq) Check added in v1.0.0

func (req *AnswerAddReq) Check() (errFields []*validator.FormErrorField, err error)

type AnswerInfo

type AnswerInfo struct {
	ID             string         `json:"id" xorm:"id"`                   // id
	QuestionID     string         `json:"question_id" xorm:"question_id"` // question_id
	Content        string         `json:"content" xorm:"content"`         // content
	HTML           string         `json:"html" xorm:"html"`               // html
	CreateTime     int64          `json:"create_time" xorm:"created"`     // create_time
	UpdateTime     int64          `json:"update_time" xorm:"updated"`     // update_time
	Accepted       int            `json:"accepted"`                       // 1 Failed 2 accepted
	UserID         string         `json:"-" `
	UpdateUserID   string         `json:"-" `
	UserInfo       *UserBasicInfo `json:"user_info,omitempty"`
	UpdateUserInfo *UserBasicInfo `json:"update_user_info,omitempty"`
	Collected      bool           `json:"collected"`
	VoteStatus     string         `json:"vote_status"`
	VoteCount      int            `json:"vote_count"`
	QuestionInfo   *QuestionInfo  `json:"question_info,omitempty"`
	Status         int            `json:"status"`

	// MemberActions
	MemberActions []*PermissionMemberAction `json:"member_actions"`
}

type AnswerListReq added in v0.5.0

type AnswerListReq struct {
	QuestionID string `json:"question_id" form:"question_id"` // question_id
	Order      string `json:"order" form:"order"`             // 1 Default 2 time
	Page       int    `json:"page" form:"page"`               // Query number of pages
	PageSize   int    `json:"page_size" form:"page_size"`     // Search page size
	UserID     string `json:"-" `
	IsAdmin    bool   `json:"-"`
	// whether user can edit it
	CanEdit bool `json:"-"`
	// whether user can delete it
	CanDelete bool `json:"-"`
}

type AnswerUpdateReq

type AnswerUpdateReq struct {
	ID           string `json:"id"`
	QuestionID   string `json:"question_id"`
	Title        string `json:"title"`
	Content      string `validate:"required,notblank,gte=6,lte=65535" json:"content"`
	EditSummary  string `validate:"omitempty" json:"edit_summary"`
	HTML         string `json:"-"`
	UserID       string `json:"-"`
	NoNeedReview bool   `json:"-"`
	// whether user can edit it
	CanEdit bool `json:"-"`
}

func (*AnswerUpdateReq) Check added in v1.0.0

func (req *AnswerUpdateReq) Check() (errFields []*validator.FormErrorField, err error)

type AnswerUpdateResp added in v0.5.0

type AnswerUpdateResp struct {
	WaitForReview bool `json:"wait_for_review"`
}

AnswerUpdateResp answer update resp

type AvatarInfo

type AvatarInfo struct {
	Type     string `validate:"omitempty,gt=0,lte=100"  json:"type"`
	Gravatar string `validate:"omitempty,gt=0,lte=200"  json:"gravatar"`
	Custom   string `validate:"omitempty,gt=0,lte=200"  json:"custom"`
}

type CheckCanQuestionUpdate added in v0.5.0

type CheckCanQuestionUpdate struct {
	// question id
	ID string `validate:"required" form:"id"`
	// user id
	UserID  string `json:"-"`
	IsAdmin bool   `json:"-"`
}

type CloseQuestionMeta

type CloseQuestionMeta struct {
	CloseType int    `json:"close_type"`
	CloseMsg  string `json:"close_msg"`
}

type CloseQuestionReq

type CloseQuestionReq struct {
	ID        string `validate:"required" json:"id"`
	CloseType int    `json:"close_type"` // close_type
	CloseMsg  string `json:"close_msg"`  // close_type
	UserID    string `json:"-"`          // user_id
}

type CollectionSwitchDTO

type CollectionSwitchDTO struct {
	ObjectID string
	GroupID  string
	UserID   string
}

CollectionSwitchDTO collection data transfer object

type CollectionSwitchReq

type CollectionSwitchReq struct {
	// object TagID
	ObjectID string `validate:"required" json:"object_id"`
	// user collection group TagID
	GroupID string `validate:"required" json:"group_id"`
}

CollectionSwitchReq switch collection request

type CollectionSwitchResp

type CollectionSwitchResp struct {
	ObjectID              string `json:"object_id"`
	Switch                bool   `json:"switch"`
	ObjectCollectionCount string `json:"object_collection_count"`
}

CollectionSwitchResp switch collection response

type DashboardInfo added in v0.3.0

type DashboardInfo struct {
	QuestionCount         int64                `json:"question_count"`
	AnswerCount           int64                `json:"answer_count"`
	CommentCount          int64                `json:"comment_count"`
	VoteCount             int64                `json:"vote_count"`
	UserCount             int64                `json:"user_count"`
	ReportCount           int64                `json:"report_count"`
	UploadingFiles        bool                 `json:"uploading_files"`
	SMTP                  bool                 `json:"smtp"`
	HTTPS                 bool                 `json:"https"`
	TimeZone              string               `json:"time_zone"`
	OccupyingStorageSpace string               `json:"occupying_storage_space"`
	AppStartTime          string               `json:"app_start_time"`
	VersionInfo           DashboardInfoVersion `json:"version_info"`
}

type DashboardInfoVersion added in v0.3.0

type DashboardInfoVersion struct {
	Version       string `json:"version"`
	RemoteVersion string `json:"remote_version"`
}

type EmailCodeContent

type EmailCodeContent struct {
	SourceType SourceType `json:"source_type"`
	Email      string     `json:"e_mail"`
	UserID     string     `json:"user_id"`
}

func (*EmailCodeContent) FromJSONString

func (r *EmailCodeContent) FromJSONString(data string) error

func (*EmailCodeContent) ToJSONString

func (r *EmailCodeContent) ToJSONString() string

type ErrTypeData

type ErrTypeData struct {
	ErrType string `json:"err_type"`
}

type FollowDTO

type FollowDTO struct {
	// object TagID
	ObjectID string
	// is cancel
	IsCancel bool
	// user TagID
	UserID string
}

type FollowReq

type FollowReq struct {
	// object id
	ObjectID string `validate:"required" form:"object_id" json:"object_id"`
	// is cancel
	IsCancel bool `validate:"omitempty" form:"is_cancel" json:"is_cancel"`
}

FollowReq follow object request

type FollowResp

type FollowResp struct {
	// the followers of object
	Follows int `json:"follows"`
	// if user is followed object will be true,otherwise false
	IsFollowed bool `json:"is_followed"`
}

FollowResp response object's follows and current user follow status

type ForbiddenResp

type ForbiddenResp struct {
	// forbidden reason type
	Type string `json:"type" enums:"inactive,url_expired"`
}

ForbiddenResp forbidden response

type GetCloseTypeResp

type GetCloseTypeResp struct {
	// report name
	Name string `json:"name"`
	// report description
	Description string `json:"description"`
	// report source
	Source string `json:"source"`
	// report type
	Type int `json:"type"`
	// is have content
	HaveContent bool `json:"have_content"`
	// content type
	ContentType string `json:"content_type"`
}

type GetCollectionGroupResp

type GetCollectionGroupResp struct {
	//
	ID int64 `json:"id"`
	//
	UserID int64 `json:"user_id"`
	// the collection group name
	Name string `json:"name"`
	// mark this group is default, default 1
	DefaultGroup int `json:"default_group"`
	//
	CreateTime time.Time `json:"create_time"`
	//
	UpdateTime time.Time `json:"update_time"`
}

GetCollectionGroupResp get collection group response

type GetCommentListReq

type GetCommentListReq struct {
	// user id
	UserID int64 `validate:"omitempty" comment:"user id" form:"user_id"`
	// reply user id
	ReplyUserID int64 `validate:"omitempty" comment:"reply user id" form:"reply_user_id"`
	// reply comment id
	ReplyCommentID int64 `validate:"omitempty" comment:"reply comment id" form:"reply_comment_id"`
	// object id
	ObjectID int64 `validate:"omitempty" comment:"object id" form:"object_id"`
	// user vote amount
	VoteCount int `validate:"omitempty" comment:"user vote amount" form:"vote_count"`
	// comment status(available: 0; deleted: 10)
	Status int `validate:"omitempty" comment:"comment status(available: 0; deleted: 10)" form:"status"`
	// original comment content
	OriginalText string `validate:"omitempty" comment:"original comment content" form:"original_text"`
	// parsed comment content
	ParsedText string `validate:"omitempty" comment:"parsed comment content" form:"parsed_text"`
}

GetCommentListReq get comment list all request

type GetCommentPersonalWithPageReq

type GetCommentPersonalWithPageReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// username
	Username string `validate:"omitempty,gt=0,lte=100" form:"username"`
	// user id
	UserID string `json:"-"`
}

GetCommentPersonalWithPageReq get comment list page request

type GetCommentPersonalWithPageResp

type GetCommentPersonalWithPageResp struct {
	// comment id
	CommentID string `json:"comment_id"`
	// create time
	CreatedAt int64 `json:"created_at"`
	// object id
	ObjectID string `json:"object_id"`
	// question id
	QuestionID string `json:"question_id"`
	// answer id
	AnswerID string `json:"answer_id"`
	// object type
	ObjectType string `json:"object_type" enums:"question,answer,tag,comment"`
	// title
	Title string `json:"title"`
	// content
	Content string `json:"content"`
}

GetCommentPersonalWithPageResp comment response

type GetCommentReq

type GetCommentReq struct {
	// object id
	ID string `validate:"required" form:"id"`
	// user id
	UserID string `json:"-"`
	// whether user can edit it
	CanEdit bool `json:"-"`
	// whether user can delete it
	CanDelete bool `json:"-"`
}

GetCommentReq get comment list page request

type GetCommentResp

type GetCommentResp struct {
	// comment id
	CommentID string `json:"comment_id"`
	// create time
	CreatedAt int64 `json:"created_at"`

	// object id
	ObjectID string `json:"object_id"`
	// user vote amount
	VoteCount int `json:"vote_count"`
	// current user if already vote this comment
	IsVote bool `json:"is_vote"`
	// original comment content
	OriginalText string `json:"original_text"`
	// parsed comment content
	ParsedText string `json:"parsed_text"`

	// user id
	UserID string `json:"user_id"`
	// username
	Username string `json:"username"`
	// user display name
	UserDisplayName string `json:"user_display_name"`
	// user avatar
	UserAvatar string `json:"user_avatar"`
	// user status
	UserStatus string `json:"user_status"`

	// reply user id
	ReplyUserID string `json:"reply_user_id"`
	// reply user username
	ReplyUsername string `json:"reply_username"`
	// reply user display name
	ReplyUserDisplayName string `json:"reply_user_display_name"`
	// reply comment id
	ReplyCommentID string `json:"reply_comment_id"`
	// reply user status
	ReplyUserStatus string `json:"reply_user_status"`

	// MemberActions
	MemberActions []*PermissionMemberAction `json:"member_actions"`
}

GetCommentResp comment response

func (*GetCommentResp) SetFromComment

func (r *GetCommentResp) SetFromComment(comment *entity.Comment)

type GetCommentWithPageReq

type GetCommentWithPageReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// object id
	ObjectID string `validate:"required" form:"object_id"`
	// comment id
	CommentID string `validate:"omitempty" form:"comment_id"`
	// query condition
	QueryCond string `validate:"omitempty,oneof=vote" form:"query_cond"`
	// user id
	UserID string `json:"-"`
	// whether user can edit it
	CanEdit bool `json:"-"`
	// whether user can delete it
	CanDelete bool `json:"-"`
}

GetCommentWithPageReq get comment list page request

type GetConfigListReq

type GetConfigListReq struct {
	// the config key
	Key string `validate:"omitempty,gt=0,lte=32" comment:"the config key" form:"key"`
	// the config value, custom data structures and types
	Value string `validate:"omitempty,gt=0,lte=128" comment:"the config value, custom data structures and types" form:"value"`
}

GetConfigListReq get config list all request

type GetConfigResp

type GetConfigResp struct {
	// config id
	ID int `json:"id"`
	// the config key
	Key string `json:"key"`
	// the config value, custom data structures and types
	Value string `json:"value"`
}

GetConfigResp get config response

type GetConfigWithPageReq

type GetConfigWithPageReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// the config key
	Key string `validate:"omitempty,gt=0,lte=32" comment:"the config key" form:"key"`
	// the config value, custom data structures and types
	Value string `validate:"omitempty,gt=0,lte=128" comment:"the config value, custom data structures and types" form:"value"`
}

GetConfigWithPageReq get config list page request

type GetFollowingTagsResp

type GetFollowingTagsResp struct {
	// tag id
	TagID string `json:"tag_id"`
	// slug name
	SlugName string `json:"slug_name"`
	// display name
	DisplayName string `json:"display_name"`
	// if main tag slug name is not empty, this tag is synonymous with the main tag
	MainTagSlugName string `json:"main_tag_slug_name"`
	Recommend       bool   `json:"recommend"`
	Reserved        bool   `json:"reserved"`
}

GetFollowingTagsResp get following tags response

type GetManifestJsonResp added in v1.0.0

type GetManifestJsonResp struct {
	ManifestVersion int               `json:"manifest_version"`
	Version         string            `json:"version"`
	ShortName       string            `json:"short_name"`
	Name            string            `json:"name"`
	Icons           map[string]string `json:"icons"`
	StartUrl        string            `json:"start_url"`
	Display         string            `json:"display"`
	ThemeColor      string            `json:"theme_color"`
	BackgroundColor string            `json:"background_color"`
}

GetManifestJsonResp get manifest json response

type GetObjectTimelineDetailReq added in v0.5.0

type GetObjectTimelineDetailReq struct {
	NewRevisionID string `validate:"required,gt=0,lte=100" form:"new_revision_id"`
	OldRevisionID string `validate:"required,gt=0,lte=100" form:"old_revision_id"`
	UserID        string `json:"-"`
}

GetObjectTimelineDetailReq get object timeline detail request

type GetObjectTimelineDetailResp added in v0.5.0

type GetObjectTimelineDetailResp struct {
	NewRevision *ObjectTimelineDetail `json:"new_revision"`
	OldRevision *ObjectTimelineDetail `json:"old_revision"`
}

GetObjectTimelineDetailResp get object timeline detail response

type GetObjectTimelineReq added in v0.5.0

type GetObjectTimelineReq struct {
	ObjectID string `validate:"omitempty,gt=0,lte=100" form:"object_id"`
	ShowVote bool   `validate:"omitempty" form:"show_vote"`
	UserID   string `json:"-"`
	IsAdmin  bool   `json:"-"`
}

GetObjectTimelineReq get object timeline request

type GetObjectTimelineResp added in v0.5.0

type GetObjectTimelineResp struct {
	ObjectInfo *ActObjectInfo       `json:"object_info"`
	Timeline   []*ActObjectTimeline `json:"timeline"`
}

GetObjectTimelineResp get object timeline response

type GetOtherUserInfoByUsernameReq

type GetOtherUserInfoByUsernameReq struct {
	Username string `validate:"required,gt=0,lte=500" form:"username"`
}

type GetOtherUserInfoByUsernameResp

type GetOtherUserInfoByUsernameResp struct {
	// user id
	ID string `json:"id"`
	// create time
	CreatedAt int64 `json:"created_at"`
	// last login date
	LastLoginDate int64 `json:"last_login_date"`
	// username
	Username string `json:"username"`
	// email
	// follow count
	FollowCount int `json:"follow_count"`
	// answer count
	AnswerCount int `json:"answer_count"`
	// question count
	QuestionCount int `json:"question_count"`
	// rank
	Rank int `json:"rank"`
	// display name
	DisplayName string `json:"display_name"`
	// avatar
	Avatar string `json:"avatar"`
	// mobile
	Mobile string `json:"mobile"`
	// bio markdown
	Bio string `json:"bio"`
	// bio html
	BioHTML string `json:"bio_html"`
	// website
	Website string `json:"website"`
	// location
	Location string `json:"location"`
	// ip info
	IPInfo string `json:"ip_info"`
	// is admin
	IsAdmin   bool   `json:"is_admin"`
	Status    string `json:"status"`
	StatusMsg string `json:"status_msg,omitempty"`
}

GetOtherUserInfoByUsernameResp get user response

func (*GetOtherUserInfoByUsernameResp) GetFromUserEntity

func (r *GetOtherUserInfoByUsernameResp) GetFromUserEntity(userInfo *entity.User)

type GetOtherUserInfoResp

type GetOtherUserInfoResp struct {
	Info *GetOtherUserInfoByUsernameResp `json:"info"`
}

type GetRankPersonalWithPageReq

type GetRankPersonalWithPageReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// username
	Username string `validate:"omitempty,gt=0,lte=100" form:"username"`
	// user id
	UserID string `json:"-"`
}

GetRankPersonalWithPageReq get rank list page request

type GetRankPersonalWithPageResp

type GetRankPersonalWithPageResp struct {
	// create time
	CreatedAt int64 `json:"created_at"`
	// object id
	ObjectID string `json:"object_id"`
	// question id
	QuestionID string `json:"question_id"`
	// answer id
	AnswerID string `json:"answer_id"`
	// object type
	ObjectType string `json:"object_type" enums:"question,answer,tag,comment"`
	// title
	Title string `json:"title"`
	// content
	Content string `json:"content"`
	// reputation
	Reputation int `json:"reputation"`
	// rank type
	RankType string `json:"rank_type"`
}

GetRankPersonalWithPageResp rank response

type GetRedDot added in v0.5.0

type GetRedDot struct {
	CanReviewQuestion bool   `json:"-"`
	CanReviewAnswer   bool   `json:"-"`
	CanReviewTag      bool   `json:"-"`
	UserID            string `json:"-"`
}

type GetReportListPageDTO

type GetReportListPageDTO struct {
	ObjectType string
	Status     string
	Page       int
	PageSize   int
}

GetReportListPageDTO report list data transfer object

type GetReportListPageResp

type GetReportListPageResp struct {
	ID           string         `json:"id"`
	ReportedUser *UserBasicInfo `json:"reported_user"`
	ReportUser   *UserBasicInfo `json:"report_user"`

	Content        string `json:"content"`
	FlaggedContent string `json:"flagged_content"`
	OType          string `json:"object_type"`

	ObjectID   string `json:"-"`
	QuestionID string `json:"question_id"`
	AnswerID   string `json:"answer_id"`
	CommentID  string `json:"comment_id"`

	Title   string `json:"title"`
	Excerpt string `json:"excerpt"`

	// create time
	CreatedAt       time.Time `json:"-"`
	CreatedAtParsed int64     `json:"created_at"`

	UpdatedAt       time.Time `json:"_"`
	UpdatedAtParsed int64     `json:"updated_at"`

	Reason        *ReasonItem `json:"reason"`
	FlaggedReason *ReasonItem `json:"flagged_reason"`

	UserID         string `json:"-"`
	ReportedUserID string `json:"-"`
	Status         int    `json:"-"`
	ObjectType     int    `json:"-"`
	ReportType     int    `json:"-"`
	FlaggedType    int    `json:"-"`
}

GetReportListPageResp get report list

func (*GetReportListPageResp) Format

func (r *GetReportListPageResp) Format()

Format format result

type GetReportListReq

type GetReportListReq struct {
	// report source
	Source string `validate:"required,oneof=question answer comment" form:"source"`
}

GetReportListReq get report list all request

type GetReportTypeResp

type GetReportTypeResp struct {
	// report name
	Name string `json:"name"`
	// report description
	Description string `json:"description"`
	// report source
	Source string `json:"source"`
	// report type
	Type int `json:"type"`
	// is have content
	HaveContent bool `json:"have_content"`
	// content type
	ContentType string `json:"content_type"`
}

GetReportTypeResp get report response

type GetRevisionListReq

type GetRevisionListReq struct {
	// object id
	ObjectID string `validate:"required" comment:"object_id" form:"object_id"`
}

GetRevisionListReq get revision list all request

type GetRevisionResp

type GetRevisionResp struct {
	// id
	ID string `json:"id"`
	// user id
	UserID string `json:"use_id"`
	// object id
	ObjectID string `json:"object_id"`
	// object type
	ObjectType int `json:"-"`
	// title
	Title string `json:"title"`
	// content
	Content string `json:"-"`
	// content parsed
	ContentParsed interface{} `json:"content"`
	// revision status(normal: 1; delete 2)
	Status int `json:"status"`
	// create time
	CreatedAt       time.Time     `json:"-"`
	CreatedAtParsed int64         `json:"create_at"`
	UserInfo        UserBasicInfo `json:"user_info"`
	Log             string        `json:"reason"`
}

GetRevisionResp get revision response

type GetRoleResp added in v1.0.0

type GetRoleResp struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

GetRoleResp get role response

type GetSMTPConfigResp

type GetSMTPConfigResp struct {
	FromEmail          string `json:"from_email"`
	FromName           string `json:"from_name"`
	SMTPHost           string `json:"smtp_host"`
	SMTPPort           int    `json:"smtp_port"`
	Encryption         string `json:"encryption"` // "" SSL
	SMTPUsername       string `json:"smtp_username"`
	SMTPPassword       string `json:"smtp_password"`
	SMTPAuthentication bool   `json:"smtp_authentication"`
}

GetSMTPConfigResp get smtp config response

type GetSiteLegalInfoReq added in v0.4.0

type GetSiteLegalInfoReq struct {
	InfoType string `validate:"required,oneof=tos privacy" form:"info_type"`
}

GetSiteLegalInfoReq site site legal request

func (*GetSiteLegalInfoReq) IsPrivacy added in v0.4.0

func (r *GetSiteLegalInfoReq) IsPrivacy() bool

func (*GetSiteLegalInfoReq) IsTOS added in v0.4.0

func (r *GetSiteLegalInfoReq) IsTOS() bool

type GetSiteLegalInfoResp added in v0.4.0

type GetSiteLegalInfoResp struct {
	TermsOfServiceOriginalText string `json:"terms_of_service_original_text,omitempty"`
	TermsOfServiceParsedText   string `json:"terms_of_service_parsed_text,omitempty"`
	PrivacyPolicyOriginalText  string `json:"privacy_policy_original_text,omitempty"`
	PrivacyPolicyParsedText    string `json:"privacy_policy_parsed_text,omitempty"`
}

GetSiteLegalInfoResp get site legal info response

type GetTagInfoReq

type GetTagInfoReq struct {
	// tag id
	ID string `validate:"omitempty" form:"id"`
	// tag slug name
	Name string `validate:"omitempty,gt=0,lte=35" form:"name"`
	// user id
	UserID string `json:"-"`
	// whether user can edit it
	CanEdit bool `json:"-"`
	// whether user can delete it
	CanDelete bool `json:"-"`
}

GetTagInfoReq get tag info request

func (*GetTagInfoReq) Check

func (r *GetTagInfoReq) Check() (errFields []*validator.FormErrorField, err error)

type GetTagListListReq

type GetTagListListReq struct {
	// tag_id
	TagID int64 `validate:"omitempty" comment:"tag_id" form:"tag_id"`
	// object_id
	ObjectID int64 `validate:"omitempty" comment:"object_id" form:"object_id"`
	// tag_list_status(available: 1; deleted: 10)
	Status int `validate:"omitempty" comment:"tag_list_status(available: 1; deleted: 10)" form:"status"`
}

GetTagListListReq get tag list list all request

type GetTagListResp

type GetTagListResp struct {
	// tag_list_id
	ID int64 `json:"id"`
	// tag_id
	TagID int64 `json:"tag_id"`
	// object_id
	ObjectID int64 `json:"object_id"`
	// tag_list_status(available: 1; deleted: 10)
	Status int `json:"status"`
}

GetTagListResp get tag list response

type GetTagListWithPageReq

type GetTagListWithPageReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// tag_id
	TagID int64 `validate:"omitempty" comment:"tag_id" form:"tag_id"`
	// object_id
	ObjectID int64 `validate:"omitempty" comment:"object_id" form:"object_id"`
	// tag_list_status(available: 1; deleted: 10)
	Status int `validate:"omitempty" comment:"tag_list_status(available: 1; deleted: 10)" form:"status"`
}

GetTagListWithPageReq get tag list list page request

type GetTagPageResp

type GetTagPageResp struct {
	// tag_id
	TagID string `json:"tag_id"`
	// slug_name
	SlugName string `json:"slug_name"`
	// display_name
	DisplayName string `json:"display_name"`
	// excerpt
	Excerpt string `json:"excerpt"`
	// original text
	OriginalText string `json:"original_text"`
	// parsed_text
	ParsedText string `json:"parsed_text"`
	// follower amount
	FollowCount int `json:"follow_count"`
	// question amount
	QuestionCount int `json:"question_count"`
	// is follower
	IsFollower bool `json:"is_follower"`
	// created time
	CreatedAt int64 `json:"created_at"`
	// updated time
	UpdatedAt int64 `json:"updated_at"`
	Recommend bool  `json:"recommend"`
	Reserved  bool  `json:"reserved"`
}

GetTagPageResp get tag response

func (*GetTagPageResp) GetExcerpt

func (tr *GetTagPageResp) GetExcerpt()

type GetTagResp

type GetTagResp struct {
	// tag id
	TagID string `json:"tag_id"`
	// created time
	CreatedAt int64 `json:"created_at"`
	// updated time
	UpdatedAt int64 `json:"updated_at"`
	// slug name
	SlugName string `json:"slug_name"`
	// display name
	DisplayName string `json:"display_name"`
	// excerpt
	Excerpt string `json:"excerpt"`
	// original text
	OriginalText string `json:"original_text"`
	// parsed text
	ParsedText string `json:"parsed_text"`
	// description text
	Description string `json:"description"`
	// follower amount
	FollowCount int `json:"follow_count"`
	// question amount
	QuestionCount int `json:"question_count"`
	// is follower
	IsFollower bool `json:"is_follower"`
	// MemberActions
	MemberActions []*PermissionMemberAction `json:"member_actions"`
	// if main tag slug name is not empty, this tag is synonymous with the main tag
	MainTagSlugName string `json:"main_tag_slug_name"`
	Recommend       bool   `json:"recommend"`
	Reserved        bool   `json:"reserved"`
}

GetTagResp get tag response

func (*GetTagResp) GetExcerpt

func (tr *GetTagResp) GetExcerpt()

type GetTagSynonymsReq

type GetTagSynonymsReq struct {
	// tag_id
	TagID string `validate:"required" form:"tag_id"`
	// user id
	UserID string `json:"-"`
	// whether user can edit it
	CanEdit bool `json:"-"`
}

GetTagSynonymsReq get tag synonyms request

type GetTagSynonymsResp

type GetTagSynonymsResp struct {
	// synonyms
	Synonyms []*TagSynonym `json:"synonyms"`
	// MemberActions
	MemberActions []*PermissionMemberAction `json:"member_actions"`
}

GetTagSynonymsResp get tag synonyms response

type GetTagWithPageReq

type GetTagWithPageReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// slug_name
	SlugName string `validate:"omitempty,gt=0,lte=35" form:"slug_name"`
	// display_name
	DisplayName string `validate:"omitempty,gt=0,lte=35" form:"display_name"`
	// query condition
	QueryCond string `validate:"omitempty,oneof=popular name newest" form:"query_cond"`
	// user id
	UserID string `json:"-"`
}

GetTagWithPageReq get tag list page request

type GetTamplateTagInfoReq added in v1.0.0

type GetTamplateTagInfoReq struct {
	// tag id
	ID string `validate:"omitempty" form:"id"`
	// tag slug name
	Name string `validate:"omitempty" form:"name"`
	// user id
	UserID   string `json:"-"`
	Page     int    `validate:"omitempty,min=1" form:"page"`
	PageSize int    `validate:"omitempty,min=1" form:"page_size"`
}

type GetUnreviewedRevisionResp added in v0.5.0

type GetUnreviewedRevisionResp struct {
	Type           string                      `json:"type"`
	Info           *UnreviewedRevisionInfoInfo `json:"info"`
	UnreviewedInfo *GetRevisionResp            `json:"unreviewed_info"`
}

type GetUserInfoReq

type GetUserInfoReq struct {
	UserID string `validate:"required" json:"user_id"`
}

GetUserInfoReq get user request

type GetUserInfoResp

type GetUserInfoResp struct {
}

GetUserInfoResp get user response

type GetUserPageReq

type GetUserPageReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// email
	Query string `validate:"omitempty,gt=0,lte=100" form:"query"`
	// user status
	Status string `validate:"omitempty,oneof=suspended deleted inactive" form:"status"`
	// staff, if staff is true means query admin or moderator
	Staff bool `validate:"omitempty" form:"staff"`
}

GetUserPageReq get user list page request

func (*GetUserPageReq) IsDeleted

func (r *GetUserPageReq) IsDeleted() bool

func (*GetUserPageReq) IsInactive

func (r *GetUserPageReq) IsInactive() bool

func (*GetUserPageReq) IsSuspended

func (r *GetUserPageReq) IsSuspended() bool

type GetUserPageResp

type GetUserPageResp struct {
	// user id
	UserID string `json:"user_id"`
	// create time
	CreatedAt int64 `json:"created_at"`
	// delete time
	DeletedAt int64 `json:"deleted_at"`
	// suspended time
	SuspendedAt int64 `json:"suspended_at"`
	// username
	Username string `json:"username"`
	// email
	EMail string `json:"e_mail"`
	// rank
	Rank int `json:"rank"`
	// user status(normal,suspended,deleted,inactive)
	Status string `json:"status"`
	// display name
	DisplayName string `json:"display_name"`
	// avatar
	Avatar string `json:"avatar"`
	// role id
	RoleID int `json:"role_id"`
	// role name
	RoleName string `json:"role_name"`
}

GetUserPageResp get user response

type GetUserResp

type GetUserResp struct {
	// user id
	ID string `json:"id"`
	// create time
	CreatedAt int64 `json:"created_at"`
	// last login date
	LastLoginDate int64 `json:"last_login_date"`
	// username
	Username string `json:"username"`
	// email
	EMail string `json:"e_mail"`
	// mail status(1 pass 2 to be verified)
	MailStatus int `json:"mail_status"`
	// notice status(1 on 2off)
	NoticeStatus int `json:"notice_status"`
	// follow count
	FollowCount int `json:"follow_count"`
	// answer count
	AnswerCount int `json:"answer_count"`
	// question count
	QuestionCount int `json:"question_count"`
	// rank
	Rank int `json:"rank"`
	// authority group
	AuthorityGroup int `json:"authority_group"`
	// display name
	DisplayName string `json:"display_name"`
	// avatar
	Avatar string `json:"avatar"`
	// mobile
	Mobile string `json:"mobile"`
	// bio markdown
	Bio string `json:"bio"`
	// bio html
	BioHTML string `json:"bio_html"`
	// website
	Website string `json:"website"`
	// location
	Location string `json:"location"`
	// ip info
	IPInfo string `json:"ip_info"`
	// language
	Language string `json:"language"`
	// access token
	AccessToken string `json:"access_token"`
	// is admin
	IsAdmin bool `json:"is_admin"`
	// user status
	Status string `json:"status"`
}

GetUserResp get user response

func (*GetUserResp) GetFromUserEntity

func (r *GetUserResp) GetFromUserEntity(userInfo *entity.User)

type GetUserStatusResp

type GetUserStatusResp struct {
	// user status
	Status string `json:"status"`
}

GetUserStatusResp get user status info

type GetUserToSetShowResp

type GetUserToSetShowResp struct {
	*GetUserResp
	Avatar *AvatarInfo `json:"avatar"`
}

func (*GetUserToSetShowResp) GetFromUserEntity

func (r *GetUserToSetShowResp) GetFromUserEntity(userInfo *entity.User)

type GetVoteWithPageReq

type GetVoteWithPageReq struct {
	// page
	Page int `validate:"omitempty,min=1" form:"page"`
	// page size
	PageSize int `validate:"omitempty,min=1" form:"page_size"`
	// user id
	UserID string `validate:"required" form:"user_id"`
}

type GetVoteWithPageResp

type GetVoteWithPageResp struct {
	// create time
	CreatedAt int64 `json:"created_at"`
	// object id
	ObjectID string `json:"object_id"`
	// question id
	QuestionID string `json:"question_id"`
	// answer id
	AnswerID string `json:"answer_id"`
	// object type
	ObjectType string `json:"object_type" enums:"question,answer,tag,comment"`
	// title
	Title string `json:"title"`
	// content
	Content string `json:"content"`
	// vote type
	VoteType string `json:"vote_type"`
}

type NewAnswerTemplateData added in v1.0.2

type NewAnswerTemplateData struct {
	SiteName       string
	DisplayName    string
	QuestionTitle  string
	AnswerUrl      string
	AnswerSummary  string
	UnsubscribeUrl string
}

type NewAnswerTemplateRawData added in v1.0.2

type NewAnswerTemplateRawData struct {
	AnswerUserDisplayName string
	QuestionTitle         string
	QuestionID            string
	AnswerID              string
	AnswerSummary         string
	UnsubscribeCode       string
}

type NewCommentTemplateData added in v1.0.2

type NewCommentTemplateData struct {
	SiteName       string
	DisplayName    string
	QuestionTitle  string
	CommentUrl     string
	CommentSummary string
	UnsubscribeUrl string
}

type NewCommentTemplateRawData added in v1.0.2

type NewCommentTemplateRawData struct {
	CommentUserDisplayName string
	QuestionTitle          string
	QuestionID             string
	AnswerID               string
	CommentID              string
	CommentSummary         string
	UnsubscribeCode        string
}

type NotificationClearIDRequest

type NotificationClearIDRequest struct {
	UserID string `json:"-"`
	ID     string `json:"id" form:"id"`
}

type NotificationClearRequest

type NotificationClearRequest struct {
	UserID            string `json:"-"`
	TypeStr           string `json:"type" form:"type"` // inbox achievement
	CanReviewQuestion bool   `json:"-"`
	CanReviewAnswer   bool   `json:"-"`
	CanReviewTag      bool   `json:"-"`
}

type NotificationContent

type NotificationContent struct {
	ID                 string         `json:"id"`
	TriggerUserID      string         `json:"-"` //show userid
	ReceiverUserID     string         `json:"-"` // receiver userid
	UserInfo           *UserBasicInfo `json:"user_info,omitempty"`
	ObjectInfo         ObjectInfo     `json:"object_info"`
	Rank               int            `json:"rank"`
	NotificationAction string         `json:"notification_action,omitempty"`
	Type               int            `json:"-"` //	1 inbox 2 achievement
	IsRead             bool           `json:"is_read"`
	UpdateTime         int64          `json:"update_time"`
}

type NotificationMsg

type NotificationMsg struct {
	// trigger notification user id
	TriggerUserID string
	// receive notification user id
	ReceiverUserID string
	// type 1 inbox 2 achievement
	Type int
	// notification title
	Title string
	// notification object
	ObjectID string
	// notification object type
	ObjectType string
	// notification action
	NotificationAction string
	// if true no need to send notification to all followers
	NoNeedPushAllFollow bool
}

NotificationMsg notification message

type NotificationSearch

type NotificationSearch struct {
	Page     int    `json:"page" form:"page"`           //Query number of pages
	PageSize int    `json:"page_size" form:"page_size"` //Search page size
	Type     int    `json:"-" form:"-"`
	TypeStr  string `json:"type" form:"type"` // inbox achievement
	UserID   string `json:"-"`
}

type ObjectInfo

type ObjectInfo struct {
	Title      string            `json:"title"`
	ObjectID   string            `json:"object_id"`
	ObjectMap  map[string]string `json:"object_map"`
	ObjectType string            `json:"object_type"`
}

type ObjectTimelineDetail added in v0.5.0

type ObjectTimelineDetail struct {
	Title           string               `json:"title"`
	Tags            []*ObjectTimelineTag `json:"tags"`
	OriginalText    string               `json:"original_text"`
	SlugName        string               `json:"slug_name"`
	MainTagSlugName string               `json:"main_tag_slug_name"`
}

ObjectTimelineDetail object timeline detail

type ObjectTimelineTag added in v0.5.0

type ObjectTimelineTag struct {
	SlugName        string `json:"slug_name"`
	DisplayName     string `json:"display_name"`
	MainTagSlugName string `json:"main_tag_slug_name"`
	Recommend       bool   `json:"recommend"`
	Reserved        bool   `json:"reserved"`
}

ObjectTimelineTag object timeline tags

type Operation

type Operation struct {
	Type        string         `json:"type"`
	Description string         `json:"description"`
	Msg         string         `json:"msg"`
	Time        int64          `json:"time"`
	Level       OperationLevel `json:"level"`
}

type OperationLevel added in v1.0.6

type OperationLevel string
const (
	OperationLevelInfo    OperationLevel = "info"
	OperationLevelDanger  OperationLevel = "danger"
	OperationLevelWarning OperationLevel = "warning"
)

type Paginator added in v1.0.0

type Paginator struct {
	Pages      []int
	Totalpages int
	Prevpage   int
	Nextpage   int
	Currpage   int
}

type PermissionMemberAction

type PermissionMemberAction struct {
	Action string `json:"action"`
	Name   string `json:"name"`
	Type   string `json:"type"`
}

PermissionMemberAction permission member action

type PostRenderReq added in v1.0.3

type PostRenderReq struct {
	Content string `json:"content"`
}

PostRenderReq post render request

type QAPageJsonLD added in v1.0.0

type QAPageJsonLD struct {
	Context    string `json:"@context"`
	Type       string `json:"@type"`
	MainEntity struct {
		Type        string    `json:"@type"`
		Name        string    `json:"name"`
		Text        string    `json:"text"`
		AnswerCount int       `json:"answerCount"`
		UpvoteCount int       `json:"upvoteCount"`
		DateCreated time.Time `json:"dateCreated"`
		Author      struct {
			Type string `json:"@type"`
			Name string `json:"name"`
		} `json:"author"`
		AcceptedAnswer  *AcceptedAnswerItem    `json:"acceptedAnswer,omitempty"`
		SuggestedAnswer []*SuggestedAnswerItem `json:"suggestedAnswer"`
	} `json:"mainEntity"`
}

type QuestionAdd

type QuestionAdd struct {
	// question title
	Title string `validate:"required,notblank,gte=6,lte=150" json:"title"`
	// content
	Content string `validate:"required,notblank,gte=6,lte=65535" json:"content"`
	// html
	HTML string `json:"-"`
	// tags
	Tags []*TagItem `validate:"required,dive" json:"tags"`
	// user id
	UserID string `json:"-"`
	QuestionPermission
}

func (*QuestionAdd) Check added in v1.0.0

func (req *QuestionAdd) Check() (errFields []*validator.FormErrorField, err error)

type QuestionBaseInfo

type QuestionBaseInfo struct {
	ID              string `json:"id" `
	Title           string `json:"title" xorm:"title"`                       // title
	ViewCount       int    `json:"view_count" xorm:"view_count"`             // view count
	AnswerCount     int    `json:"answer_count" xorm:"answer_count"`         // answer count
	CollectionCount int    `json:"collection_count" xorm:"collection_count"` // collection count
	FollowCount     int    `json:"follow_count" xorm:"follow_count"`         // follow count
	Status          string `json:"status"`
	AcceptedAnswer  bool   `json:"accepted_answer"`
}

type QuestionInfo

type QuestionInfo struct {
	ID                   string         `json:"id" `
	Title                string         `json:"title" xorm:"title"`                         // title
	UrlTitle             string         `json:"url_title" xorm:"url_title"`                 // title
	Content              string         `json:"content" xorm:"content"`                     // content
	HTML                 string         `json:"html" xorm:"html"`                           // html
	Description          string         `json:"description"`                                //description
	Tags                 []*TagResp     `json:"tags" `                                      // tags
	ViewCount            int            `json:"view_count" xorm:"view_count"`               // view_count
	UniqueViewCount      int            `json:"unique_view_count" xorm:"unique_view_count"` // unique_view_count
	VoteCount            int            `json:"vote_count" xorm:"vote_count"`               // vote_count
	AnswerCount          int            `json:"answer_count" xorm:"answer_count"`           // answer count
	CollectionCount      int            `json:"collection_count" xorm:"collection_count"`   // collection count
	FollowCount          int            `json:"follow_count" xorm:"follow_count"`           // follow count
	AcceptedAnswerID     string         `json:"accepted_answer_id" `                        // accepted_answer_id
	LastAnswerID         string         `json:"last_answer_id" `                            // last_answer_id
	CreateTime           int64          `json:"create_time" `                               // create_time
	UpdateTime           int64          `json:"-"`                                          // update_time
	PostUpdateTime       int64          `json:"update_time"`
	QuestionUpdateTime   int64          `json:"edit_time"`
	Status               int            `json:"status"`
	Operation            *Operation     `json:"operation,omitempty"`
	UserID               string         `json:"-" `
	LastEditUserID       string         `json:"-" `
	LastAnsweredUserID   string         `json:"-" `
	UserInfo             *UserBasicInfo `json:"user_info"`
	UpdateUserInfo       *UserBasicInfo `json:"update_user_info,omitempty"`
	LastAnsweredUserInfo *UserBasicInfo `json:"last_answered_user_info,omitempty"`
	Answered             bool           `json:"answered"`
	Collected            bool           `json:"collected"`
	VoteStatus           string         `json:"vote_status"`
	IsFollowed           bool           `json:"is_followed"`

	// MemberActions
	MemberActions []*PermissionMemberAction `json:"member_actions"`
}

type QuestionPageReq added in v1.0.2

type QuestionPageReq struct {
	Page      int    `validate:"omitempty,min=1" form:"page"`
	PageSize  int    `validate:"omitempty,min=1" form:"page_size"`
	OrderCond string `validate:"omitempty,oneof=newest active frequent score unanswered" form:"order"`
	Tag       string `validate:"omitempty,gt=0,lte=100" form:"tag"`
	Username  string `validate:"omitempty,gt=0,lte=100" form:"username"`

	LoginUserID      string `json:"-"`
	UserIDBeSearched string `json:"-"`
	TagID            string `json:"-"`
}

QuestionPageReq query questions page

type QuestionPageResp added in v1.0.2

type QuestionPageResp struct {
	ID          string     `json:"id" `
	CreatedAt   int64      `json:"created_at"`
	Title       string     `json:"title"`
	UrlTitle    string     `json:"url_title"`
	Description string     `json:"description"`
	Status      int        `json:"status"`
	Tags        []*TagResp `json:"tags"`

	// question statistical information
	ViewCount       int `json:"view_count"`
	UniqueViewCount int `json:"unique_view_count"`
	VoteCount       int `json:"vote_count"`
	AnswerCount     int `json:"answer_count"`
	CollectionCount int `json:"collection_count"`
	FollowCount     int `json:"follow_count"`

	// answer information
	AcceptedAnswerID   string    `json:"accepted_answer_id"`
	LastAnswerID       string    `json:"last_answer_id"`
	LastAnsweredUserID string    `json:"-"`
	LastAnsweredAt     time.Time `json:"-"`

	// operator information
	OperatedAt    int64                     `json:"operated_at"`
	Operator      *QuestionPageRespOperator `json:"operator"`
	OperationType string                    `json:"operation_type"`
}

type QuestionPageRespOperator added in v1.0.2

type QuestionPageRespOperator struct {
	ID          string `json:"id"`
	Username    string `json:"username"`
	Rank        int    `json:"rank"`
	DisplayName string `json:"display_name"`
}

type QuestionPermission added in v0.5.0

type QuestionPermission struct {
	// whether user can add it
	CanAdd bool `json:"-"`
	// whether user can edit it
	CanEdit bool `json:"-"`
	// whether user can delete it
	CanDelete bool `json:"-"`
	// whether user can close it
	CanClose bool `json:"-"`
	// whether user can reopen it
	CanReopen bool `json:"-"`
	// whether user can use reserved it
	CanUseReservedTag bool `json:"-"`
}

type QuestionUpdate

type QuestionUpdate struct {
	// question id
	ID string `validate:"required" json:"id"`
	// question title
	Title string `validate:"required,notblank,gte=6,lte=150" json:"title"`
	// content
	Content string `validate:"required,notblank,gte=6,lte=65535" json:"content"`
	// html
	HTML string `json:"-"`
	// tags
	Tags []*TagItem `validate:"required,dive" json:"tags"`
	// edit summary
	EditSummary string `validate:"omitempty" json:"edit_summary"`
	// user id
	UserID       string `json:"-"`
	NoNeedReview bool   `json:"-"`
	QuestionPermission
}

func (*QuestionUpdate) Check added in v1.0.0

func (req *QuestionUpdate) Check() (errFields []*validator.FormErrorField, err error)

type ReasonItem

type ReasonItem struct {
	ReasonType  int    `json:"reason_type"`
	Name        string `json:"name"`
	Description string `json:"description"`
	ContentType string `json:"content_type"`
	Placeholder string `json:"placeholder"`
}

type ReasonReq

type ReasonReq struct {
	// ObjectType
	ObjectType string `validate:"required" form:"object_type" json:"object_type"`
	// Action
	Action string `validate:"required" form:"action" json:"action"`
}

type RedDot

type RedDot struct {
	Inbox       int64 `json:"inbox"`
	Achievement int64 `json:"achievement"`
	Revision    int64 `json:"revision"`
	CanRevision bool  `json:"can_revision"`
}

type RemoteVersion added in v0.3.0

type RemoteVersion struct {
	Release struct {
		Version string `json:"version"`
		URL     string `json:"url"`
	} `json:"release"`
}

type RemoveAnswerReq

type RemoveAnswerReq struct {
	// answer id
	ID string `validate:"required" json:"id"`
	// user id
	UserID  string `json:"-"`
	IsAdmin bool   `json:"-"`
}

RemoveAnswerReq delete answer request

type RemoveCommentReq

type RemoveCommentReq struct {
	// comment id
	CommentID string `validate:"required" json:"comment_id"`
	// user id
	UserID string `json:"-"`
}

RemoveCommentReq remove comment

type RemoveConfigReq

type RemoveConfigReq struct {
	// config id
	ID int `validate:"required" comment:"config id" json:"id"`
}

RemoveConfigReq delete config request

type RemoveQuestionReq

type RemoveQuestionReq struct {
	// question id
	ID      string `validate:"required" json:"id"`
	UserID  string `json:"-" ` // user_id
	IsAdmin bool   `json:"-"`
}

RemoveQuestionReq delete question request

type RemoveTagListReq

type RemoveTagListReq struct {
	// tag_list_id
	ID int64 `validate:"required" comment:"tag_list_id" json:"id"`
}

RemoveTagListReq delete tag list request

type RemoveTagReq

type RemoveTagReq struct {
	// tag_id
	TagID string `validate:"required" json:"tag_id"`
	// user id
	UserID string `json:"-"`
}

RemoveTagReq delete tag request

type ReopenQuestionReq added in v1.0.0

type ReopenQuestionReq struct {
	QuestionID string `json:"question_id"`
	UserID     string `json:"-"`
}

ReopenQuestionReq reopen question request

type ReportHandleReq

type ReportHandleReq struct {
	ID             string `validate:"required" comment:"report id" form:"id" json:"id"`
	FlaggedType    int    `validate:"required" comment:"flagged type" form:"flagged_type" json:"flagged_type"`
	FlaggedContent string `validate:"omitempty" comment:"flagged content" form:"flagged_content" json:"flagged_content"`
}

ReportHandleReq request handle request

type RevisionAuditReq added in v0.5.0

type RevisionAuditReq struct {
	// object id
	ID                string `validate:"required" comment:"id" form:"id"`
	Operation         string `validate:"required" comment:"operation" form:"operation"` //approve or reject
	UserID            string `json:"-"`
	CanReviewQuestion bool   `json:"-"`
	CanReviewAnswer   bool   `json:"-"`
	CanReviewTag      bool   `json:"-"`
}

type RevisionSearch added in v0.5.0

type RevisionSearch struct {
	Page              int    `json:"page" form:"page"` // Query number of pages
	CanReviewQuestion bool   `json:"-"`
	CanReviewAnswer   bool   `json:"-"`
	CanReviewTag      bool   `json:"-"`
	UserID            string `json:"-"`
}

func (RevisionSearch) GetCanReviewObjectTypes added in v0.5.0

func (r RevisionSearch) GetCanReviewObjectTypes() []int

type SearchDTO

type SearchDTO struct {
	UserID string // UserID current login user ID
	Query  string `validate:"required,gte=1,lte=60" json:"q" form:"q"`                   // Query the query string
	Page   int    `validate:"omitempty,min=1" form:"page,default=1" json:"page"`         //Query number of pages
	Size   int    `validate:"omitempty,min=1,max=50" form:"size,default=30" json:"size"` //Search page size
	Order  string ``                                                                     /* 137-byte string literal not displayed */
}

type SearchListResp

type SearchListResp struct {
	Total int64 `json:"count"`
	// search response
	SearchResp []SearchResp `json:"list"`
	// extra fields
	Extra interface{} `json:"extra"`
}

type SearchObject

type SearchObject struct {
	ID              string `json:"id"`
	QuestionID      string `json:"question_id"`
	Title           string `json:"title"`
	Excerpt         string `json:"excerpt"`
	CreatedAtParsed int64  `json:"created_at"`
	VoteCount       int    `json:"vote_count"`
	Accepted        bool   `json:"accepted"`
	AnswerCount     int    `json:"answer_count"`
	// user info
	UserInfo *UserBasicInfo `json:"user_info"`
	// tags
	Tags []TagResp `json:"tags"`
	// Status
	StatusStr string `json:"status"`
}

type SearchResp

type SearchResp struct {
	// object_type
	ObjectType string `json:"object_type"`
	// this object
	Object SearchObject `json:"object"`
}

type SearchTagLikeReq

type SearchTagLikeReq struct {
	// tag
	Tag     string `validate:"omitempty" form:"tag"`
	IsAdmin bool   `json:"-"`
}

SearchTagLikeReq get tag list all request

type SearchTagLikeResp added in v0.4.0

type SearchTagLikeResp struct {
	SlugName  string `json:"slug_name"`
	Recommend bool   `json:"recommend"`
	Reserved  bool   `json:"reserved"`
}

type SearchTagsBySlugName added in v1.0.5

type SearchTagsBySlugName struct {
	Tags    string   `json:"tags" form:"tags"`
	TagList []string `json:"-"`
	IsAdmin bool     `json:"-"`
}

type SimpleObjectInfo

type SimpleObjectInfo struct {
	ObjectID            string `json:"object_id"`
	ObjectCreatorUserID string `json:"object_creator_user_id"`
	QuestionID          string `json:"question_id"`
	AnswerID            string `json:"answer_id"`
	CommentID           string `json:"comment_id"`
	TagID               string `json:"tag_id"`
	ObjectType          string `json:"object_type"`
	Title               string `json:"title"`
	Content             string `json:"content"`
}

SimpleObjectInfo simple object info

type SiteBrandingReq added in v0.4.0

type SiteBrandingReq struct {
	SquareIcon string `validate:"omitempty,gt=0,lte=512" form:"square_icon" json:"square_icon"`
	Favicon    string `validate:"omitempty,gt=0,lte=512" form:"favicon" json:"favicon"`
}

SiteBrandingReq site branding request

type SiteBrandingResp added in v0.4.0

type SiteBrandingResp SiteBrandingReq

SiteBrandingResp site branding response

type SiteCustomCssHTMLReq added in v1.0.0

type SiteCustomCssHTMLReq struct {
	CustomHead   string `validate:"omitempty,gt=0,lte=65536" json:"custom_head"`
	CustomCss    string `validate:"omitempty,gt=0,lte=65536" json:"custom_css"`
	CustomHeader string `validate:"omitempty,gt=0,lte=65536" json:"custom_header"`
	CustomFooter string `validate:"omitempty,gt=0,lte=65536" json:"custom_footer"`
}

SiteCustomCssHTMLReq site custom css html

type SiteCustomCssHTMLResp added in v1.0.0

type SiteCustomCssHTMLResp SiteCustomCssHTMLReq

SiteCustomCssHTMLResp site custom css html response

type SiteGeneralReq

type SiteGeneralReq struct {
	Name             string `validate:"required,sanitizer,gt=1,lte=128" form:"name" json:"name"`
	ShortDescription string `validate:"omitempty,sanitizer,gt=3,lte=255" form:"short_description" json:"short_description"`
	Description      string `validate:"omitempty,sanitizer,gt=3,lte=2000" form:"description" json:"description"`
	SiteUrl          string `validate:"required,sanitizer,gt=1,lte=512,url" form:"site_url" json:"site_url"`
	ContactEmail     string `validate:"required,sanitizer,gt=1,lte=512,email" form:"contact_email" json:"contact_email"`
}

SiteGeneralReq site general request

func (*SiteGeneralReq) FormatSiteUrl added in v0.3.0

func (r *SiteGeneralReq) FormatSiteUrl()

type SiteGeneralResp

type SiteGeneralResp SiteGeneralReq

SiteGeneralResp site general response

type SiteInfoResp

type SiteInfoResp struct {
	General       *SiteGeneralResp       `json:"general"`
	Interface     *SiteInterfaceResp     `json:"interface"`
	Branding      *SiteBrandingResp      `json:"branding"`
	Login         *SiteLoginResp         `json:"login"`
	Theme         *SiteThemeResp         `json:"theme"`
	CustomCssHtml *SiteCustomCssHTMLResp `json:"custom_css_html"`
	SiteSeo       *SiteSeoReq            `json:"site_seo"`
	Version       string                 `json:"version"`
}

SiteInfoResp get site info response

type SiteInterfaceReq

type SiteInterfaceReq struct {
	Language string `validate:"required,gt=1,lte=128" form:"language" json:"language"`
	TimeZone string `validate:"required,gt=1,lte=128" form:"time_zone" json:"time_zone"`
}

SiteInterfaceReq site interface request

type SiteInterfaceResp

type SiteInterfaceResp SiteInterfaceReq

SiteInterfaceResp site interface response

type SiteLegalReq added in v0.4.0

type SiteLegalReq struct {
	TermsOfServiceOriginalText string `json:"terms_of_service_original_text"`
	TermsOfServiceParsedText   string `json:"terms_of_service_parsed_text"`
	PrivacyPolicyOriginalText  string `json:"privacy_policy_original_text"`
	PrivacyPolicyParsedText    string `json:"privacy_policy_parsed_text"`
}

SiteLegalReq site branding request

type SiteLegalResp added in v0.4.0

type SiteLegalResp SiteLegalReq

SiteLegalResp site write response

type SiteLoginReq added in v1.0.0

type SiteLoginReq struct {
	AllowNewRegistrations bool `json:"allow_new_registrations"`
	LoginRequired         bool `json:"login_required"`
}

SiteLoginReq site login request

type SiteLoginResp added in v1.0.0

type SiteLoginResp SiteLoginReq

SiteLoginResp site login response

type SiteMapList added in v1.0.0

type SiteMapList struct {
	QuestionIDs []*SiteMapQuestionInfo `json:"question_ids"`
	MaxPageNum  []int                  `json:"max_page_num"`
}

type SiteMapPageList added in v1.0.0

type SiteMapPageList struct {
	PageData []*SiteMapQuestionInfo `json:"page_data"`
}

type SiteMapQuestionInfo added in v1.0.0

type SiteMapQuestionInfo struct {
	ID         string `json:"id"`
	Title      string `json:"title"`
	UpdateTime string `json:"time"`
}

type SiteSeoReq added in v1.0.0

type SiteSeoReq struct {
	PermaLink int    `validate:"required,lte=3,gte=0" form:"permalink" json:"permalink"`
	Robots    string `validate:"required" form:"robots" json:"robots"`
}

type SiteSeoResp added in v1.0.0

type SiteSeoResp SiteSeoReq

SiteSeoResp site write response

type SiteThemeReq added in v1.0.0

type SiteThemeReq struct {
	Theme       string                 `validate:"required,gt=0,lte=255" json:"theme"`
	ThemeConfig map[string]interface{} `validate:"omitempty" json:"theme_config"`
}

SiteThemeReq site theme config

type SiteThemeResp added in v1.0.0

type SiteThemeResp struct {
	ThemeOptions []*ThemeOption         `json:"theme_options"`
	Theme        string                 `json:"theme"`
	ThemeConfig  map[string]interface{} `json:"theme_config"`
}

SiteThemeResp site theme response

func (*SiteThemeResp) TrTheme added in v1.0.0

func (s *SiteThemeResp) TrTheme(ctx context.Context)

type SiteWriteReq added in v0.4.0

type SiteWriteReq struct {
	RequiredTag   bool     `validate:"omitempty" form:"required_tag" json:"required_tag"`
	RecommendTags []string `validate:"omitempty" form:"recommend_tags" json:"recommend_tags"`
	ReservedTags  []string `validate:"omitempty" form:"reserved_tags" json:"reserved_tags"`
	UserID        string   `json:"-"`
}

SiteWriteReq site write request

type SiteWriteResp added in v0.4.0

type SiteWriteResp SiteWriteReq

SiteWriteResp site write response

type SourceType added in v1.0.2

type SourceType string
const (
	AccountActivationSourceType SourceType = "account-activation"
	PasswordResetSourceType     SourceType = "password-reset"
	ConfirmNewEmailSourceType   SourceType = "password-reset"
	UnsubscribeSourceType       SourceType = "unsubscribe"
)

type SuggestedAnswerItem added in v1.0.0

type SuggestedAnswerItem struct {
	Type        string    `json:"@type"`
	Text        string    `json:"text"`
	DateCreated time.Time `json:"dateCreated"`
	UpvoteCount int       `json:"upvoteCount"`
	URL         string    `json:"url"`
	Author      struct {
		Type string `json:"@type"`
		Name string `json:"name"`
	} `json:"author"`
}

type TagChange

type TagChange struct {
	ObjectID string     `json:"object_id"` // object_id
	Tags     []*TagItem `json:"tags"`      // tags name
	// user id
	UserID string `json:"-"`
}

type TagItem

type TagItem struct {
	// slug_name
	SlugName string `validate:"omitempty,gt=0,lte=35" json:"slug_name"`
	// display_name
	DisplayName string `validate:"omitempty,gt=0,lte=35" json:"display_name"`
	// original text
	OriginalText string `validate:"omitempty" json:"original_text"`
	// parsed text
	ParsedText string `json:"-"`
}

type TagResp

type TagResp struct {
	ID          string `json:"-"`
	SlugName    string `json:"slug_name"`
	DisplayName string `json:"display_name"`
	// if main tag slug name is not empty, this tag is synonymous with the main tag
	MainTagSlugName string `json:"main_tag_slug_name"`
	Recommend       bool   `json:"recommend"`
	Reserved        bool   `json:"reserved"`
}

type TagSynonym added in v0.5.0

type TagSynonym struct {
	// tag id
	TagID string `json:"tag_id"`
	// slug name
	SlugName string `json:"slug_name"`
	// display name
	DisplayName string `json:"display_name"`
	// if main tag slug name is not empty, this tag is synonymous with the main tag
	MainTagSlugName string `json:"main_tag_slug_name"`
}

type TemplateSiteInfoResp added in v1.0.0

type TemplateSiteInfoResp struct {
	General       *SiteGeneralResp       `json:"general"`
	Interface     *SiteInterfaceResp     `json:"interface"`
	Branding      *SiteBrandingResp      `json:"branding"`
	SiteSeo       *SiteSeoReq            `json:"site_seo"`
	CustomCssHtml *SiteCustomCssHTMLResp `json:"custom_css_html"`
	Title         string
	Year          string
	Canonical     string
	JsonLD        string
	Keywords      string
	Description   string
}

type ThemeOption added in v1.0.0

type ThemeOption struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

ThemeOption get label option

type UnreviewedRevisionInfoInfo added in v0.5.0

type UnreviewedRevisionInfoInfo struct {
	ObjectID string     `json:"object_id"`
	Title    string     `json:"title"`
	Content  string     `json:"content"`
	Html     string     `json:"html"`
	Tags     []*TagResp `json:"tags"`
}

type UpdateCollectionGroupReq

type UpdateCollectionGroupReq struct {
	//
	ID int64 `validate:"required" comment:"" json:"id"`
	//
	UserID int64 `validate:"omitempty" comment:"" json:"user_id"`
	// the collection group name
	Name string `validate:"omitempty,gt=0,lte=50" comment:"the collection group name" json:"name"`
	// mark this group is default, default 1
	DefaultGroup int `validate:"omitempty" comment:"mark this group is default, default 1" json:"default_group"`
	//
	CreateTime time.Time `validate:"omitempty" comment:"" json:"create_time"`
	//
	UpdateTime time.Time `validate:"omitempty" comment:"" json:"update_time"`
}

UpdateCollectionGroupReq update collection group request

type UpdateCommentReq

type UpdateCommentReq struct {
	// comment id
	CommentID string `validate:"required" json:"comment_id"`
	// original comment content
	OriginalText string `validate:"required,notblank,gte=2,lte=600" json:"original_text"`
	// parsed comment content
	ParsedText string `json:"-"`
	// user id
	UserID  string `json:"-"`
	IsAdmin bool   `json:"-"`

	CanAdd bool `json:"-"`
	// whether user can edit it
	CanEdit bool `json:"-"`
	// whether user can delete it
	CanDelete bool `json:"-"`
}

UpdateCommentReq update comment request

func (*UpdateCommentReq) Check added in v1.0.0

func (req *UpdateCommentReq) Check() (errFields []*validator.FormErrorField, err error)

type UpdateConfigReq

type UpdateConfigReq struct {
	// config id
	ID int `validate:"required" comment:"config id" json:"id"`
	// the config key
	Key string `validate:"omitempty,gt=0,lte=32" comment:"the config key" json:"key"`
	// the config value, custom data structures and types
	Value string `validate:"omitempty,gt=0,lte=128" comment:"the config value, custom data structures and types" json:"value"`
}

UpdateConfigReq update config request

type UpdateFollowTagsReq

type UpdateFollowTagsReq struct {
	// tag slug name list
	SlugNameList []string `json:"slug_name_list"`
	// user id
	UserID string `json:"-"`
}

UpdateFollowTagsReq update user follow tags

type UpdateInfoRequest

type UpdateInfoRequest struct {
	// display_name
	DisplayName string `validate:"required,gt=0,lte=30" json:"display_name"`
	// username
	Username string `validate:"omitempty,gt=3,lte=30" json:"username"`
	// avatar
	Avatar AvatarInfo `json:"avatar"`
	// bio
	Bio string `validate:"omitempty,gt=0,lte=4096" json:"bio"`
	// bio
	BioHTML string `json:"-"`
	// website
	Website string `validate:"omitempty,gt=0,lte=500" json:"website"`
	// location
	Location string `validate:"omitempty,gt=0,lte=100" json:"location"`
	// user id
	UserID string `json:"-" `
}

func (*UpdateInfoRequest) Check

func (req *UpdateInfoRequest) Check() (errFields []*validator.FormErrorField, err error)

type UpdateQuestionResp added in v0.5.0

type UpdateQuestionResp struct {
	WaitForReview bool `json:"wait_for_review"`
}

UpdateQuestionResp update question resp

type UpdateSMTPConfigReq

type UpdateSMTPConfigReq struct {
	FromEmail          string `validate:"omitempty,gt=0,lte=256" json:"from_email"`
	FromName           string `validate:"omitempty,gt=0,lte=256" json:"from_name"`
	SMTPHost           string `validate:"omitempty,gt=0,lte=256" json:"smtp_host"`
	SMTPPort           int    `validate:"omitempty,min=1,max=65535" json:"smtp_port"`
	Encryption         string `validate:"omitempty,oneof=SSL" json:"encryption"` // "" SSL
	SMTPUsername       string `validate:"omitempty,gt=0,lte=256" json:"smtp_username"`
	SMTPPassword       string `validate:"omitempty,gt=0,lte=256" json:"smtp_password"`
	SMTPAuthentication bool   `validate:"omitempty" json:"smtp_authentication"`
	TestEmailRecipient string `validate:"omitempty,email" json:"test_email_recipient"`
}

UpdateSMTPConfigReq get smtp config request

func (*UpdateSMTPConfigReq) Check added in v1.0.2

func (r *UpdateSMTPConfigReq) Check() (errField []*validator.FormErrorField, err error)

type UpdateTagListReq

type UpdateTagListReq struct {
	// tag_list_id
	ID int64 `validate:"required" comment:"tag_list_id" json:"id"`
	// tag_id
	TagID int64 `validate:"omitempty" comment:"tag_id" json:"tag_id"`
	// object_id
	ObjectID int64 `validate:"omitempty" comment:"object_id" json:"object_id"`
	// tag_list_status(available: 1; deleted: 10)
	Status int `validate:"omitempty" comment:"tag_list_status(available: 1; deleted: 10)" json:"status"`
}

UpdateTagListReq update tag list request

type UpdateTagReq

type UpdateTagReq struct {
	// tag_id
	TagID string `validate:"required" json:"tag_id"`
	// slug_name
	SlugName string `validate:"omitempty,gt=0,lte=35" json:"slug_name"`
	// display_name
	DisplayName string `validate:"omitempty,gt=0,lte=35" json:"display_name"`
	// original text
	OriginalText string `validate:"omitempty" json:"original_text"`
	// parsed text
	ParsedText string `json:"-"`
	// edit summary
	EditSummary string `validate:"omitempty" json:"edit_summary"`
	// user id
	UserID       string `json:"-"`
	NoNeedReview bool   `json:"-"`
}

UpdateTagReq update tag request

func (*UpdateTagReq) Check

func (r *UpdateTagReq) Check() (errFields []*validator.FormErrorField, err error)

type UpdateTagResp added in v0.5.0

type UpdateTagResp struct {
	WaitForReview bool `json:"wait_for_review"`
}

UpdateTagResp update tag response

type UpdateTagSynonymReq

type UpdateTagSynonymReq struct {
	// tag_id
	TagID string `validate:"required" json:"tag_id"`
	// synonym tag list
	SynonymTagList []*TagItem `validate:"required,dive" json:"synonym_tag_list"`
	// user id
	UserID string `json:"-"`
}

UpdateTagSynonymReq update tag request

func (*UpdateTagSynonymReq) Format

func (req *UpdateTagSynonymReq) Format()

type UpdateUserInterfaceRequest added in v0.3.0

type UpdateUserInterfaceRequest struct {
	// language
	Language string `validate:"required,gt=1,lte=100" json:"language"`
	// user id
	UserId string `json:"-" `
}

UpdateUserInterfaceRequest update user interface request

type UpdateUserPasswordReq added in v1.0.0

type UpdateUserPasswordReq struct {
	UserID      string `validate:"required" json:"user_id"`
	Password    string `validate:"required,gte=8,lte=32" json:"password"`
	LoginUserID string `json:"-"`
}

UpdateUserPasswordReq update user password request

type UpdateUserRoleReq added in v1.0.0

type UpdateUserRoleReq struct {
	// user id
	UserID string `validate:"required" json:"user_id"`
	// role id
	RoleID int `validate:"required" json:"role_id"`
	// login user id
	LoginUserID string `json:"-"`
}

UpdateUserRoleReq update user role request

type UpdateUserStatusReq

type UpdateUserStatusReq struct {
	UserID      string `validate:"required" json:"user_id"`
	Status      string `validate:"required,oneof=normal suspended deleted inactive" json:"status" enums:"normal,suspended,deleted,inactive"`
	LoginUserID string `json:"-"`
}

UpdateUserStatusReq update user request

func (*UpdateUserStatusReq) IsDeleted

func (r *UpdateUserStatusReq) IsDeleted() bool

func (*UpdateUserStatusReq) IsInactive

func (r *UpdateUserStatusReq) IsInactive() bool

func (*UpdateUserStatusReq) IsNormal

func (r *UpdateUserStatusReq) IsNormal() bool

func (*UpdateUserStatusReq) IsSuspended

func (r *UpdateUserStatusReq) IsSuspended() bool

type UserAnswerInfo

type UserAnswerInfo struct {
	AnswerID     string `json:"answer_id"`
	QuestionID   string `json:"question_id"`
	Accepted     int    `json:"accepted"`
	VoteCount    int    `json:"vote_count"`
	CreateTime   int    `json:"create_time"`
	UpdateTime   int    `json:"update_time"`
	QuestionInfo struct {
		Title string        `json:"title"`
		Tags  []interface{} `json:"tags"`
	} `json:"question_info"`
}

type UserBasicInfo

type UserBasicInfo struct {
	ID          string `json:"id"`           // user_id
	Username    string `json:"username" `    // name
	Rank        int    `json:"rank" `        // rank
	DisplayName string `json:"display_name"` // display_name
	Avatar      string `json:"avatar" `      // avatar
	Website     string `json:"website" `     // website
	Location    string `json:"location" `    // location
	IPInfo      string `json:"ip_info"`      // ip info
	Status      string `json:"status"`       // status
}

type UserChangeEmailSendCodeReq

type UserChangeEmailSendCodeReq struct {
	UserVerifyEmailSendReq
	Email  string `validate:"required,email,gt=0,lte=500" json:"e_mail"`
	UserID string `json:"-"`
}

type UserChangeEmailVerifyReq

type UserChangeEmailVerifyReq struct {
	Code    string `validate:"required,gt=0,lte=500" json:"code"`
	Content string `json:"-"`
}

type UserEmailLogin

type UserEmailLogin struct {
	Email       string `validate:"required,email,gt=0,lte=500" json:"e_mail"` // e_mail
	Pass        string `validate:"required,gte=8,lte=32" json:"pass"`         // password
	CaptchaID   string `json:"captcha_id"`                                    // captcha_id
	CaptchaCode string `json:"captcha_code"`                                  // captcha_code
}

EmailLogin

type UserModifyPassWordRequest

type UserModifyPassWordRequest struct {
	UserID  string `json:"-" `        // user_id
	OldPass string `json:"old_pass" ` // old password
	Pass    string `json:"pass" `     // password
}

UserModifyPassWordRequest

func (*UserModifyPassWordRequest) Check

func (u *UserModifyPassWordRequest) Check() (errFields []*validator.FormErrorField, err error)

type UserNoticeSetRequest

type UserNoticeSetRequest struct {
	NoticeSwitch bool   `json:"notice_switch"`
	UserID       string `json:"-"`
}

type UserNoticeSetResp

type UserNoticeSetResp struct {
	NoticeSwitch bool `json:"notice_switch"`
}

type UserQuestionInfo

type UserQuestionInfo struct {
	ID               string        `json:"question_id"`
	Title            string        `json:"title"`
	VoteCount        int           `json:"vote_count"`
	Tags             []interface{} `json:"tags"`
	ViewCount        int           `json:"view_count"`
	AnswerCount      int           `json:"answer_count"`
	CollectionCount  int           `json:"collection_count"`
	CreatedAt        int64         `json:"created_at"`
	AcceptedAnswerID string        `json:"accepted_answer_id"`
	Status           string        `json:"status"`
}

type UserRankingResp added in v1.0.0

type UserRankingResp struct {
	UsersWithTheMostReputation []*UserRankingSimpleInfo `json:"users_with_the_most_reputation"`
	UsersWithTheMostVote       []*UserRankingSimpleInfo `json:"users_with_the_most_vote"`
	Staffs                     []*UserRankingSimpleInfo `json:"staffs"`
}

UserRankingResp user ranking response

type UserRankingSimpleInfo added in v1.0.0

type UserRankingSimpleInfo struct {
	// username
	Username string `json:"username"`
	// rank
	Rank int `json:"rank"`
	// vote
	VoteCount int `json:"vote_count"`
	// display name
	DisplayName string `json:"display_name"`
	// avatar
	Avatar string `json:"avatar"`
}

UserRankingSimpleInfo user ranking simple info

type UserRePassWordRequest

type UserRePassWordRequest struct {
	Code    string `validate:"required,gt=0,lte=100" json:"code" ` // code
	Pass    string `validate:"required,gt=0,lte=32" json:"pass" `  // Password
	Content string `json:"-"`
}

func (*UserRePassWordRequest) Check

func (u *UserRePassWordRequest) Check() (errFields []*validator.FormErrorField, err error)

type UserRegisterReq

type UserRegisterReq struct {
	// name
	Name string `validate:"required,gt=3,lte=30" json:"name"`
	// email
	Email string `validate:"required,email,gt=0,lte=500" json:"e_mail" `
	// password
	Pass        string `validate:"required,gte=8,lte=32" json:"pass"`
	IP          string `json:"-" `
	CaptchaID   string `json:"captcha_id"`   // captcha_id
	CaptchaCode string `json:"captcha_code"` // captcha_code
}

UserRegisterReq user register request

func (*UserRegisterReq) Check

func (u *UserRegisterReq) Check() (errFields []*validator.FormErrorField, err error)

type UserRetrievePassWordRequest

type UserRetrievePassWordRequest struct {
	Email       string `validate:"required,email,gt=0,lte=500" json:"e_mail" ` // e_mail
	CaptchaID   string `json:"captcha_id" `                                    // captcha_id
	CaptchaCode string `json:"captcha_code" `                                  // captcha_code
}

type UserUnsubscribeEmailNotificationReq added in v1.0.2

type UserUnsubscribeEmailNotificationReq struct {
	Code    string `validate:"required,gt=0,lte=500" json:"code"`
	Content string `json:"-"`
}

UserUnsubscribeEmailNotificationReq user unsubscribe email notification request

type UserVerifyEmailReq

type UserVerifyEmailReq struct {
	// code
	Code string `validate:"required,gt=0,lte=500" form:"code"`
	// content
	Content string `json:"-"`
}

UserVerifyEmailReq user verify email request

type UserVerifyEmailSendReq

type UserVerifyEmailSendReq struct {
	CaptchaID   string `validate:"omitempty,gt=0,lte=500" json:"captcha_id"`
	CaptchaCode string `validate:"omitempty,gt=0,lte=500" json:"captcha_code"`
}

type VoteAnswer

type VoteAnswer struct {
	// object ID
	ID string `json:"id"`
	// question ID
	QuestionID string `json:"question_id"`
	// title
	Title string `json:"title"`
}

type VoteDTO

type VoteDTO struct {
	// object TagID
	ObjectID string
	// is cancel
	IsCancel bool
	// user TagID
	UserID string
}

type VoteQuestion

type VoteQuestion struct {
	// object ID
	ID string `json:"id"`
	// title
	Title string `json:"title"`
}

type VoteReq

type VoteReq struct {
	ObjectID string `validate:"required" form:"object_id" json:"object_id"`  //	 id
	IsCancel bool   `validate:"omitempty" form:"is_cancel" json:"is_cancel"` // is cancel
	UserID   string `json:"-"`
}

type VoteResp

type VoteResp struct {
	UpVotes    int    `json:"up_votes"`
	DownVotes  int    `json:"down_votes"`
	Votes      int    `json:"votes"`
	VoteStatus string `json:"vote_status"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL