update question

This commit is contained in:
aichy126 2023-03-13 11:28:35 +08:00
parent 1a814da53b
commit 2d87c8d494
9 changed files with 47 additions and 0 deletions

View File

@ -5778,6 +5778,10 @@ const docTemplate = `{
"title": {
"description": "title",
"type": "string"
},
"url_title": {
"description": "url title",
"type": "string"
}
}
},
@ -6033,6 +6037,10 @@ const docTemplate = `{
"title": {
"description": "title",
"type": "string"
},
"url_title": {
"description": "url title",
"type": "string"
}
}
},
@ -6612,6 +6620,10 @@ const docTemplate = `{
"description": "title",
"type": "string"
},
"url_title": {
"description": "url title",
"type": "string"
},
"vote_type": {
"description": "vote type",
"type": "string"

View File

@ -5766,6 +5766,10 @@
"title": {
"description": "title",
"type": "string"
},
"url_title": {
"description": "url title",
"type": "string"
}
}
},
@ -6021,6 +6025,10 @@
"title": {
"description": "title",
"type": "string"
},
"url_title": {
"description": "url title",
"type": "string"
}
}
},
@ -6600,6 +6608,10 @@
"description": "title",
"type": "string"
},
"url_title": {
"description": "url title",
"type": "string"
},
"vote_type": {
"description": "vote type",
"type": "string"

View File

@ -337,6 +337,9 @@ definitions:
title:
description: title
type: string
url_title:
description: url title
type: string
type: object
schema.GetCommentResp:
properties:
@ -525,6 +528,9 @@ definitions:
title:
description: title
type: string
url_title:
description: url title
type: string
type: object
schema.GetReportTypeResp:
properties:
@ -943,6 +949,9 @@ definitions:
title:
description: title
type: string
url_title:
description: url title
type: string
vote_type:
description: vote type
type: string

View File

@ -198,6 +198,8 @@ type GetCommentPersonalWithPageResp struct {
ObjectType string `json:"object_type" enums:"question,answer,tag,comment"`
// title
Title string `json:"title"`
// url title
UrlTitle string `json:"url_title"`
// content
Content string `json:"content"`
}

View File

@ -26,6 +26,8 @@ type GetRankPersonalWithPageResp struct {
ObjectType string `json:"object_type" enums:"question,answer,tag,comment"`
// title
Title string `json:"title"`
// url title
UrlTitle string `json:"url_title"`
// content
Content string `json:"content"`
// reputation

View File

@ -60,6 +60,8 @@ type GetVoteWithPageResp struct {
ObjectType string `json:"object_type" enums:"question,answer,tag,comment"`
// title
Title string `json:"title"`
// url title
UrlTitle string `json:"url_title"`
// content
Content string `json:"content"`
// vote type

View File

@ -18,7 +18,9 @@ import (
"github.com/answerdev/answer/internal/service/permission"
usercommon "github.com/answerdev/answer/internal/service/user_common"
"github.com/answerdev/answer/pkg/encryption"
"github.com/answerdev/answer/pkg/htmltext"
"github.com/answerdev/answer/pkg/uid"
"github.com/davecgh/go-spew/spew"
"github.com/jinzhu/copier"
"github.com/segmentfault/pacman/errors"
"github.com/segmentfault/pacman/log"
@ -446,8 +448,10 @@ func (cs *CommentService) GetCommentPersonalWithPage(ctx context.Context, req *s
if err != nil {
log.Error(err)
} else {
spew.Dump("==", objInfo)
commentResp.ObjectType = objInfo.ObjectType
commentResp.Title = objInfo.Title
commentResp.UrlTitle = htmltext.UrlTitle(objInfo.Title)
commentResp.QuestionID = objInfo.QuestionID
commentResp.AnswerID = objInfo.AnswerID
}

View File

@ -14,6 +14,7 @@ import (
"github.com/answerdev/answer/internal/service/permission"
"github.com/answerdev/answer/internal/service/role"
usercommon "github.com/answerdev/answer/internal/service/user_common"
"github.com/answerdev/answer/pkg/htmltext"
"github.com/segmentfault/pacman/errors"
"github.com/segmentfault/pacman/log"
"xorm.io/xorm"
@ -260,6 +261,7 @@ func (rs *RankService) GetRankPersonalWithPage(ctx context.Context, req *schema.
commentResp.RankType = activity_type.Format(userRankInfo.ActivityType)
commentResp.ObjectType = objInfo.ObjectType
commentResp.Title = objInfo.Title
commentResp.UrlTitle = htmltext.UrlTitle(objInfo.Title)
commentResp.Content = objInfo.Content
commentResp.QuestionID = objInfo.QuestionID
commentResp.AnswerID = objInfo.AnswerID

View File

@ -9,6 +9,7 @@ import (
"github.com/answerdev/answer/internal/service/comment_common"
"github.com/answerdev/answer/internal/service/config"
"github.com/answerdev/answer/internal/service/object_info"
"github.com/answerdev/answer/pkg/htmltext"
"github.com/answerdev/answer/pkg/obj"
"github.com/segmentfault/pacman/log"
@ -190,6 +191,7 @@ func (vs *VoteService) ListUserVotes(ctx context.Context, req schema.GetVoteWith
AnswerID: objInfo.AnswerID,
ObjectType: objInfo.ObjectType,
Title: objInfo.Title,
UrlTitle: htmltext.UrlTitle(objInfo.Title),
Content: objInfo.Content,
VoteType: activity_type.Format(voteInfo.ActivityType),
}