fix: comment public flag
This commit is contained in:
parent
283d196f6b
commit
0010f216f3
|
@ -32,6 +32,7 @@ type CommentDocs struct {
|
||||||
ParentCommentID string `json:"parent_comment_id"` // 父留言 id 沒有就空白
|
ParentCommentID string `json:"parent_comment_id"` // 父留言 id 沒有就空白
|
||||||
Message string `json:"message"` // 留言內容
|
Message string `json:"message"` // 留言內容
|
||||||
Replies []*CommentDocs `json:"replies"` // 子留言
|
Replies []*CommentDocs `json:"replies"` // 子留言
|
||||||
|
IsVisitable bool `json:"is_visitable"` // 留言是否可見
|
||||||
UpdatedAt int64 `json:"updated_at"` // 更新時間
|
UpdatedAt int64 `json:"updated_at"` // 更新時間
|
||||||
CreatedAt int64 `json:"created_at"` // 建立時間
|
CreatedAt int64 `json:"created_at"` // 建立時間
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
|
|
||||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain"
|
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain"
|
||||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/comment"
|
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/comment"
|
||||||
|
@ -89,6 +90,7 @@ func (use *CommentUseCase) GetCommentItem(ctx context.Context, id string) (*usec
|
||||||
ReferenceID: byID.ReferenceID,
|
ReferenceID: byID.ReferenceID,
|
||||||
ParentCommentID: byID.ParentCommentID,
|
ParentCommentID: byID.ParentCommentID,
|
||||||
Message: byID.Message,
|
Message: byID.Message,
|
||||||
|
IsVisitable: byID.IsVisitable,
|
||||||
UpdatedAt: byID.UpdatedAt,
|
UpdatedAt: byID.UpdatedAt,
|
||||||
CreatedAt: byID.CreatedAt,
|
CreatedAt: byID.CreatedAt,
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -140,6 +142,7 @@ func (use *CommentUseCase) ListComment(ctx context.Context, req usecase.ListComm
|
||||||
ReferenceID: req.ReferenceID,
|
ReferenceID: req.ReferenceID,
|
||||||
IsVisitable: req.IsVisitable,
|
IsVisitable: req.IsVisitable,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, errs.DatabaseErrorWithScopeL(
|
return nil, 0, errs.DatabaseErrorWithScopeL(
|
||||||
code.CloudEPComment,
|
code.CloudEPComment,
|
||||||
|
@ -173,6 +176,7 @@ func (use *CommentUseCase) ListComment(ctx context.Context, req usecase.ListComm
|
||||||
Message: decodedMessage,
|
Message: decodedMessage,
|
||||||
UpdatedAt: item.UpdatedAt,
|
UpdatedAt: item.UpdatedAt,
|
||||||
CreatedAt: item.CreatedAt,
|
CreatedAt: item.CreatedAt,
|
||||||
|
IsVisitable: item.IsVisitable,
|
||||||
Replies: replyMap[item.ID.Hex()],
|
Replies: replyMap[item.ID.Hex()],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -190,6 +194,7 @@ func (use *CommentUseCase) buildReplies(ctx context.Context, parentComments []*e
|
||||||
ParentID: &id,
|
ParentID: &id,
|
||||||
PageSize: 20,
|
PageSize: 20,
|
||||||
PageIndex: 1, // 可調整分頁大小
|
PageIndex: 1, // 可調整分頁大小
|
||||||
|
IsVisitable: proto.Bool(item.IsVisitable),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
|
@ -207,6 +212,7 @@ func (use *CommentUseCase) buildReplies(ctx context.Context, parentComments []*e
|
||||||
UID: sub.UID,
|
UID: sub.UID,
|
||||||
ReferenceID: sub.ReferenceID,
|
ReferenceID: sub.ReferenceID,
|
||||||
ParentCommentID: sub.ParentCommentID,
|
ParentCommentID: sub.ParentCommentID,
|
||||||
|
IsVisitable: sub.IsVisitable,
|
||||||
Message: decodedMessage,
|
Message: decodedMessage,
|
||||||
UpdatedAt: sub.UpdatedAt,
|
UpdatedAt: sub.UpdatedAt,
|
||||||
CreatedAt: sub.CreatedAt,
|
CreatedAt: sub.CreatedAt,
|
||||||
|
|
Loading…
Reference in New Issue