controller

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

ProviderSetController is controller providers.

View Source
var SiteUrl = ""

Functions

func GetStyle added in v1.0.0

func GetStyle() (script, css string)

Types

type ActivityController added in v0.5.0

type ActivityController struct {
	// contains filtered or unexported fields
}

func NewActivityController added in v0.5.0

func NewActivityController(
	activityCommonService *activity_common.ActivityCommon,
	activityService *activity.ActivityService) *ActivityController

NewActivityController new activity controller.

func (*ActivityController) GetObjectTimeline added in v0.5.0

func (ac *ActivityController) GetObjectTimeline(ctx *gin.Context)

GetObjectTimeline get object timeline @Summary get object timeline @Description get object timeline @Tags Comment @Produce json @Param object_id query string false "object id" @Param tag_slug_name query string false "tag slug name" @Param object_type query string false "object type" Enums(question, answer, tag) @Param show_vote query boolean false "is show vote" @Success 200 {object} handler.RespBody{data=schema.GetObjectTimelineResp} @Router /answer/api/v1/activity/timeline [get]

func (*ActivityController) GetObjectTimelineDetail added in v0.5.0

func (ac *ActivityController) GetObjectTimelineDetail(ctx *gin.Context)

GetObjectTimelineDetail get object timeline detail @Summary get object timeline detail @Description get object timeline detail @Tags Comment @Produce json @Param revision_id query string true "revision id" @Success 200 {object} handler.RespBody{data=schema.GetObjectTimelineResp} @Router /answer/api/v1/activity/timeline/detail [get]

type AnswerController

type AnswerController struct {
	// contains filtered or unexported fields
}

AnswerController answer controller

func NewAnswerController

func NewAnswerController(answerService *service.AnswerService,
	rankService *rank.RankService,
	dashboardService *dashboard.DashboardService,
) *AnswerController

NewAnswerController new controller

func (*AnswerController) Accepted added in v1.0.1

func (ac *AnswerController) Accepted(ctx *gin.Context)

Accepted godoc @Summary Accepted @Description Accepted @Tags api-answer @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.AnswerAcceptedReq true "AnswerAcceptedReq" @Success 200 {string} string "" @Router /answer/api/v1/answer/acceptance [post]

func (*AnswerController) Add

func (ac *AnswerController) Add(ctx *gin.Context)

Add godoc @Summary Insert Answer @Description Insert Answer @Tags api-answer @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.AnswerAddReq true "AnswerAddReq" @Success 200 {string} string "" @Router /answer/api/v1/answer [post]

func (*AnswerController) AdminSetAnswerStatus

func (ac *AnswerController) AdminSetAnswerStatus(ctx *gin.Context)

AdminSetAnswerStatus godoc @Summary AdminSetAnswerStatus @Description Status:[available,deleted] @Tags admin @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.AdminSetAnswerStatusRequest true "AdminSetAnswerStatusRequest" @Router /answer/admin/api/answer/status [put] @Success 200 {object} handler.RespBody

func (*AnswerController) AnswerList

func (ac *AnswerController) AnswerList(ctx *gin.Context)

AnswerList godoc @Summary AnswerList @Description AnswerList <br> <b>order</b> (default or updated) @Tags api-answer @Security ApiKeyAuth @Accept json @Produce json @Param question_id query string true "question_id" @Param order query string true "order" @Param page query string true "page" @Param page_size query string true "page_size" @Success 200 {string} string "" @Router /answer/api/v1/answer/page [get]

func (*AnswerController) Get

func (ac *AnswerController) Get(ctx *gin.Context)

Get godoc @Summary Get Answer @Description Get Answer @Tags api-answer @Accept json @Produce json @Param id query string true "Answer TagID" default(1) @Router /answer/api/v1/answer/info [get] @Success 200 {string} string ""

func (*AnswerController) RemoveAnswer

func (ac *AnswerController) RemoveAnswer(ctx *gin.Context)

RemoveAnswer delete answer @Summary delete answer @Description delete answer @Tags api-answer @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.RemoveAnswerReq true "answer" @Success 200 {object} handler.RespBody @Router /answer/api/v1/answer [delete]

func (*AnswerController) Update

func (ac *AnswerController) Update(ctx *gin.Context)

Update godoc @Summary Update Answer @Description Update Answer @Tags api-answer @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.AnswerUpdateReq true "AnswerUpdateReq" @Success 200 {string} string "" @Router /answer/api/v1/answer [put]

type CollectionController

type CollectionController struct {
	// contains filtered or unexported fields
}

CollectionController collection controller

func NewCollectionController

func NewCollectionController(collectionService *service.CollectionService) *CollectionController

NewCollectionController new controller

func (*CollectionController) CollectionSwitch

func (cc *CollectionController) CollectionSwitch(ctx *gin.Context)

CollectionSwitch add collection @Summary add collection @Description add collection @Tags Collection @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.CollectionSwitchReq true "collection" @Success 200 {object} handler.RespBody{data=schema.CollectionSwitchResp} @Router /answer/api/v1/collection/switch [post]

type CommentController

type CommentController struct {
	// contains filtered or unexported fields
}

CommentController comment controller

func NewCommentController

func NewCommentController(
	commentService *comment.CommentService,
	rankService *rank.RankService) *CommentController

NewCommentController new controller

func (*CommentController) AddComment

func (cc *CommentController) AddComment(ctx *gin.Context)

AddComment add comment @Summary add comment @Description add comment @Tags Comment @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.AddCommentReq true "comment" @Success 200 {object} handler.RespBody{data=schema.GetCommentResp} @Router /answer/api/v1/comment [post]

func (*CommentController) GetComment

func (cc *CommentController) GetComment(ctx *gin.Context)

GetComment godoc @Summary get comment by id @Description get comment by id @Tags Comment @Produce json @Param id query string true "id" @Success 200 {object} handler.RespBody{data=pager.PageModel{list=[]schema.GetCommentResp}} @Router /answer/api/v1/comment [get]

func (*CommentController) GetCommentPersonalWithPage

func (cc *CommentController) GetCommentPersonalWithPage(ctx *gin.Context)

GetCommentPersonalWithPage user personal comment list @Summary user personal comment list @Description user personal comment list @Tags Comment @Produce json @Param page query int false "page" @Param page_size query int false "page size" @Param username query string false "username" @Success 200 {object} handler.RespBody{data=pager.PageModel{list=[]schema.GetCommentPersonalWithPageResp}} @Router /answer/api/v1/personal/comment/page [get]

func (*CommentController) GetCommentWithPage

func (cc *CommentController) GetCommentWithPage(ctx *gin.Context)

GetCommentWithPage get comment page @Summary get comment page @Description get comment page @Tags Comment @Produce json @Param page query int false "page" @Param page_size query int false "page size" @Param object_id query string true "object id" @Param query_cond query string false "query condition" Enums(vote) @Success 200 {object} handler.RespBody{data=pager.PageModel{list=[]schema.GetCommentResp}} @Router /answer/api/v1/comment/page [get]

func (*CommentController) RemoveComment

func (cc *CommentController) RemoveComment(ctx *gin.Context)

RemoveComment remove comment @Summary remove comment @Description remove comment @Tags Comment @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.RemoveCommentReq true "comment" @Success 200 {object} handler.RespBody @Router /answer/api/v1/comment [delete]

func (*CommentController) UpdateComment

func (cc *CommentController) UpdateComment(ctx *gin.Context)

UpdateComment update comment @Summary update comment @Description update comment @Tags Comment @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.UpdateCommentReq true "comment" @Success 200 {object} handler.RespBody @Router /answer/api/v1/comment [put]

type DashboardController added in v0.3.0

type DashboardController struct {
	// contains filtered or unexported fields
}

func NewDashboardController added in v0.3.0

func NewDashboardController(
	dashboardService *dashboard.DashboardService,
) *DashboardController

NewDashboardController new controller

func (*DashboardController) DashboardInfo added in v0.3.0

func (ac *DashboardController) DashboardInfo(ctx *gin.Context)

DashboardInfo godoc @Summary DashboardInfo @Description DashboardInfo @Tags admin @Accept json @Produce json @Security ApiKeyAuth @Router /answer/admin/api/dashboard [get] @Success 200 {object} handler.RespBody

type FollowController

type FollowController struct {
	// contains filtered or unexported fields
}

FollowController activity controller

func NewFollowController

func NewFollowController(followService *follow.FollowService) *FollowController

NewFollowController new controller

func (*FollowController) Follow

func (fc *FollowController) Follow(ctx *gin.Context)

Follow godoc @Summary follow object or cancel follow operation @Description follow object or cancel follow operation @Tags Activity @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.FollowReq true "follow" @Success 200 {object} handler.RespBody{data=schema.FollowResp} @Router /answer/api/v1/follow [post]

func (*FollowController) UpdateFollowTags

func (fc *FollowController) UpdateFollowTags(ctx *gin.Context)

UpdateFollowTags update user follow tags @Summary update user follow tags @Description update user follow tags @Tags Activity @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.UpdateFollowTagsReq true "follow" @Success 200 {object} handler.RespBody{} @Router /answer/api/v1/follow/tags [put]

type LangController

type LangController struct {
	// contains filtered or unexported fields
}

func NewLangController

func NewLangController(tr i18n.Translator, siteInfoService *siteinfo_common.SiteInfoCommonService) *LangController

NewLangController new language controller.

func (*LangController) GetAdminLangOptions added in v0.3.0

func (u *LangController) GetAdminLangOptions(ctx *gin.Context)

GetAdminLangOptions Get language options @Summary Get language options @Description Get language options @Tags Lang @Produce json @Success 200 {object} handler.RespBody{} @Router /answer/admin/api/language/options [get]

func (*LangController) GetLangMapping

func (u *LangController) GetLangMapping(ctx *gin.Context)

GetLangMapping get language config mapping @Summary get language config mapping @Description get language config mapping @Tags Lang @Param Accept-Language header string true "Accept-Language" @Produce json @Success 200 {object} handler.RespBody{} @Router /answer/api/v1/language/config [get]

func (*LangController) GetUserLangOptions added in v0.3.0

func (u *LangController) GetUserLangOptions(ctx *gin.Context)

GetUserLangOptions Get language options @Summary Get language options @Description Get language options @Tags Lang @Produce json @Success 200 {object} handler.RespBody{} @Router /answer/api/v1/language/options [get]

type NotificationController

type NotificationController struct {
	// contains filtered or unexported fields
}

NotificationController notification controller

func NewNotificationController

func NewNotificationController(
	notificationService *notification.NotificationService,
	rankService *rank.RankService,
) *NotificationController

NewNotificationController new controller

func (*NotificationController) ClearIDUnRead

func (nc *NotificationController) ClearIDUnRead(ctx *gin.Context)

ClearIDUnRead @Summary ClearUnRead @Description ClearUnRead @Tags Notification @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.NotificationClearIDRequest true "NotificationClearIDRequest" @Success 200 {object} handler.RespBody @Router /answer/api/v1/notification/read/state [put]

func (*NotificationController) ClearRedDot

func (nc *NotificationController) ClearRedDot(ctx *gin.Context)

ClearRedDot @Summary DelRedDot @Description DelRedDot @Tags Notification @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.NotificationClearRequest true "NotificationClearRequest" @Success 200 {object} handler.RespBody @Router /answer/api/v1/notification/status [put]

func (*NotificationController) ClearUnRead

func (nc *NotificationController) ClearUnRead(ctx *gin.Context)

ClearUnRead @Summary ClearUnRead @Description ClearUnRead @Tags Notification @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.NotificationClearRequest true "NotificationClearRequest" @Success 200 {object} handler.RespBody @Router /answer/api/v1/notification/read/state/all [put]

func (*NotificationController) GetList

func (nc *NotificationController) GetList(ctx *gin.Context)

GetList get notification list @Summary get notification list @Description get notification list @Tags Notification @Accept json @Produce json @Security ApiKeyAuth @Param page query int false "page size" @Param page_size query int false "page size" @Param type query string true "type" Enums(inbox,achievement) @Success 200 {object} handler.RespBody @Router /answer/api/v1/notification/page [get]

func (*NotificationController) GetRedDot

func (nc *NotificationController) GetRedDot(ctx *gin.Context)

GetRedDot @Summary GetRedDot @Description GetRedDot @Tags Notification @Accept json @Produce json @Security ApiKeyAuth @Success 200 {object} handler.RespBody @Router /answer/api/v1/notification/status [get]

type QuestionController

type QuestionController struct {
	// contains filtered or unexported fields
}

QuestionController question controller

func NewQuestionController

func NewQuestionController(
	questionService *service.QuestionService,
	answerService *service.AnswerService,
	rankService *rank.RankService,
) *QuestionController

NewQuestionController new controller

func (*QuestionController) AddQuestion

func (qc *QuestionController) AddQuestion(ctx *gin.Context)

AddQuestion add question @Summary add question @Description add question @Tags Question @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.QuestionAdd true "question" @Success 200 {object} handler.RespBody @Router /answer/api/v1/question [post]

func (*QuestionController) AddQuestionByAnswer added in v1.0.8

func (qc *QuestionController) AddQuestionByAnswer(ctx *gin.Context)

AddQuestionByAnswer add question @Summary add question and answer @Description add question and answer @Tags Question @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.QuestionAddByAnswer true "question" @Success 200 {object} handler.RespBody @Router /answer/api/v1/question/answer [post]

func (*QuestionController) AdminSearchAnswerList added in v1.0.1

func (qc *QuestionController) AdminSearchAnswerList(ctx *gin.Context)

AdminSearchAnswerList godoc @Summary AdminSearchAnswerList @Description Status:[available,deleted] @Tags admin @Accept json @Produce json @Security ApiKeyAuth @Param page query int false "page size" @Param page_size query int false "page size" @Param status query string false "user status" Enums(available,deleted) @Param query query string false "answer id or question title" @Param question_id query string false "question id" @Success 200 {object} handler.RespBody @Router /answer/admin/api/answer/page [get]

func (*QuestionController) AdminSearchList added in v1.0.1

func (qc *QuestionController) AdminSearchList(ctx *gin.Context)

AdminSearchList godoc @Summary AdminSearchList @Description Status:[available,closed,deleted] @Tags admin @Accept json @Produce json @Security ApiKeyAuth @Param page query int false "page size" @Param page_size query int false "page size" @Param status query string false "user status" Enums(available, closed, deleted) @Param query query string false "question id or title" @Success 200 {object} handler.RespBody @Router /answer/admin/api/question/page [get]

func (*QuestionController) AdminSetQuestionStatus

func (qc *QuestionController) AdminSetQuestionStatus(ctx *gin.Context)

AdminSetQuestionStatus godoc @Summary AdminSetQuestionStatus @Description Status:[available,closed,deleted] @Tags admin @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.AdminSetQuestionStatusRequest true "AdminSetQuestionStatusRequest" @Router /answer/admin/api/question/status [put] @Success 200 {object} handler.RespBody

func (*QuestionController) CloseMsgList

func (qc *QuestionController) CloseMsgList(ctx *gin.Context)

CloseMsgList close question msg list @Summary close question msg list @Description close question msg list @Tags Question @Accept json @Produce json @Security ApiKeyAuth @Success 200 {object} handler.RespBody @Router /answer/api/v1/question/closemsglist [get]

func (*QuestionController) CloseQuestion

func (qc *QuestionController) CloseQuestion(ctx *gin.Context)

CloseQuestion Close question @Summary Close question @Description Close question @Tags Question @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.CloseQuestionReq true "question" @Success 200 {object} handler.RespBody @Router /answer/api/v1/question/status [put]

func (*QuestionController) GetQuestion

func (qc *QuestionController) GetQuestion(ctx *gin.Context)

GetQuestion get question details @Summary get question details @Description get question details @Tags Question @Security ApiKeyAuth @Accept json @Produce json @Param id query string true "Question TagID" default(1) @Success 200 {string} string "" @Router /answer/api/v1/question/info [get]

func (*QuestionController) OperationQuestion added in v1.0.9

func (qc *QuestionController) OperationQuestion(ctx *gin.Context)

OperationQuestion Operation question @Summary Operation question @Description Operation question \n operation [pin unpin hide show] @Tags Question @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.OperationQuestionReq true "question" @Success 200 {object} handler.RespBody @Router /answer/api/v1/question/operation [put]

func (*QuestionController) QuestionPage added in v1.0.2

func (qc *QuestionController) QuestionPage(ctx *gin.Context)

QuestionPage get questions by page @Summary get questions by page @Description get questions by page @Tags Question @Accept json @Produce json @Param data body schema.QuestionPageReq true "QuestionPageReq" @Success 200 {object} handler.RespBody{data=pager.PageModel{list=[]schema.QuestionPageResp}} @Router /answer/api/v1/question/page [get]

func (*QuestionController) RemoveQuestion

func (qc *QuestionController) RemoveQuestion(ctx *gin.Context)

RemoveQuestion delete question @Summary delete question @Description delete question @Tags Question @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.RemoveQuestionReq true "question" @Success 200 {object} handler.RespBody @Router /answer/api/v1/question [delete]

func (*QuestionController) ReopenQuestion added in v1.0.0

func (qc *QuestionController) ReopenQuestion(ctx *gin.Context)

ReopenQuestion reopen question @Summary reopen question @Description reopen question @Tags Question @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.ReopenQuestionReq true "question" @Success 200 {object} handler.RespBody @Router /answer/api/v1/question/reopen [put]

func (*QuestionController) SearchByTitleLike

func (qc *QuestionController) SearchByTitleLike(ctx *gin.Context)

SearchByTitleLike add question title like @Summary add question title like @Description add question title like @Tags Question @Accept json @Produce json @Security ApiKeyAuth @Param title query string true "title" default(string) @Success 200 {object} handler.RespBody @Router /answer/api/v1/question/similar [get]

func (*QuestionController) SimilarQuestion

func (qc *QuestionController) SimilarQuestion(ctx *gin.Context)

SimilarQuestion godoc @Summary Search Similar Question @Description Search Similar Question @Tags Question @Accept json @Produce json @Param question_id query string true "question_id" default() @Success 200 {string} string "" @Router /answer/api/v1/question/similar/tag [get]

func (*QuestionController) UpdateQuestion

func (qc *QuestionController) UpdateQuestion(ctx *gin.Context)

UpdateQuestion update question @Summary update question @Description update question @Tags Question @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.QuestionUpdate true "question" @Success 200 {object} handler.RespBody @Router /answer/api/v1/question [put]

func (*QuestionController) UserAnswerList

func (qc *QuestionController) UserAnswerList(ctx *gin.Context)

UserAnswerList godoc @Summary UserAnswerList @Description UserAnswerList @Tags api-answer @Accept json @Produce json @Security ApiKeyAuth @Param username query string true "username" default(string) @Param order query string true "order" Enums(newest,score) @Param page query string true "page" default(0) @Param pagesize query string true "pagesize" default(20) @Success 200 {object} handler.RespBody @Router /answer/api/v1/personal/answer/page [get]

func (*QuestionController) UserCollectionList

func (qc *QuestionController) UserCollectionList(ctx *gin.Context)

UserCollectionList godoc @Summary UserCollectionList @Description UserCollectionList @Tags Collection @Accept json @Produce json @Security ApiKeyAuth @Param page query string true "page" default(0) @Param pagesize query string true "pagesize" default(20) @Success 200 {object} handler.RespBody @Router /answer/api/v1/personal/collection/page [get]

func (*QuestionController) UserList

func (qc *QuestionController) UserList(ctx *gin.Context)

UserList godoc @Summary UserList @Description UserList @Tags Question @Accept json @Produce json @Security ApiKeyAuth @Param username query string true "username" default(string) @Param order query string true "order" Enums(newest,score) @Param page query string true "page" default(0) @Param pagesize query string true "pagesize" default(20) @Success 200 {object} handler.RespBody @Router /personal/question/page [get]

func (*QuestionController) UserTop

func (qc *QuestionController) UserTop(ctx *gin.Context)

UserTop godoc @Summary UserTop @Description UserTop @Tags Question @Accept json @Produce json @Security ApiKeyAuth @Param username query string true "username" default(string) @Success 200 {object} handler.RespBody @Router /answer/api/v1/personal/qa/top [get]

type RankController

type RankController struct {
	// contains filtered or unexported fields
}

RankController rank controller

func NewRankController

func NewRankController(
	rankService *rank.RankService) *RankController

NewRankController new controller

func (*RankController) GetRankPersonalWithPage

func (cc *RankController) GetRankPersonalWithPage(ctx *gin.Context)

GetRankPersonalWithPage user personal rank list @Summary user personal rank list @Description user personal rank list @Tags Rank @Produce json @Param page query int false "page" @Param page_size query int false "page size" @Param username query string false "username" @Success 200 {object} handler.RespBody{data=pager.PageModel{list=[]schema.GetRankPersonalWithPageResp}} @Router /answer/api/v1/personal/rank/page [get]

type ReasonController

type ReasonController struct {
	// contains filtered or unexported fields
}

ReasonController answer controller

func NewReasonController

func NewReasonController(answerService *reason.ReasonService) *ReasonController

NewReasonController new controller

func (*ReasonController) Reasons

func (rc *ReasonController) Reasons(ctx *gin.Context)

Reasons godoc @Summary get reasons by object type and action @Description get reasons by object type and action @Tags reason @Accept json @Produce json @Security ApiKeyAuth @Param object_type query string true "object_type" Enums(question, answer, comment, user) @Param action query string true "action" Enums(status, close, flag, review) @Success 200 {object} handler.RespBody @Router /answer/api/v1/reasons [get] @Router /answer/admin/api/reasons [get]

type ReportController

type ReportController struct {
	// contains filtered or unexported fields
}

ReportController report controller

func NewReportController

func NewReportController(reportService *report.ReportService, rankService *rank.RankService) *ReportController

NewReportController new controller

func (*ReportController) AddReport

func (rc *ReportController) AddReport(ctx *gin.Context)

AddReport add report @Summary add report @Description add report <br> source (question, answer, comment, user) @Security ApiKeyAuth @Tags Report @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.AddReportReq true "report" @Success 200 {object} handler.RespBody @Router /answer/api/v1/report [post]

func (*ReportController) GetReportTypeList

func (rc *ReportController) GetReportTypeList(ctx *gin.Context)

GetReportTypeList get report type list @Summary get report type list @Description get report type list @Tags Report @Produce json @Param source query string true "report source" Enums(question, answer, comment, user) @Success 200 {object} handler.RespBody{data=[]schema.GetReportTypeResp} @Router /answer/api/v1/report/type/list [get]

type RevisionController

type RevisionController struct {
	// contains filtered or unexported fields
}

RevisionController revision controller

func NewRevisionController

func NewRevisionController(
	revisionListService *service.RevisionService,
	rankService *rank.RankService,
) *RevisionController

NewRevisionController new controller

func (*RevisionController) CheckCanUpdateRevision added in v0.5.0

func (rc *RevisionController) CheckCanUpdateRevision(ctx *gin.Context)

CheckCanUpdateRevision check can update revision @Summary check can update revision @Description check can update revision @Tags Revision @Accept json @Produce json @Security ApiKeyAuth @Param id query string true "id" default(string) @Success 200 {object} handler.RespBody @Router /answer/api/v1/revisions/edit/check [get]

func (*RevisionController) GetRevisionList

func (rc *RevisionController) GetRevisionList(ctx *gin.Context)

GetRevisionList godoc @Summary get revision list @Description get revision list @Tags Revision @Produce json @Param object_id query string true "object id" @Success 200 {object} handler.RespBody{data=[]schema.GetRevisionResp} @Router /answer/api/v1/revisions [get]

func (*RevisionController) GetUnreviewedRevisionList added in v0.5.0

func (rc *RevisionController) GetUnreviewedRevisionList(ctx *gin.Context)

GetUnreviewedRevisionList godoc @Summary get unreviewed revision list @Description get unreviewed revision list @Tags Revision @Produce json @Security ApiKeyAuth @Param page query string true "page id" @Success 200 {object} handler.RespBody{data=pager.PageModel{list=[]schema.GetUnreviewedRevisionResp}} @Router /answer/api/v1/revisions/unreviewed [get]

func (*RevisionController) RevisionAudit added in v0.5.0

func (rc *RevisionController) RevisionAudit(ctx *gin.Context)

RevisionAudit godoc @Summary revision audit @Description revision audit operation:approve or reject @Tags Revision @Produce json @Security ApiKeyAuth @Param data body schema.RevisionAuditReq true "audit" @Success 200 {object} handler.RespBody{} @Router /answer/api/v1/revisions/audit [put]

type SearchController

type SearchController struct {
	// contains filtered or unexported fields
}

SearchController tag controller

func NewSearchController

func NewSearchController(searchService *service.SearchService) *SearchController

NewSearchController new controller

func (*SearchController) Search

func (sc *SearchController) Search(ctx *gin.Context)

Search godoc @Summary search object @Description search object @Tags Search @Produce json @Security ApiKeyAuth @Param q query string true "query string" @Param order query string true "order" Enums(newest,active,score,relevance) @Success 200 {object} handler.RespBody{data=schema.SearchListResp} @Router /answer/api/v1/search [get]

type SiteinfoController

type SiteinfoController struct {
	// contains filtered or unexported fields
}

func NewSiteinfoController

func NewSiteinfoController(siteInfoService *siteinfo_common.SiteInfoCommonService) *SiteinfoController

NewSiteinfoController new siteinfo controller.

func (*SiteinfoController) GetManifestJson added in v1.0.0

func (sc *SiteinfoController) GetManifestJson(ctx *gin.Context)

GetManifestJson get manifest.json

func (*SiteinfoController) GetSiteInfo added in v0.3.0

func (sc *SiteinfoController) GetSiteInfo(ctx *gin.Context)

GetSiteInfo get site info @Summary get site info @Description get site info @Tags site @Produce json @Success 200 {object} handler.RespBody{data=schema.SiteInfoResp} @Router /answer/api/v1/siteinfo [get]

func (*SiteinfoController) GetSiteLegalInfo added in v0.4.0

func (sc *SiteinfoController) GetSiteLegalInfo(ctx *gin.Context)

GetSiteLegalInfo get site legal info @Summary get site legal info @Description get site legal info @Tags site @Param info_type query string true "legal information type" Enums(tos, privacy) @Produce json @Success 200 {object} handler.RespBody{data=schema.GetSiteLegalInfoResp} @Router /answer/api/v1/siteinfo/legal [get]

type TagController

type TagController struct {
	// contains filtered or unexported fields
}

TagController tag controller

func NewTagController

func NewTagController(
	tagService *tag.TagService,
	tagCommonService *tag_common.TagCommonService,
	rankService *rank.RankService,
) *TagController

NewTagController new controller

func (*TagController) AddTag added in v1.0.7

func (tc *TagController) AddTag(ctx *gin.Context)

AddTag add tag @Summary add tag @Description add tag @Tags Tag @Accept json @Produce json @Param data body schema.AddTagReq true "tag" @Success 200 {object} handler.RespBody @Router /answer/api/v1/tag [post]

func (*TagController) GetFollowingTags

func (tc *TagController) GetFollowingTags(ctx *gin.Context)

GetFollowingTags get following tag list @Summary get following tag list @Description get following tag list @Security ApiKeyAuth @Tags Tag @Produce json @Success 200 {object} handler.RespBody{data=[]schema.GetFollowingTagsResp} @Router /answer/api/v1/tags/following [get]

func (*TagController) GetTagInfo

func (tc *TagController) GetTagInfo(ctx *gin.Context)

GetTagInfo get tag one @Summary get tag one @Description get tag one @Tags Tag @Accept json @Produce json @Param tag_id query string true "tag id" @Param tag_name query string true "tag name" @Success 200 {object} handler.RespBody{data=schema.GetTagResp} @Router /answer/api/v1/tag [get]

func (*TagController) GetTagSynonyms

func (tc *TagController) GetTagSynonyms(ctx *gin.Context)

GetTagSynonyms get tag synonyms @Summary get tag synonyms @Description get tag synonyms @Tags Tag @Produce json @Param tag_id query int true "tag id" @Success 200 {object} handler.RespBody{data=schema.GetTagSynonymsResp} @Router /answer/api/v1/tag/synonyms [get]

func (*TagController) GetTagWithPage

func (tc *TagController) GetTagWithPage(ctx *gin.Context)

GetTagWithPage get tag page @Summary get tag page @Description get tag page @Tags Tag @Produce json @Param page query int false "page size" @Param page_size query int false "page size" @Param slug_name query string false "slug_name" @Param query_cond query string false "query condition" Enums(popular, name, newest) @Success 200 {object} handler.RespBody{data=pager.PageModel{list=[]schema.GetTagPageResp}} @Router /answer/api/v1/tags/page [get]

func (*TagController) GetTagsBySlugName added in v1.0.5

func (tc *TagController) GetTagsBySlugName(ctx *gin.Context)

GetTagsBySlugName @Summary get tags list @Description get tags list @Tags Tag @Produce json @Param tags query []string false "string collection" collectionFormat(csv) @Success 200 {object} handler.RespBody{} @Router /answer/api/v1/tags [get]

func (*TagController) RemoveTag

func (tc *TagController) RemoveTag(ctx *gin.Context)

RemoveTag delete tag @Summary delete tag @Description delete tag @Tags Tag @Accept json @Produce json @Param data body schema.RemoveTagReq true "tag" @Success 200 {object} handler.RespBody @Router /answer/api/v1/tag [delete]

func (*TagController) SearchTagLike

func (tc *TagController) SearchTagLike(ctx *gin.Context)

SearchTagLike get tag list @Summary get tag list @Description get tag list @Tags Tag @Produce json @Security ApiKeyAuth @Param tag query string false "tag" @Success 200 {object} handler.RespBody{data=[]schema.GetTagResp} @Router /answer/api/v1/question/tags [get]

func (*TagController) UpdateTag

func (tc *TagController) UpdateTag(ctx *gin.Context)

UpdateTag update tag @Summary update tag @Description update tag @Tags Tag @Accept json @Produce json @Param data body schema.UpdateTagReq true "tag" @Success 200 {object} handler.RespBody @Router /answer/api/v1/tag [put]

func (*TagController) UpdateTagSynonym

func (tc *TagController) UpdateTagSynonym(ctx *gin.Context)

UpdateTagSynonym update tag @Summary update tag @Description update tag @Tags Tag @Accept json @Produce json @Param data body schema.UpdateTagSynonymReq true "tag" @Success 200 {object} handler.RespBody @Router /answer/api/v1/tag/synonym [put]

type TemplateController added in v1.0.0

type TemplateController struct {
	// contains filtered or unexported fields
}

func NewTemplateController added in v1.0.0

func NewTemplateController(
	templateRenderController *templaterender.TemplateRenderController,
	siteInfoService *siteinfo_common.SiteInfoCommonService,
) *TemplateController

NewTemplateController new controller

func (*TemplateController) Index added in v1.0.0

func (tc *TemplateController) Index(ctx *gin.Context)

Index question list

func (*TemplateController) Page404 added in v1.0.0

func (tc *TemplateController) Page404(ctx *gin.Context)

func (*TemplateController) QuestionInfo added in v1.0.0

func (tc *TemplateController) QuestionInfo(ctx *gin.Context)

QuestionInfo question and answers info

func (*TemplateController) QuestionInfoeRdirect added in v1.0.2

func (tc *TemplateController) QuestionInfoeRdirect(ctx *gin.Context, siteInfo *schema.TemplateSiteInfoResp, correctTitle bool) (jump bool, url string)

func (*TemplateController) QuestionList added in v1.0.0

func (tc *TemplateController) QuestionList(ctx *gin.Context)

func (*TemplateController) SiteInfo added in v1.0.0

func (*TemplateController) Sitemap added in v1.0.0

func (tc *TemplateController) Sitemap(ctx *gin.Context)

func (*TemplateController) SitemapPage added in v1.0.0

func (tc *TemplateController) SitemapPage(ctx *gin.Context)

func (*TemplateController) TagInfo added in v1.0.0

func (tc *TemplateController) TagInfo(ctx *gin.Context)

TagInfo taginfo

func (*TemplateController) TagList added in v1.0.0

func (tc *TemplateController) TagList(ctx *gin.Context)

TagList tags list

func (*TemplateController) UserInfo added in v1.0.0

func (tc *TemplateController) UserInfo(ctx *gin.Context)

UserInfo user info

type UploadController added in v0.4.0

type UploadController struct {
	// contains filtered or unexported fields
}

UploadController upload controller

func NewUploadController added in v0.4.0

func NewUploadController(uploaderService *uploader.UploaderService) *UploadController

NewUploadController new controller

func (*UploadController) PostRender added in v1.0.3

func (uc *UploadController) PostRender(ctx *gin.Context)

PostRender render post content @Summary render post content @Description render post content @Tags Upload @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.PostRenderReq true "PostRenderReq" @Success 200 {object} handler.RespBody @Router /answer/api/v1/post/render [post]

func (*UploadController) UploadFile added in v0.4.0

func (uc *UploadController) UploadFile(ctx *gin.Context)

UploadFile upload file @Summary upload file @Description upload file @Tags Upload @Accept multipart/form-data @Security ApiKeyAuth @Param source formData string true "identify the source of the file upload" Enums(post, avatar, branding) @Param file formData file true "file" @Success 200 {object} handler.RespBody{data=string} @Router /answer/api/v1/file [post]

type UserController

type UserController struct {
	// contains filtered or unexported fields
}

UserController user controller

func NewUserController

func NewUserController(
	authService *auth.AuthService,
	userService *service.UserService,
	actionService *action.CaptchaService,
	emailService *export.EmailService,
	uploaderService *uploader.UploaderService,
	siteInfoCommonService *siteinfo_common.SiteInfoCommonService,
) *UserController

NewUserController new controller

func (*UserController) ActionRecord

func (uc *UserController) ActionRecord(ctx *gin.Context)

ActionRecord godoc @Summary ActionRecord @Description ActionRecord @Tags User @Param action query string true "action" Enums(login, e_mail, find_pass) @Security ApiKeyAuth @Success 200 {object} handler.RespBody{data=schema.ActionRecordResp} @Router /answer/api/v1/user/action/record [get]

func (*UserController) GetOtherUserInfoByUsername

func (uc *UserController) GetOtherUserInfoByUsername(ctx *gin.Context)

GetOtherUserInfoByUsername godoc @Summary GetOtherUserInfoByUsername @Description GetOtherUserInfoByUsername @Tags User @Accept json @Produce json @Security ApiKeyAuth @Param username query string true "username" @Success 200 {object} handler.RespBody{data=schema.GetOtherUserInfoResp} @Router /answer/api/v1/personal/user/info [get]

func (*UserController) GetUserInfoByUserID

func (uc *UserController) GetUserInfoByUserID(ctx *gin.Context)

GetUserInfoByUserID get user info, if user no login response http code is 200, but user info is null @Summary GetUserInfoByUserID @Description get user info, if user no login response http code is 200, but user info is null @Tags User @Accept json @Produce json @Security ApiKeyAuth @Success 200 {object} handler.RespBody{data=schema.GetUserToSetShowResp} @Router /answer/api/v1/user/info [get]

func (*UserController) RetrievePassWord

func (uc *UserController) RetrievePassWord(ctx *gin.Context)

RetrievePassWord godoc @Summary RetrievePassWord @Description RetrievePassWord @Tags User @Accept json @Produce json @Param data body schema.UserRetrievePassWordRequest true "UserRetrievePassWordRequest" @Success 200 {string} string "" @Router /answer/api/v1/user/password/reset [post]

func (*UserController) UseRePassWord

func (uc *UserController) UseRePassWord(ctx *gin.Context)

UseRePassWord godoc @Summary UseRePassWord @Description UseRePassWord @Tags User @Accept json @Produce json @Param data body schema.UserRePassWordRequest true "UserRePassWordRequest" @Success 200 {string} string "" @Router /answer/api/v1/user/password/replacement [post]

func (*UserController) UserChangeEmailSendCode

func (uc *UserController) UserChangeEmailSendCode(ctx *gin.Context)

UserChangeEmailSendCode send email to the user email then change their email @Summary send email to the user email then change their email @Description send email to the user email then change their email @Tags User @Accept json @Produce json @Param data body schema.UserChangeEmailSendCodeReq true "UserChangeEmailSendCodeReq" @Success 200 {object} handler.RespBody{} @Router /answer/api/v1/user/email/change/code [post]

func (*UserController) UserChangeEmailVerify

func (uc *UserController) UserChangeEmailVerify(ctx *gin.Context)

UserChangeEmailVerify user change email verification @Summary user change email verification @Description user change email verification @Tags User @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.UserChangeEmailVerifyReq true "UserChangeEmailVerifyReq" @Success 200 {object} handler.RespBody{} @Router /answer/api/v1/user/email [put]

func (*UserController) UserEmailLogin

func (uc *UserController) UserEmailLogin(ctx *gin.Context)

UserEmailLogin godoc @Summary UserEmailLogin @Description UserEmailLogin @Tags User @Accept json @Produce json @Param data body schema.UserEmailLogin true "UserEmailLogin" @Success 200 {object} handler.RespBody{data=schema.GetUserResp} @Router /answer/api/v1/user/login/email [post]

func (*UserController) UserLogout

func (uc *UserController) UserLogout(ctx *gin.Context)

UserLogout user logout @Summary user logout @Description user logout @Tags User @Accept json @Produce json @Success 200 {object} handler.RespBody @Router /answer/api/v1/user/logout [get]

func (*UserController) UserModifyPassWord

func (uc *UserController) UserModifyPassWord(ctx *gin.Context)

UserModifyPassWord godoc @Summary UserModifyPassWord @Description UserModifyPassWord @Tags User @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.UserModifyPassWordRequest true "UserModifyPassWordRequest" @Success 200 {object} handler.RespBody @Router /answer/api/v1/user/password [put]

func (*UserController) UserNoticeSet

func (uc *UserController) UserNoticeSet(ctx *gin.Context)

UserNoticeSet godoc @Summary UserNoticeSet @Description UserNoticeSet @Tags User @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.UserNoticeSetRequest true "UserNoticeSetRequest" @Success 200 {object} handler.RespBody{data=schema.UserNoticeSetResp} @Router /answer/api/v1/user/notice/set [post]

func (*UserController) UserRanking added in v1.0.0

func (uc *UserController) UserRanking(ctx *gin.Context)

UserRanking get user ranking @Summary get user ranking @Description get user ranking @Tags User @Accept json @Produce json @Security ApiKeyAuth @Success 200 {object} handler.RespBody{data=schema.UserRankingResp} @Router /answer/api/v1/user/ranking [get]

func (*UserController) UserRegisterByEmail

func (uc *UserController) UserRegisterByEmail(ctx *gin.Context)

UserRegisterByEmail godoc @Summary UserRegisterByEmail @Description UserRegisterByEmail @Tags User @Accept json @Produce json @Param data body schema.UserRegisterReq true "UserRegisterReq" @Success 200 {object} handler.RespBody{data=schema.GetUserResp} @Router /answer/api/v1/user/register/email [post]

func (*UserController) UserRegisterCaptcha added in v1.0.0

func (uc *UserController) UserRegisterCaptcha(ctx *gin.Context)

UserRegisterCaptcha godoc @Summary UserRegisterCaptcha @Description UserRegisterCaptcha @Tags User @Accept json @Produce json @Success 200 {object} handler.RespBody{data=schema.GetUserResp} @Router /answer/api/v1/user/register/captcha [get]

func (*UserController) UserUnsubscribeEmailNotification added in v1.0.2

func (uc *UserController) UserUnsubscribeEmailNotification(ctx *gin.Context)

UserUnsubscribeEmailNotification unsubscribe email notification @Summary unsubscribe email notification @Description unsubscribe email notification @Tags User @Accept json @Produce json @Success 200 {object} handler.RespBody{} @Router /answer/api/v1/user/email/notification [put]

func (*UserController) UserUpdateInfo

func (uc *UserController) UserUpdateInfo(ctx *gin.Context)

UserUpdateInfo update user info @Summary UserUpdateInfo update user info @Description UserUpdateInfo update user info @Tags User @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "access-token" @Param data body schema.UpdateInfoRequest true "UpdateInfoRequest" @Success 200 {object} handler.RespBody @Router /answer/api/v1/user/info [put]

func (*UserController) UserUpdateInterface added in v0.3.0

func (uc *UserController) UserUpdateInterface(ctx *gin.Context)

UserUpdateInterface update user interface config @Summary UserUpdateInterface update user interface config @Description UserUpdateInterface update user interface config @Tags User @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "access-token" @Param data body schema.UpdateUserInterfaceRequest true "UpdateInfoRequest" @Success 200 {object} handler.RespBody @Router /answer/api/v1/user/interface [put]

func (*UserController) UserVerifyEmail

func (uc *UserController) UserVerifyEmail(ctx *gin.Context)

UserVerifyEmail godoc @Summary UserVerifyEmail @Description UserVerifyEmail @Tags User @Accept json @Produce json @Param code query string true "code" default() @Success 200 {object} handler.RespBody{data=schema.GetUserResp} @Router /answer/api/v1/user/email/verification [post]

func (*UserController) UserVerifyEmailSend

func (uc *UserController) UserVerifyEmailSend(ctx *gin.Context)

UserVerifyEmailSend godoc @Summary UserVerifyEmailSend @Description UserVerifyEmailSend @Tags User @Accept json @Produce json @Security ApiKeyAuth @Param captcha_id query string false "captcha_id" default() @Param captcha_code query string false "captcha_code" default() @Success 200 {string} string "" @Router /answer/api/v1/user/email/verification/send [post]

type VoteController

type VoteController struct {
	VoteService *service.VoteService
	// contains filtered or unexported fields
}

VoteController activity controller

func NewVoteController

func NewVoteController(voteService *service.VoteService, rankService *rank.RankService) *VoteController

NewVoteController new controller

func (*VoteController) UserVotes

func (vc *VoteController) UserVotes(ctx *gin.Context)

UserVotes godoc @Summary user's votes @Description user's vote @Tags Activity @Accept json @Produce json @Security ApiKeyAuth @Param page query int false "page size" @Param page_size query int false "page size" @Success 200 {object} handler.RespBody{data=pager.PageModel{list=[]schema.GetVoteWithPageResp}} @Router /answer/api/v1/personal/vote/page [get]

func (*VoteController) VoteDown

func (vc *VoteController) VoteDown(ctx *gin.Context)

VoteDown godoc @Summary vote down @Description add vote @Tags Activity @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.VoteReq true "vote" @Success 200 {object} handler.RespBody{data=schema.VoteResp} @Router /answer/api/v1/vote/down [post]

func (*VoteController) VoteUp

func (vc *VoteController) VoteUp(ctx *gin.Context)

VoteUp godoc @Summary vote up @Description add vote @Tags Activity @Accept json @Produce json @Security ApiKeyAuth @Param data body schema.VoteReq true "vote" @Success 200 {object} handler.RespBody{data=schema.VoteResp} @Router /answer/api/v1/vote/up [post]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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