questioncommon

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QuestionCommon

type QuestionCommon struct {
	AnswerCommon *answercommon.AnswerCommon
	// contains filtered or unexported fields
}

QuestionCommon user service

func NewQuestionCommon

func NewQuestionCommon(questionRepo QuestionRepo,
	answerRepo answercommon.AnswerRepo,
	voteRepo activity_common.VoteRepo,
	followCommon activity_common.FollowRepo,
	tagCommon *tagcommon.TagCommonService,
	userCommon *usercommon.UserCommon,
	collectionCommon *collectioncommon.CollectionCommon,
	answerCommon *answercommon.AnswerCommon,
	metaCommonService *metacommon.MetaCommonService,
	configService *config.ConfigService,
	activityQueueService activity_queue.ActivityQueueService,
	revisionRepo revision.RevisionRepo,
	siteInfoService siteinfo_common.SiteInfoCommonService,
	data *data.Data,
) *QuestionCommon

func (*QuestionCommon) AddQuestionLinkForCloseReason

func (qs *QuestionCommon) AddQuestionLinkForCloseReason(ctx context.Context,
	questionInfo *entity.Question, closeMsg string)

AddQuestionLinkForCloseReason When the reason about close question is a question link, add the link to the question

func (*QuestionCommon) CloseQuestion

func (qs *QuestionCommon) CloseQuestion(ctx context.Context, req *schema.CloseQuestionReq) error

func (*QuestionCommon) FindInfoByID

func (qs *QuestionCommon) FindInfoByID(ctx context.Context, questionIDs []string, loginUserID string) (map[string]*schema.QuestionInfoResp, error)

func (*QuestionCommon) FormatQuestions

func (qs *QuestionCommon) FormatQuestions(ctx context.Context, questionList []*entity.Question, loginUserID string) ([]*schema.QuestionInfoResp, error)

func (*QuestionCommon) FormatQuestionsPage

func (qs *QuestionCommon) FormatQuestionsPage(
	ctx context.Context, questionList []*entity.Question, loginUserID string, orderCond string) (
	formattedQuestions []*schema.QuestionPageResp, err error)

func (*QuestionCommon) GetPersonalUserQuestionCount

func (qs *QuestionCommon) GetPersonalUserQuestionCount(ctx context.Context, loginUserID, userID string, isAdmin bool) (count int64, err error)

func (*QuestionCommon) GetUserQuestionCount

func (qs *QuestionCommon) GetUserQuestionCount(ctx context.Context, userID string) (count int64, err error)

func (*QuestionCommon) Info

func (qs *QuestionCommon) Info(ctx context.Context, questionID string, loginUserID string) (resp *schema.QuestionInfoResp, err error)

func (*QuestionCommon) InviteUserInfo

func (qs *QuestionCommon) InviteUserInfo(ctx context.Context, questionID string) (inviteList []*schema.UserBasicInfo, err error)

func (*QuestionCommon) RemoveAnswer

func (qs *QuestionCommon) RemoveAnswer(ctx context.Context, id string) (err error)

RemoveAnswer delete answer

func (*QuestionCommon) RemoveQuestion

func (qs *QuestionCommon) RemoveQuestion(ctx context.Context, req *schema.RemoveQuestionReq) (err error)

RemoveQuestion delete question

func (*QuestionCommon) RemoveQuestionLinkForReopen

func (qs *QuestionCommon) RemoveQuestionLinkForReopen(ctx context.Context, questionInfo *entity.Question)

func (*QuestionCommon) SetCache

func (qs *QuestionCommon) SetCache(ctx context.Context, cachekey string, info interface{}) error

func (*QuestionCommon) ShowFormat

func (qs *QuestionCommon) ShowFormat(ctx context.Context, data *entity.Question) *schema.QuestionInfoResp

func (*QuestionCommon) ShowFormatWithTag

func (*QuestionCommon) ShowListFormat

func (qs *QuestionCommon) ShowListFormat(ctx context.Context, data *entity.Question) *schema.QuestionInfoResp

func (*QuestionCommon) SitemapCron

func (qs *QuestionCommon) SitemapCron(ctx context.Context)

func (*QuestionCommon) UpdateAccepted

func (qs *QuestionCommon) UpdateAccepted(ctx context.Context, questionID, AnswerID string) error

func (*QuestionCommon) UpdateAnswerCount

func (qs *QuestionCommon) UpdateAnswerCount(ctx context.Context, questionID string) error

func (*QuestionCommon) UpdateCollectionCount

func (qs *QuestionCommon) UpdateCollectionCount(ctx context.Context, questionID string) (count int64, err error)

func (*QuestionCommon) UpdateLastAnswer

func (qs *QuestionCommon) UpdateLastAnswer(ctx context.Context, questionID, AnswerID string) error

func (*QuestionCommon) UpdatePostSetTime

func (qs *QuestionCommon) UpdatePostSetTime(ctx context.Context, questionID string, setTime time.Time) error

func (*QuestionCommon) UpdatePostTime

func (qs *QuestionCommon) UpdatePostTime(ctx context.Context, questionID string) error

func (*QuestionCommon) UpdatePv

func (qs *QuestionCommon) UpdatePv(ctx context.Context, questionID string) error
func (qs *QuestionCommon) UpdateQuestionLink(ctx context.Context, questionID, answerID, parsedText, originalText string) (string, error)

type QuestionRepo

type QuestionRepo interface {
	AddQuestion(ctx context.Context, question *entity.Question) (err error)
	RemoveQuestion(ctx context.Context, id string) (err error)
	UpdateQuestion(ctx context.Context, question *entity.Question, Cols []string) (err error)
	GetQuestion(ctx context.Context, id string) (question *entity.Question, exist bool, err error)
	GetQuestionList(ctx context.Context, question *entity.Question) (questions []*entity.Question, err error)
	GetQuestionPage(ctx context.Context, page, pageSize int, tagIDs []string, userID, orderCond string, inDays int, showHidden, showPending bool) (
		questionList []*entity.Question, total int64, err error)
	GetRecommendQuestionPageByTags(ctx context.Context, userID string, tagIDs, followedQuestionIDs []string, page, pageSize int) (questionList []*entity.Question, total int64, err error)
	UpdateQuestionStatus(ctx context.Context, questionID string, status int) (err error)
	UpdateQuestionStatusWithOutUpdateTime(ctx context.Context, question *entity.Question) (err error)
	DeletePermanentlyQuestions(ctx context.Context) (err error)
	RecoverQuestion(ctx context.Context, questionID string) (err error)
	UpdateQuestionOperation(ctx context.Context, question *entity.Question) (err error)
	GetQuestionsByTitle(ctx context.Context, title string, pageSize int) (questionList []*entity.Question, err error)
	UpdatePvCount(ctx context.Context, questionID string) (err error)
	UpdateAnswerCount(ctx context.Context, questionID string, num int) (err error)
	UpdateCollectionCount(ctx context.Context, questionID string) (count int64, err error)
	UpdateAccepted(ctx context.Context, question *entity.Question) (err error)
	UpdateLastAnswer(ctx context.Context, question *entity.Question) (err error)
	FindByID(ctx context.Context, id []string) (questionList []*entity.Question, err error)
	AdminQuestionPage(ctx context.Context, search *schema.AdminQuestionPageReq) ([]*entity.Question, int64, error)
	GetQuestionCount(ctx context.Context) (count int64, err error)
	GetUnansweredQuestionCount(ctx context.Context) (count int64, err error)
	GetResolvedQuestionCount(ctx context.Context) (count int64, err error)
	GetUserQuestionCount(ctx context.Context, userID string, show int) (count int64, err error)
	SitemapQuestions(ctx context.Context, page, pageSize int) (questionIDList []*schema.SiteMapQuestionInfo, err error)
	RemoveAllUserQuestion(ctx context.Context, userID string) (err error)
	UpdateSearch(ctx context.Context, questionID string) (err error)
	LinkQuestion(ctx context.Context, link ...*entity.QuestionLink) (err error)
	GetLinkedQuestionIDs(ctx context.Context, questionID string, status int) (questionIDs []string, err error)
	UpdateQuestionLinkCount(ctx context.Context, questionID string) (err error)
	RemoveQuestionLink(ctx context.Context, link ...*entity.QuestionLink) (err error)
	RecoverQuestionLink(ctx context.Context, link ...*entity.QuestionLink) (err error)
	UpdateQuestionLinkStatus(ctx context.Context, status int, links ...*entity.QuestionLink) (err error)
	GetQuestionLink(ctx context.Context, page, pageSize int, questionID string, orderCond string, inDays int) (questions []*entity.Question, total int64, err error)
}

QuestionRepo question repository

Jump to

Keyboard shortcuts

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