schema

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnswerAdoptedFailed = 1
	AnswerAdoptedEnable = 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 (
	MailStatePass   = 1
	MailStateVerifi = 2

	NoticeStatusOn  = 1
	NoticeStatusOff = 2

	ActionRecordTypeLogin    = "login"
	ActionRecordTypeEmail    = "e_mail"
	ActionRecordTypeFindPass = "find_pass"
)
View Source
const PermissionMemberActionTypeEdit = "edit"
View Source
const PermissionMemberActionTypeReason = "reason"

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 = []*GetThemeOption{
	{
		Label: "Default",
		Value: "default",
	},
	{
		Label: "Black",
		Value: "black",
	},
	{
		Label: "White",
		Value: "white",
	},
}
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 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 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" json:"original_text"`
	// parsed comment content
	ParsedText string `validate:"required" json:"parsed_text"`
	// @ user id list
	MentionUsernameList []string `validate:"omitempty" json:"mention_username_list"`
	// user id
	UserID string `json:"-"`
}

AddCommentReq add comment request

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
}

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 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"`
	Adopted      int            `json:"adopted"`
	UserID       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 AdminSetQuestionStatusRequest

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

type AnswerAddReq

type AnswerAddReq struct {
	QuestionID string `json:"question_id" ` // question_id
	Content    string `json:"content" `     // content
	HTML       string `json:"html" `        // html
	UserID     string `json:"-" `           // user_id
}

type AnswerAdoptedReq

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

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
	Adopted        int            `json:"adopted"`                        // 1 Failed 2 Adopted
	UserID         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"`

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

type AnswerList

type AnswerList 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
	LoginUserID string `json:"-" `
}

type AnswerUpdateReq

type AnswerUpdateReq struct {
	ID          string `json:"id"`                                // id
	QuestionID  string `json:"question_id" `                      // question_id
	UserID      string `json:"-" `                                // user_id
	Title       string `json:"title" `                            // title
	Content     string `json:"content"`                           // content
	HTML        string `json:"html" `                             // html
	EditSummary string `validate:"omitempty" json:"edit_summary"` // edit_summary
}

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 CloseQuestionMeta

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

type CloseQuestionReq

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

type CmsQuestionSearch

type CmsQuestionSearch 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 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 {
	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:"-"`
}

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"`
	// query condition
	QueryCond string `validate:"omitempty,oneof=vote" form:"query_cond"`
	// user id
	UserID string `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 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"`
	Has  bool                            `json:"has"`
}

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 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 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:"-"`
}

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"`
	// 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"`
}

GetTagSynonymsReq get tag synonyms request

type GetTagSynonymsResp

type GetTagSynonymsResp 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"`
}

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 GetThemeOption

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

GetThemeOption get label option

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"`
}

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"`
}

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 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
}

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 Operation

type Operation struct {
	OperationType        string `json:"operation_type"`
	OperationDescription string `json:"operation_description"`
	OperationMsg         string `json:"operation_msg"`
	OperationTime        int64  `json:"operation_time"`
}

type PermissionMemberAction

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

PermissionMemberAction permission member action

type QuestionAdd

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

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
	Content              string         `json:"content" xorm:"content"`                     // content
	HTML                 string         `json:"html" xorm:"html"`                           // html
	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:"-" `
	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 QuestionSearch

type QuestionSearch struct {
	Page     int    `json:"page" form:"page"`           // Query number of pages
	PageSize int    `json:"page_size" form:"page_size"` // Search page size
	Order    string `json:"order" form:"order"`         // Search order by
	// Tags     []string `json:"tags" form:"tags"`           // Search tag
	Tag      string   `json:"tag" form:"tag"`           //Search tag
	TagIDs   []string `json:"-" form:"-"`               // Search tag
	UserName string   `json:"username" form:"username"` // Search username
	UserID   string   `json:"-" form:"-"`
}

type QuestionUpdate

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

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"`
}

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:"-"`
}

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" comment:"question id" json:"id"`
	UserID string `json:"-" ` // user_id
}

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 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 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 SimpleObjectInfo

type SimpleObjectInfo struct {
	ObjectID      string `json:"object_id"`
	ObjectCreator string `json:"object_creator"`
	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:"required,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 SiteGeneralReq

type SiteGeneralReq struct {
	Name             string `validate:"required,gt=1,lte=128" form:"name" json:"name"`
	ShortDescription string `validate:"required,gt=3,lte=255" form:"short_description" json:"short_description"`
	Description      string `validate:"required,gt=3,lte=2000" form:"description" json:"description"`
	SiteUrl          string `validate:"required,gt=1,lte=512,url" form:"site_url" json:"site_url"`
	ContactEmail     string `validate:"required,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"`
}

SiteInfoResp get site info response

type SiteInterfaceReq

type SiteInterfaceReq struct {
	Theme    string `validate:"required,gt=1,lte=128" form:"theme" json:"theme"`
	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 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 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 `validate:"omitempty" json:"parsed_text"`
}

type TagResp

type TagResp struct {
	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 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:"omitempty" json:"original_text"`
	// parsed comment content
	ParsedText string `validate:"omitempty" json:"parsed_text"`
	// user id
	UserID string `json:"-"`
}

UpdateCommentReq update comment request

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=0,lte=30" json:"username"`
	// avatar
	Avatar AvatarInfo `json:"avatar"`
	// bio
	Bio string `validate:"omitempty,gt=0,lte=4096" json:"bio"`
	// bio
	BioHTML string `validate:"omitempty,gt=0,lte=4096" json:"bio_html"`
	// 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 (u *UpdateInfoRequest) Check() (errFields []*validator.FormErrorField, err error)

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

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 `validate:"omitempty" json:"parsed_text"`
	// edit summary
	EditSummary string `validate:"omitempty" json:"edit_summary"`
	// user id
	UserID string `json:"-"`
}

UpdateTagReq update tag request

func (*UpdateTagReq) Check

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

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 UpdateUserStatusReq

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

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"`
	Adopted      int    `json:"adopted"`
	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:"-" `           // 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 {
	UserID       string `json:"-" ` // user_id
	NoticeSwitch bool   `json:"notice_switch" `
}

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"`
	CreateTime       int           `json:"create_time"`
	AcceptedAnswerID string        `json:"accepted_answer_id"`
	Status           string        `json:"status"`
}

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=4,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:"-" `
}

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 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
}

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