feat: activity object info return username

This commit is contained in:
LinkinStar 2022-11-28 17:09:52 +08:00
parent 820d87e318
commit 224b569013
2 changed files with 11 additions and 0 deletions

View File

@ -46,6 +46,7 @@ type ActObjectInfo struct {
ObjectType string `json:"object_type"`
QuestionID string `json:"question_id"`
AnswerID string `json:"answer_id"`
Username string `json:"username"`
}
// GetObjectTimelineDetailReq get object timeline detail request

View File

@ -72,6 +72,16 @@ func (as *ActivityService) GetObjectTimeline(ctx context.Context, req *schema.Ge
resp.ObjectInfo.ObjectType = objInfo.ObjectType
resp.ObjectInfo.QuestionID = objInfo.QuestionID
resp.ObjectInfo.AnswerID = objInfo.AnswerID
if len(objInfo.ObjectCreatorUserID) > 0 {
// get object creator user info
userBasicInfo, exist, err := as.userCommon.GetUserBasicInfoByID(ctx, objInfo.ObjectCreatorUserID)
if err != nil {
return nil, err
}
if exist {
resp.ObjectInfo.Username = userBasicInfo.Username
}
}
activityList, err := as.activityRepo.GetObjectAllActivity(ctx, req.ObjectID, req.ShowVote)
if err != nil {