update search question

This commit is contained in:
aichy126 2023-04-23 15:10:44 +08:00
parent 910484013c
commit 499cfe9917
7 changed files with 15 additions and 3 deletions

View File

@ -7545,6 +7545,10 @@ const docTemplate = `{
"schema.QuestionPageReq": {
"type": "object",
"properties": {
"inDays": {
"type": "integer",
"minimum": 1
},
"orderCond": {
"type": "string",
"enum": [

View File

@ -7533,6 +7533,10 @@
"schema.QuestionPageReq": {
"type": "object",
"properties": {
"inDays": {
"type": "integer",
"minimum": 1
},
"orderCond": {
"type": "string",
"enum": [

View File

@ -1202,6 +1202,9 @@ definitions:
type: object
schema.QuestionPageReq:
properties:
inDays:
minimum: 1
type: integer
orderCond:
enum:
- newest

View File

@ -245,7 +245,7 @@ func (qr *questionRepo) GetQuestionIDsPage(ctx context.Context, page, pageSize i
}
// GetQuestionPage query question page
func (qr *questionRepo) GetQuestionPage(ctx context.Context, page, pageSize int, userID, tagID, orderCond string) (
func (qr *questionRepo) GetQuestionPage(ctx context.Context, page, pageSize int, userID, tagID, orderCond string, inDays int) (
questionList []*entity.Question, total int64, err error) {
questionList = make([]*entity.Question, 0)

View File

@ -277,6 +277,7 @@ type QuestionPageReq struct {
OrderCond string `validate:"omitempty,oneof=newest active frequent score unanswered" form:"order"`
Tag string `validate:"omitempty,gt=0,lte=100" form:"tag"`
Username string `validate:"omitempty,gt=0,lte=100" form:"username"`
InDays int `validate:"omitempty,min=1" form:"in_days"`
LoginUserID string `json:"-"`
UserIDBeSearched string `json:"-"`

View File

@ -32,7 +32,7 @@ type QuestionRepo interface {
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, userID, tagID, orderCond string) (
GetQuestionPage(ctx context.Context, page, pageSize int, userID, tagID, orderCond string, inDays int) (
questionList []*entity.Question, total int64, err error)
UpdateQuestionStatus(ctx context.Context, question *entity.Question) (err error)
UpdateQuestionStatusWithOutUpdateTime(ctx context.Context, question *entity.Question) (err error)

View File

@ -931,7 +931,7 @@ func (qs *QuestionService) GetQuestionPage(ctx context.Context, req *schema.Ques
}
questionList, total, err := qs.questionRepo.GetQuestionPage(ctx, req.Page, req.PageSize,
req.UserIDBeSearched, req.TagID, req.OrderCond)
req.UserIDBeSearched, req.TagID, req.OrderCond, req.InDays)
if err != nil {
return nil, 0, err
}