Version: 0.9.78.dev.260506
This commit is contained in:
72
backend/services/taskclassforum/rpc/errors.go
Normal file
72
backend/services/taskclassforum/rpc/errors.go
Normal file
@@ -0,0 +1,72 @@
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
"github.com/LoveLosita/smartflow/backend/shared/respond"
|
||||
"google.golang.org/genproto/googleapis/rpc/errdetails"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
const taskClassForumErrorDomain = "smartflow.taskclassforum"
|
||||
|
||||
// grpcErrorFromServiceError 负责把计划广场内部错误收口成 gRPC status。
|
||||
//
|
||||
// 职责边界:
|
||||
// 1. 只做 service error -> gRPC error 的传输适配;
|
||||
// 2. 不负责 HTTP 响应,gateway client 后续会把 gRPC error 反解成 respond.Response;
|
||||
// 3. 普通内部错误只暴露统一文案,避免把 DAO / SQL 细节透给前端。
|
||||
func grpcErrorFromServiceError(err error) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var resp respond.Response
|
||||
if errors.As(err, &resp) {
|
||||
return grpcErrorFromResponse(resp)
|
||||
}
|
||||
log.Printf("taskclassforum rpc internal error: %v", err)
|
||||
return status.Error(codes.Internal, "taskclassforum service internal error")
|
||||
}
|
||||
|
||||
func grpcErrorFromResponse(resp respond.Response) error {
|
||||
code := grpcCodeFromRespondStatus(resp.Status)
|
||||
message := strings.TrimSpace(resp.Info)
|
||||
if message == "" {
|
||||
message = strings.TrimSpace(resp.Status)
|
||||
}
|
||||
|
||||
st := status.New(code, message)
|
||||
detail := &errdetails.ErrorInfo{
|
||||
Domain: taskClassForumErrorDomain,
|
||||
Reason: resp.Status,
|
||||
Metadata: map[string]string{
|
||||
"info": resp.Info,
|
||||
},
|
||||
}
|
||||
withDetails, err := st.WithDetails(detail)
|
||||
if err != nil {
|
||||
return st.Err()
|
||||
}
|
||||
return withDetails.Err()
|
||||
}
|
||||
|
||||
func grpcCodeFromRespondStatus(statusValue string) codes.Code {
|
||||
switch strings.TrimSpace(statusValue) {
|
||||
case respond.MissingToken.Status, respond.InvalidToken.Status, respond.InvalidClaims.Status, respond.ErrUnauthorized.Status:
|
||||
return codes.Unauthenticated
|
||||
case respond.MissingParam.Status, respond.WrongParamType.Status, respond.ParamTooLong.Status, respond.WrongUserID.Status:
|
||||
return codes.InvalidArgument
|
||||
case respond.UserTaskClassNotFound.Status:
|
||||
return codes.NotFound
|
||||
case respond.UserTaskClassForbidden.Status, respond.TaskClassItemNotBelongToUser.Status:
|
||||
return codes.PermissionDenied
|
||||
}
|
||||
if strings.HasPrefix(strings.TrimSpace(statusValue), "5") {
|
||||
return codes.Internal
|
||||
}
|
||||
return codes.InvalidArgument
|
||||
}
|
||||
412
backend/services/taskclassforum/rpc/handler.go
Normal file
412
backend/services/taskclassforum/rpc/handler.go
Normal file
@@ -0,0 +1,412 @@
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/LoveLosita/smartflow/backend/shared/respond"
|
||||
"github.com/LoveLosita/smartflow/backend/services/taskclassforum/rpc/pb"
|
||||
forumsv "github.com/LoveLosita/smartflow/backend/services/taskclassforum/sv"
|
||||
forumcontracts "github.com/LoveLosita/smartflow/backend/shared/contracts/taskclassforum"
|
||||
)
|
||||
|
||||
type Handler struct {
|
||||
pb.UnimplementedTaskClassForumServiceServer
|
||||
svc *forumsv.Service
|
||||
}
|
||||
|
||||
func NewHandler(svc *forumsv.Service) *Handler {
|
||||
return &Handler{svc: svc}
|
||||
}
|
||||
|
||||
// service 负责统一校验 RPC 层依赖是否已经注入。
|
||||
//
|
||||
// 职责边界:
|
||||
// 1. 只判断 handler 自身和业务 service 是否可用;
|
||||
// 2. 不负责校验请求参数,也不处理具体业务规则;
|
||||
// 3. 失败时返回可直接转成 gRPC status 的业务错误。
|
||||
func (h *Handler) service() (*forumsv.Service, error) {
|
||||
if h == nil || h.svc == nil {
|
||||
return nil, errors.New("taskclassforum service dependency not initialized")
|
||||
}
|
||||
return h.svc, nil
|
||||
}
|
||||
|
||||
// ListPosts 负责把计划广场列表请求从 gRPC 协议转成内部服务调用。
|
||||
func (h *Handler) ListPosts(ctx context.Context, req *pb.ListForumPostsRequest) (*pb.ListForumPostsResponse, error) {
|
||||
svc, err := h.service()
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
if req == nil {
|
||||
return nil, grpcErrorFromServiceError(respond.MissingParam)
|
||||
}
|
||||
|
||||
items, page, err := svc.ListPosts(ctx, req.ActorUserId, int(req.Page), int(req.PageSize), req.Sort, req.Keyword, req.Tag)
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
return &pb.ListForumPostsResponse{
|
||||
Items: forumPostBriefsToPB(items),
|
||||
Page: forumPageToPB(page),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *Handler) ListTags(ctx context.Context, req *pb.ListForumTagsRequest) (*pb.ListForumTagsResponse, error) {
|
||||
svc, err := h.service()
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
if req == nil {
|
||||
return nil, grpcErrorFromServiceError(respond.MissingParam)
|
||||
}
|
||||
|
||||
items, err := svc.ListTags(ctx, req.ActorUserId, int(req.Limit))
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
return &pb.ListForumTagsResponse{Items: forumTagItemsToPB(items)}, nil
|
||||
}
|
||||
|
||||
func (h *Handler) CreatePost(ctx context.Context, req *pb.CreateForumPostRequest) (*pb.CreateForumPostResponse, error) {
|
||||
svc, err := h.service()
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
if req == nil {
|
||||
return nil, grpcErrorFromServiceError(respond.MissingParam)
|
||||
}
|
||||
|
||||
post, err := svc.CreatePost(ctx, forumcontracts.CreateForumPostRequest{
|
||||
ActorUserID: req.ActorUserId,
|
||||
TaskClassID: req.TaskClassId,
|
||||
Title: req.Title,
|
||||
Summary: req.Summary,
|
||||
Tags: append([]string(nil), req.Tags...),
|
||||
IdempotencyKey: req.IdempotencyKey,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
return &pb.CreateForumPostResponse{Post: forumPostBriefToPB(post)}, nil
|
||||
}
|
||||
|
||||
func (h *Handler) GetPost(ctx context.Context, req *pb.GetForumPostRequest) (*pb.GetForumPostResponse, error) {
|
||||
svc, err := h.service()
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
if req == nil {
|
||||
return nil, grpcErrorFromServiceError(respond.MissingParam)
|
||||
}
|
||||
|
||||
data, err := svc.GetPost(ctx, req.ActorUserId, req.PostId)
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
return &pb.GetForumPostResponse{Data: forumPostDetailToPB(data)}, nil
|
||||
}
|
||||
|
||||
func (h *Handler) LikePost(ctx context.Context, req *pb.LikeForumPostRequest) (*pb.LikeForumPostResponse, error) {
|
||||
svc, err := h.service()
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
if req == nil {
|
||||
return nil, grpcErrorFromServiceError(respond.MissingParam)
|
||||
}
|
||||
|
||||
counters, viewerState, err := svc.LikePost(ctx, req.ActorUserId, req.PostId)
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
return &pb.LikeForumPostResponse{
|
||||
Counters: forumPostCountersToPB(counters),
|
||||
ViewerState: forumPostViewerStateToPB(viewerState),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *Handler) UnlikePost(ctx context.Context, req *pb.UnlikeForumPostRequest) (*pb.UnlikeForumPostResponse, error) {
|
||||
svc, err := h.service()
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
if req == nil {
|
||||
return nil, grpcErrorFromServiceError(respond.MissingParam)
|
||||
}
|
||||
|
||||
counters, viewerState, err := svc.UnlikePost(ctx, req.ActorUserId, req.PostId)
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
return &pb.UnlikeForumPostResponse{
|
||||
Counters: forumPostCountersToPB(counters),
|
||||
ViewerState: forumPostViewerStateToPB(viewerState),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *Handler) ListComments(ctx context.Context, req *pb.ListForumCommentsRequest) (*pb.ListForumCommentsResponse, error) {
|
||||
svc, err := h.service()
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
if req == nil {
|
||||
return nil, grpcErrorFromServiceError(respond.MissingParam)
|
||||
}
|
||||
|
||||
items, page, err := svc.ListComments(ctx, req.ActorUserId, req.PostId, int(req.Page), int(req.PageSize), req.Sort)
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
return &pb.ListForumCommentsResponse{
|
||||
Items: forumCommentNodesToPB(items),
|
||||
Page: forumPageToPB(page),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *Handler) CreateComment(ctx context.Context, req *pb.CreateForumCommentRequest) (*pb.CreateForumCommentResponse, error) {
|
||||
svc, err := h.service()
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
if req == nil {
|
||||
return nil, grpcErrorFromServiceError(respond.MissingParam)
|
||||
}
|
||||
|
||||
comment, err := svc.CreateComment(ctx, forumcontracts.CreateForumCommentRequest{
|
||||
ActorUserID: req.ActorUserId,
|
||||
PostID: req.PostId,
|
||||
Content: req.Content,
|
||||
ParentCommentID: forumUint64PtrFromPositive(req.ParentCommentId),
|
||||
IdempotencyKey: req.IdempotencyKey,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
return &pb.CreateForumCommentResponse{Comment: forumCommentNodeToPB(comment)}, nil
|
||||
}
|
||||
|
||||
func (h *Handler) DeleteComment(ctx context.Context, req *pb.DeleteForumCommentRequest) (*pb.DeleteForumCommentResponse, error) {
|
||||
svc, err := h.service()
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
if req == nil {
|
||||
return nil, grpcErrorFromServiceError(respond.MissingParam)
|
||||
}
|
||||
|
||||
result, err := svc.DeleteComment(ctx, req.ActorUserId, req.CommentId)
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
return &pb.DeleteForumCommentResponse{
|
||||
CommentId: result.CommentID,
|
||||
Status: result.Status,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *Handler) ImportPost(ctx context.Context, req *pb.ImportForumPostRequest) (*pb.ImportForumPostResponse, error) {
|
||||
svc, err := h.service()
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
if req == nil {
|
||||
return nil, grpcErrorFromServiceError(respond.MissingParam)
|
||||
}
|
||||
|
||||
result, err := svc.ImportPost(ctx, forumcontracts.ImportForumPostRequest{
|
||||
ActorUserID: req.ActorUserId,
|
||||
PostID: req.PostId,
|
||||
TargetTitle: req.TargetTitle,
|
||||
IdempotencyKey: req.IdempotencyKey,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, grpcErrorFromServiceError(err)
|
||||
}
|
||||
return &pb.ImportForumPostResponse{
|
||||
ImportId: result.ImportID,
|
||||
PostId: result.PostID,
|
||||
NewTaskClassId: result.NewTaskClassID,
|
||||
TaskClassTitle: result.TaskClassTitle,
|
||||
ImportCount: result.ImportCount,
|
||||
CreatedAt: result.CreatedAt,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func forumPageToPB(page forumcontracts.PageResult) *pb.PageResponse {
|
||||
return &pb.PageResponse{
|
||||
Page: int32(page.Page),
|
||||
PageSize: int32(page.PageSize),
|
||||
Total: int32(page.Total),
|
||||
HasMore: page.HasMore,
|
||||
}
|
||||
}
|
||||
|
||||
func forumUserToPB(user forumcontracts.UserBrief) *pb.UserBrief {
|
||||
return &pb.UserBrief{
|
||||
UserId: user.UserID,
|
||||
Nickname: user.Nickname,
|
||||
AvatarUrl: user.AvatarURL,
|
||||
}
|
||||
}
|
||||
|
||||
func forumTemplateSummaryToPB(summary forumcontracts.TemplateSummary) *pb.TemplateSummary {
|
||||
return &pb.TemplateSummary{
|
||||
TaskCount: int32(summary.TaskCount),
|
||||
Mode: summary.Mode,
|
||||
StartDate: summary.StartDate,
|
||||
EndDate: summary.EndDate,
|
||||
StrategyLabels: append([]string(nil), summary.StrategyLabels...),
|
||||
}
|
||||
}
|
||||
|
||||
func forumPostCountersToPB(counters forumcontracts.ForumPostCounters) *pb.ForumPostCounters {
|
||||
return &pb.ForumPostCounters{
|
||||
LikeCount: counters.LikeCount,
|
||||
CommentCount: counters.CommentCount,
|
||||
ImportCount: counters.ImportCount,
|
||||
}
|
||||
}
|
||||
|
||||
func forumPostViewerStateToPB(viewerState forumcontracts.ForumPostViewerState) *pb.ForumPostViewerState {
|
||||
return &pb.ForumPostViewerState{
|
||||
Liked: viewerState.Liked,
|
||||
ImportedOnce: viewerState.ImportedOnce,
|
||||
}
|
||||
}
|
||||
|
||||
func forumPostBriefToPB(post *forumcontracts.ForumPostBrief) *pb.ForumPostBrief {
|
||||
if post == nil {
|
||||
return nil
|
||||
}
|
||||
return &pb.ForumPostBrief{
|
||||
PostId: post.PostID,
|
||||
Title: post.Title,
|
||||
Summary: post.Summary,
|
||||
Tags: append([]string(nil), post.Tags...),
|
||||
Author: forumUserToPB(post.Author),
|
||||
TemplateSummary: forumTemplateSummaryToPB(post.TemplateSummary),
|
||||
Counters: forumPostCountersToPB(post.Counters),
|
||||
ViewerState: forumPostViewerStateToPB(post.ViewerState),
|
||||
Status: post.Status,
|
||||
CreatedAt: post.CreatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
func forumPostBriefsToPB(items []forumcontracts.ForumPostBrief) []*pb.ForumPostBrief {
|
||||
if len(items) == 0 {
|
||||
return nil
|
||||
}
|
||||
result := make([]*pb.ForumPostBrief, 0, len(items))
|
||||
for i := range items {
|
||||
item := items[i]
|
||||
result = append(result, forumPostBriefToPB(&item))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func forumTemplateItemPreviewToPB(item forumcontracts.TemplateItemPreview) *pb.TemplateItemPreview {
|
||||
return &pb.TemplateItemPreview{
|
||||
ItemId: item.ItemID,
|
||||
Order: int32(item.Order),
|
||||
Content: item.Content,
|
||||
}
|
||||
}
|
||||
|
||||
func forumTemplateDetailToPB(detail forumcontracts.TemplateDetail) *pb.TemplateDetail {
|
||||
preview := make([]*pb.TemplateItemPreview, 0, len(detail.ItemsPreview))
|
||||
for i := range detail.ItemsPreview {
|
||||
item := detail.ItemsPreview[i]
|
||||
preview = append(preview, forumTemplateItemPreviewToPB(item))
|
||||
}
|
||||
return &pb.TemplateDetail{
|
||||
Mode: detail.Mode,
|
||||
StartDate: detail.StartDate,
|
||||
EndDate: detail.EndDate,
|
||||
StrategyLabels: append([]string(nil), detail.StrategyLabels...),
|
||||
TaskCount: int32(detail.TaskCount),
|
||||
ItemsPreview: preview,
|
||||
}
|
||||
}
|
||||
|
||||
func forumPostDetailToPB(detail *forumcontracts.ForumPostDetail) *pb.ForumPostDetail {
|
||||
if detail == nil {
|
||||
return nil
|
||||
}
|
||||
return &pb.ForumPostDetail{
|
||||
Post: forumPostBriefToPB(&detail.Post),
|
||||
Template: forumTemplateDetailToPB(detail.Template),
|
||||
}
|
||||
}
|
||||
|
||||
func forumTagItemsToPB(items []forumcontracts.ForumTagItem) []*pb.ForumTagItem {
|
||||
if len(items) == 0 {
|
||||
return nil
|
||||
}
|
||||
result := make([]*pb.ForumTagItem, 0, len(items))
|
||||
for i := range items {
|
||||
item := items[i]
|
||||
result = append(result, &pb.ForumTagItem{
|
||||
Tag: item.Tag,
|
||||
PostCount: int32(item.PostCount),
|
||||
})
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func forumCommentNodeToPB(node *forumcontracts.ForumCommentNode) *pb.ForumCommentNode {
|
||||
if node == nil {
|
||||
return nil
|
||||
}
|
||||
children := make([]*pb.ForumCommentNode, 0, len(node.Children))
|
||||
for i := range node.Children {
|
||||
child := node.Children[i]
|
||||
children = append(children, forumCommentNodeToPB(&child))
|
||||
}
|
||||
return &pb.ForumCommentNode{
|
||||
CommentId: node.CommentID,
|
||||
PostId: node.PostID,
|
||||
ParentCommentId: forumUint64FromPtr(node.ParentCommentID),
|
||||
Content: node.Content,
|
||||
Status: node.Status,
|
||||
Author: forumUserToPB(node.Author),
|
||||
CanDelete: node.CanDelete,
|
||||
CreatedAt: node.CreatedAt,
|
||||
DeletedAt: forumStringFromPtr(node.DeletedAt),
|
||||
Children: children,
|
||||
}
|
||||
}
|
||||
|
||||
func forumCommentNodesToPB(items []forumcontracts.ForumCommentNode) []*pb.ForumCommentNode {
|
||||
if len(items) == 0 {
|
||||
return nil
|
||||
}
|
||||
result := make([]*pb.ForumCommentNode, 0, len(items))
|
||||
for i := range items {
|
||||
item := items[i]
|
||||
result = append(result, forumCommentNodeToPB(&item))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func forumUint64FromPtr(value *uint64) uint64 {
|
||||
if value == nil {
|
||||
return 0
|
||||
}
|
||||
return *value
|
||||
}
|
||||
|
||||
func forumUint64PtrFromPositive(value uint64) *uint64 {
|
||||
if value == 0 {
|
||||
return nil
|
||||
}
|
||||
result := value
|
||||
return &result
|
||||
}
|
||||
|
||||
func forumStringFromPtr(value *string) string {
|
||||
if value == nil {
|
||||
return ""
|
||||
}
|
||||
return *value
|
||||
}
|
||||
339
backend/services/taskclassforum/rpc/pb/taskclassforum.pb.go
Normal file
339
backend/services/taskclassforum/rpc/pb/taskclassforum.pb.go
Normal file
@@ -0,0 +1,339 @@
|
||||
package pb
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
|
||||
var _ = proto.Marshal
|
||||
|
||||
const _ = proto.ProtoPackageIsVersion3
|
||||
|
||||
type PageRequest struct {
|
||||
Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
|
||||
PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
|
||||
}
|
||||
|
||||
func (m *PageRequest) Reset() { *m = PageRequest{} }
|
||||
func (m *PageRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*PageRequest) ProtoMessage() {}
|
||||
|
||||
type PageResponse struct {
|
||||
Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
|
||||
PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
|
||||
Total int32 `protobuf:"varint,3,opt,name=total,proto3" json:"total,omitempty"`
|
||||
HasMore bool `protobuf:"varint,4,opt,name=has_more,json=hasMore,proto3" json:"has_more,omitempty"`
|
||||
}
|
||||
|
||||
func (m *PageResponse) Reset() { *m = PageResponse{} }
|
||||
func (m *PageResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*PageResponse) ProtoMessage() {}
|
||||
|
||||
type UserBrief struct {
|
||||
UserId uint64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||
Nickname string `protobuf:"bytes,2,opt,name=nickname,proto3" json:"nickname,omitempty"`
|
||||
AvatarUrl string `protobuf:"bytes,3,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"`
|
||||
}
|
||||
|
||||
func (m *UserBrief) Reset() { *m = UserBrief{} }
|
||||
func (m *UserBrief) String() string { return proto.CompactTextString(m) }
|
||||
func (*UserBrief) ProtoMessage() {}
|
||||
|
||||
type TemplateSummary struct {
|
||||
TaskCount int32 `protobuf:"varint,1,opt,name=task_count,json=taskCount,proto3" json:"task_count,omitempty"`
|
||||
Mode string `protobuf:"bytes,2,opt,name=mode,proto3" json:"mode,omitempty"`
|
||||
StartDate string `protobuf:"bytes,3,opt,name=start_date,json=startDate,proto3" json:"start_date,omitempty"`
|
||||
EndDate string `protobuf:"bytes,4,opt,name=end_date,json=endDate,proto3" json:"end_date,omitempty"`
|
||||
StrategyLabels []string `protobuf:"bytes,5,rep,name=strategy_labels,json=strategyLabels,proto3" json:"strategy_labels,omitempty"`
|
||||
}
|
||||
|
||||
func (m *TemplateSummary) Reset() { *m = TemplateSummary{} }
|
||||
func (m *TemplateSummary) String() string { return proto.CompactTextString(m) }
|
||||
func (*TemplateSummary) ProtoMessage() {}
|
||||
|
||||
type ForumPostCounters struct {
|
||||
LikeCount int64 `protobuf:"varint,1,opt,name=like_count,json=likeCount,proto3" json:"like_count,omitempty"`
|
||||
CommentCount int64 `protobuf:"varint,2,opt,name=comment_count,json=commentCount,proto3" json:"comment_count,omitempty"`
|
||||
ImportCount int64 `protobuf:"varint,3,opt,name=import_count,json=importCount,proto3" json:"import_count,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ForumPostCounters) Reset() { *m = ForumPostCounters{} }
|
||||
func (m *ForumPostCounters) String() string { return proto.CompactTextString(m) }
|
||||
func (*ForumPostCounters) ProtoMessage() {}
|
||||
|
||||
type ForumPostViewerState struct {
|
||||
Liked bool `protobuf:"varint,1,opt,name=liked,proto3" json:"liked,omitempty"`
|
||||
ImportedOnce bool `protobuf:"varint,2,opt,name=imported_once,json=importedOnce,proto3" json:"imported_once,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ForumPostViewerState) Reset() { *m = ForumPostViewerState{} }
|
||||
func (m *ForumPostViewerState) String() string { return proto.CompactTextString(m) }
|
||||
func (*ForumPostViewerState) ProtoMessage() {}
|
||||
|
||||
type ForumPostBrief struct {
|
||||
PostId uint64 `protobuf:"varint,1,opt,name=post_id,json=postId,proto3" json:"post_id,omitempty"`
|
||||
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
|
||||
Summary string `protobuf:"bytes,3,opt,name=summary,proto3" json:"summary,omitempty"`
|
||||
Tags []string `protobuf:"bytes,4,rep,name=tags,proto3" json:"tags,omitempty"`
|
||||
Author *UserBrief `protobuf:"bytes,5,opt,name=author,proto3" json:"author,omitempty"`
|
||||
TemplateSummary *TemplateSummary `protobuf:"bytes,6,opt,name=template_summary,json=templateSummary,proto3" json:"template_summary,omitempty"`
|
||||
Counters *ForumPostCounters `protobuf:"bytes,7,opt,name=counters,proto3" json:"counters,omitempty"`
|
||||
ViewerState *ForumPostViewerState `protobuf:"bytes,8,opt,name=viewer_state,json=viewerState,proto3" json:"viewer_state,omitempty"`
|
||||
Status string `protobuf:"bytes,9,opt,name=status,proto3" json:"status,omitempty"`
|
||||
CreatedAt string `protobuf:"bytes,10,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ForumPostBrief) Reset() { *m = ForumPostBrief{} }
|
||||
func (m *ForumPostBrief) String() string { return proto.CompactTextString(m) }
|
||||
func (*ForumPostBrief) ProtoMessage() {}
|
||||
|
||||
type TemplateItemPreview struct {
|
||||
ItemId uint64 `protobuf:"varint,1,opt,name=item_id,json=itemId,proto3" json:"item_id,omitempty"`
|
||||
Order int32 `protobuf:"varint,2,opt,name=order,proto3" json:"order,omitempty"`
|
||||
Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"`
|
||||
}
|
||||
|
||||
func (m *TemplateItemPreview) Reset() { *m = TemplateItemPreview{} }
|
||||
func (m *TemplateItemPreview) String() string { return proto.CompactTextString(m) }
|
||||
func (*TemplateItemPreview) ProtoMessage() {}
|
||||
|
||||
type TemplateDetail struct {
|
||||
Mode string `protobuf:"bytes,1,opt,name=mode,proto3" json:"mode,omitempty"`
|
||||
StartDate string `protobuf:"bytes,2,opt,name=start_date,json=startDate,proto3" json:"start_date,omitempty"`
|
||||
EndDate string `protobuf:"bytes,3,opt,name=end_date,json=endDate,proto3" json:"end_date,omitempty"`
|
||||
StrategyLabels []string `protobuf:"bytes,4,rep,name=strategy_labels,json=strategyLabels,proto3" json:"strategy_labels,omitempty"`
|
||||
TaskCount int32 `protobuf:"varint,5,opt,name=task_count,json=taskCount,proto3" json:"task_count,omitempty"`
|
||||
ItemsPreview []*TemplateItemPreview `protobuf:"bytes,6,rep,name=items_preview,json=itemsPreview,proto3" json:"items_preview,omitempty"`
|
||||
}
|
||||
|
||||
func (m *TemplateDetail) Reset() { *m = TemplateDetail{} }
|
||||
func (m *TemplateDetail) String() string { return proto.CompactTextString(m) }
|
||||
func (*TemplateDetail) ProtoMessage() {}
|
||||
|
||||
type ForumPostDetail struct {
|
||||
Post *ForumPostBrief `protobuf:"bytes,1,opt,name=post,proto3" json:"post,omitempty"`
|
||||
Template *TemplateDetail `protobuf:"bytes,2,opt,name=template,proto3" json:"template,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ForumPostDetail) Reset() { *m = ForumPostDetail{} }
|
||||
func (m *ForumPostDetail) String() string { return proto.CompactTextString(m) }
|
||||
func (*ForumPostDetail) ProtoMessage() {}
|
||||
|
||||
type ForumCommentNode struct {
|
||||
CommentId uint64 `protobuf:"varint,1,opt,name=comment_id,json=commentId,proto3" json:"comment_id,omitempty"`
|
||||
PostId uint64 `protobuf:"varint,2,opt,name=post_id,json=postId,proto3" json:"post_id,omitempty"`
|
||||
ParentCommentId uint64 `protobuf:"varint,3,opt,name=parent_comment_id,json=parentCommentId,proto3" json:"parent_comment_id,omitempty"`
|
||||
Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"`
|
||||
Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"`
|
||||
Author *UserBrief `protobuf:"bytes,6,opt,name=author,proto3" json:"author,omitempty"`
|
||||
CanDelete bool `protobuf:"varint,7,opt,name=can_delete,json=canDelete,proto3" json:"can_delete,omitempty"`
|
||||
CreatedAt string `protobuf:"bytes,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||
DeletedAt string `protobuf:"bytes,9,opt,name=deleted_at,json=deletedAt,proto3" json:"deleted_at,omitempty"`
|
||||
Children []*ForumCommentNode `protobuf:"bytes,10,rep,name=children,proto3" json:"children,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ForumCommentNode) Reset() { *m = ForumCommentNode{} }
|
||||
func (m *ForumCommentNode) String() string { return proto.CompactTextString(m) }
|
||||
func (*ForumCommentNode) ProtoMessage() {}
|
||||
|
||||
type ListForumPostsRequest struct {
|
||||
ActorUserId uint64 `protobuf:"varint,1,opt,name=actor_user_id,json=actorUserId,proto3" json:"actor_user_id,omitempty"`
|
||||
Page int32 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"`
|
||||
PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
|
||||
Sort string `protobuf:"bytes,4,opt,name=sort,proto3" json:"sort,omitempty"`
|
||||
Keyword string `protobuf:"bytes,5,opt,name=keyword,proto3" json:"keyword,omitempty"`
|
||||
Tag string `protobuf:"bytes,6,opt,name=tag,proto3" json:"tag,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ListForumPostsRequest) Reset() { *m = ListForumPostsRequest{} }
|
||||
func (m *ListForumPostsRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListForumPostsRequest) ProtoMessage() {}
|
||||
|
||||
type ListForumPostsResponse struct {
|
||||
Items []*ForumPostBrief `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
|
||||
Page *PageResponse `protobuf:"bytes,2,opt,name=page,proto3" json:"page,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ListForumPostsResponse) Reset() { *m = ListForumPostsResponse{} }
|
||||
func (m *ListForumPostsResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListForumPostsResponse) ProtoMessage() {}
|
||||
|
||||
type ListForumTagsRequest struct {
|
||||
ActorUserId uint64 `protobuf:"varint,1,opt,name=actor_user_id,json=actorUserId,proto3" json:"actor_user_id,omitempty"`
|
||||
Limit int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ListForumTagsRequest) Reset() { *m = ListForumTagsRequest{} }
|
||||
func (m *ListForumTagsRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListForumTagsRequest) ProtoMessage() {}
|
||||
|
||||
type ForumTagItem struct {
|
||||
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
|
||||
PostCount int32 `protobuf:"varint,2,opt,name=post_count,json=postCount,proto3" json:"post_count,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ForumTagItem) Reset() { *m = ForumTagItem{} }
|
||||
func (m *ForumTagItem) String() string { return proto.CompactTextString(m) }
|
||||
func (*ForumTagItem) ProtoMessage() {}
|
||||
|
||||
type ListForumTagsResponse struct {
|
||||
Items []*ForumTagItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ListForumTagsResponse) Reset() { *m = ListForumTagsResponse{} }
|
||||
func (m *ListForumTagsResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListForumTagsResponse) ProtoMessage() {}
|
||||
|
||||
type CreateForumPostRequest struct {
|
||||
ActorUserId uint64 `protobuf:"varint,1,opt,name=actor_user_id,json=actorUserId,proto3" json:"actor_user_id,omitempty"`
|
||||
TaskClassId uint64 `protobuf:"varint,2,opt,name=task_class_id,json=taskClassId,proto3" json:"task_class_id,omitempty"`
|
||||
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
|
||||
Summary string `protobuf:"bytes,4,opt,name=summary,proto3" json:"summary,omitempty"`
|
||||
Tags []string `protobuf:"bytes,5,rep,name=tags,proto3" json:"tags,omitempty"`
|
||||
IdempotencyKey string `protobuf:"bytes,6,opt,name=idempotency_key,json=idempotencyKey,proto3" json:"idempotency_key,omitempty"`
|
||||
}
|
||||
|
||||
func (m *CreateForumPostRequest) Reset() { *m = CreateForumPostRequest{} }
|
||||
func (m *CreateForumPostRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateForumPostRequest) ProtoMessage() {}
|
||||
|
||||
type CreateForumPostResponse struct {
|
||||
Post *ForumPostBrief `protobuf:"bytes,1,opt,name=post,proto3" json:"post,omitempty"`
|
||||
}
|
||||
|
||||
func (m *CreateForumPostResponse) Reset() { *m = CreateForumPostResponse{} }
|
||||
func (m *CreateForumPostResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateForumPostResponse) ProtoMessage() {}
|
||||
|
||||
type GetForumPostRequest struct {
|
||||
ActorUserId uint64 `protobuf:"varint,1,opt,name=actor_user_id,json=actorUserId,proto3" json:"actor_user_id,omitempty"`
|
||||
PostId uint64 `protobuf:"varint,2,opt,name=post_id,json=postId,proto3" json:"post_id,omitempty"`
|
||||
}
|
||||
|
||||
func (m *GetForumPostRequest) Reset() { *m = GetForumPostRequest{} }
|
||||
func (m *GetForumPostRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetForumPostRequest) ProtoMessage() {}
|
||||
|
||||
type GetForumPostResponse struct {
|
||||
Data *ForumPostDetail `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func (m *GetForumPostResponse) Reset() { *m = GetForumPostResponse{} }
|
||||
func (m *GetForumPostResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetForumPostResponse) ProtoMessage() {}
|
||||
|
||||
type LikeForumPostRequest struct {
|
||||
ActorUserId uint64 `protobuf:"varint,1,opt,name=actor_user_id,json=actorUserId,proto3" json:"actor_user_id,omitempty"`
|
||||
PostId uint64 `protobuf:"varint,2,opt,name=post_id,json=postId,proto3" json:"post_id,omitempty"`
|
||||
}
|
||||
|
||||
func (m *LikeForumPostRequest) Reset() { *m = LikeForumPostRequest{} }
|
||||
func (m *LikeForumPostRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*LikeForumPostRequest) ProtoMessage() {}
|
||||
|
||||
type LikeForumPostResponse struct {
|
||||
Counters *ForumPostCounters `protobuf:"bytes,1,opt,name=counters,proto3" json:"counters,omitempty"`
|
||||
ViewerState *ForumPostViewerState `protobuf:"bytes,2,opt,name=viewer_state,json=viewerState,proto3" json:"viewer_state,omitempty"`
|
||||
}
|
||||
|
||||
func (m *LikeForumPostResponse) Reset() { *m = LikeForumPostResponse{} }
|
||||
func (m *LikeForumPostResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*LikeForumPostResponse) ProtoMessage() {}
|
||||
|
||||
type UnlikeForumPostRequest struct {
|
||||
ActorUserId uint64 `protobuf:"varint,1,opt,name=actor_user_id,json=actorUserId,proto3" json:"actor_user_id,omitempty"`
|
||||
PostId uint64 `protobuf:"varint,2,opt,name=post_id,json=postId,proto3" json:"post_id,omitempty"`
|
||||
}
|
||||
|
||||
func (m *UnlikeForumPostRequest) Reset() { *m = UnlikeForumPostRequest{} }
|
||||
func (m *UnlikeForumPostRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*UnlikeForumPostRequest) ProtoMessage() {}
|
||||
|
||||
type UnlikeForumPostResponse struct {
|
||||
Counters *ForumPostCounters `protobuf:"bytes,1,opt,name=counters,proto3" json:"counters,omitempty"`
|
||||
ViewerState *ForumPostViewerState `protobuf:"bytes,2,opt,name=viewer_state,json=viewerState,proto3" json:"viewer_state,omitempty"`
|
||||
}
|
||||
|
||||
func (m *UnlikeForumPostResponse) Reset() { *m = UnlikeForumPostResponse{} }
|
||||
func (m *UnlikeForumPostResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*UnlikeForumPostResponse) ProtoMessage() {}
|
||||
|
||||
type ListForumCommentsRequest struct {
|
||||
ActorUserId uint64 `protobuf:"varint,1,opt,name=actor_user_id,json=actorUserId,proto3" json:"actor_user_id,omitempty"`
|
||||
PostId uint64 `protobuf:"varint,2,opt,name=post_id,json=postId,proto3" json:"post_id,omitempty"`
|
||||
Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty"`
|
||||
PageSize int32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
|
||||
Sort string `protobuf:"bytes,5,opt,name=sort,proto3" json:"sort,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ListForumCommentsRequest) Reset() { *m = ListForumCommentsRequest{} }
|
||||
func (m *ListForumCommentsRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListForumCommentsRequest) ProtoMessage() {}
|
||||
|
||||
type ListForumCommentsResponse struct {
|
||||
Items []*ForumCommentNode `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
|
||||
Page *PageResponse `protobuf:"bytes,2,opt,name=page,proto3" json:"page,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ListForumCommentsResponse) Reset() { *m = ListForumCommentsResponse{} }
|
||||
func (m *ListForumCommentsResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListForumCommentsResponse) ProtoMessage() {}
|
||||
|
||||
type CreateForumCommentRequest struct {
|
||||
ActorUserId uint64 `protobuf:"varint,1,opt,name=actor_user_id,json=actorUserId,proto3" json:"actor_user_id,omitempty"`
|
||||
PostId uint64 `protobuf:"varint,2,opt,name=post_id,json=postId,proto3" json:"post_id,omitempty"`
|
||||
Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"`
|
||||
ParentCommentId uint64 `protobuf:"varint,4,opt,name=parent_comment_id,json=parentCommentId,proto3" json:"parent_comment_id,omitempty"`
|
||||
IdempotencyKey string `protobuf:"bytes,5,opt,name=idempotency_key,json=idempotencyKey,proto3" json:"idempotency_key,omitempty"`
|
||||
}
|
||||
|
||||
func (m *CreateForumCommentRequest) Reset() { *m = CreateForumCommentRequest{} }
|
||||
func (m *CreateForumCommentRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateForumCommentRequest) ProtoMessage() {}
|
||||
|
||||
type CreateForumCommentResponse struct {
|
||||
Comment *ForumCommentNode `protobuf:"bytes,1,opt,name=comment,proto3" json:"comment,omitempty"`
|
||||
}
|
||||
|
||||
func (m *CreateForumCommentResponse) Reset() { *m = CreateForumCommentResponse{} }
|
||||
func (m *CreateForumCommentResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*CreateForumCommentResponse) ProtoMessage() {}
|
||||
|
||||
type DeleteForumCommentRequest struct {
|
||||
ActorUserId uint64 `protobuf:"varint,1,opt,name=actor_user_id,json=actorUserId,proto3" json:"actor_user_id,omitempty"`
|
||||
CommentId uint64 `protobuf:"varint,2,opt,name=comment_id,json=commentId,proto3" json:"comment_id,omitempty"`
|
||||
}
|
||||
|
||||
func (m *DeleteForumCommentRequest) Reset() { *m = DeleteForumCommentRequest{} }
|
||||
func (m *DeleteForumCommentRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*DeleteForumCommentRequest) ProtoMessage() {}
|
||||
|
||||
type DeleteForumCommentResponse struct {
|
||||
CommentId uint64 `protobuf:"varint,1,opt,name=comment_id,json=commentId,proto3" json:"comment_id,omitempty"`
|
||||
Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
|
||||
}
|
||||
|
||||
func (m *DeleteForumCommentResponse) Reset() { *m = DeleteForumCommentResponse{} }
|
||||
func (m *DeleteForumCommentResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*DeleteForumCommentResponse) ProtoMessage() {}
|
||||
|
||||
type ImportForumPostRequest struct {
|
||||
ActorUserId uint64 `protobuf:"varint,1,opt,name=actor_user_id,json=actorUserId,proto3" json:"actor_user_id,omitempty"`
|
||||
PostId uint64 `protobuf:"varint,2,opt,name=post_id,json=postId,proto3" json:"post_id,omitempty"`
|
||||
TargetTitle string `protobuf:"bytes,3,opt,name=target_title,json=targetTitle,proto3" json:"target_title,omitempty"`
|
||||
IdempotencyKey string `protobuf:"bytes,4,opt,name=idempotency_key,json=idempotencyKey,proto3" json:"idempotency_key,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ImportForumPostRequest) Reset() { *m = ImportForumPostRequest{} }
|
||||
func (m *ImportForumPostRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ImportForumPostRequest) ProtoMessage() {}
|
||||
|
||||
type ImportForumPostResponse struct {
|
||||
ImportId uint64 `protobuf:"varint,1,opt,name=import_id,json=importId,proto3" json:"import_id,omitempty"`
|
||||
PostId uint64 `protobuf:"varint,2,opt,name=post_id,json=postId,proto3" json:"post_id,omitempty"`
|
||||
NewTaskClassId uint64 `protobuf:"varint,3,opt,name=new_task_class_id,json=newTaskClassId,proto3" json:"new_task_class_id,omitempty"`
|
||||
TaskClassTitle string `protobuf:"bytes,4,opt,name=task_class_title,json=taskClassTitle,proto3" json:"task_class_title,omitempty"`
|
||||
ImportCount int64 `protobuf:"varint,5,opt,name=import_count,json=importCount,proto3" json:"import_count,omitempty"`
|
||||
CreatedAt string `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ImportForumPostResponse) Reset() { *m = ImportForumPostResponse{} }
|
||||
func (m *ImportForumPostResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ImportForumPostResponse) ProtoMessage() {}
|
||||
213
backend/services/taskclassforum/rpc/pb/taskclassforum_grpc.pb.go
Normal file
213
backend/services/taskclassforum/rpc/pb/taskclassforum_grpc.pb.go
Normal file
@@ -0,0 +1,213 @@
|
||||
package pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
const (
|
||||
TaskClassForumService_ListPosts_FullMethodName = "/smartflow.taskclassforum.TaskClassForumService/ListPosts"
|
||||
TaskClassForumService_ListTags_FullMethodName = "/smartflow.taskclassforum.TaskClassForumService/ListTags"
|
||||
TaskClassForumService_CreatePost_FullMethodName = "/smartflow.taskclassforum.TaskClassForumService/CreatePost"
|
||||
TaskClassForumService_GetPost_FullMethodName = "/smartflow.taskclassforum.TaskClassForumService/GetPost"
|
||||
TaskClassForumService_LikePost_FullMethodName = "/smartflow.taskclassforum.TaskClassForumService/LikePost"
|
||||
TaskClassForumService_UnlikePost_FullMethodName = "/smartflow.taskclassforum.TaskClassForumService/UnlikePost"
|
||||
TaskClassForumService_ListComments_FullMethodName = "/smartflow.taskclassforum.TaskClassForumService/ListComments"
|
||||
TaskClassForumService_CreateComment_FullMethodName = "/smartflow.taskclassforum.TaskClassForumService/CreateComment"
|
||||
TaskClassForumService_DeleteComment_FullMethodName = "/smartflow.taskclassforum.TaskClassForumService/DeleteComment"
|
||||
TaskClassForumService_ImportPost_FullMethodName = "/smartflow.taskclassforum.TaskClassForumService/ImportPost"
|
||||
)
|
||||
|
||||
type TaskClassForumServiceClient interface {
|
||||
ListPosts(ctx context.Context, in *ListForumPostsRequest, opts ...grpc.CallOption) (*ListForumPostsResponse, error)
|
||||
ListTags(ctx context.Context, in *ListForumTagsRequest, opts ...grpc.CallOption) (*ListForumTagsResponse, error)
|
||||
CreatePost(ctx context.Context, in *CreateForumPostRequest, opts ...grpc.CallOption) (*CreateForumPostResponse, error)
|
||||
GetPost(ctx context.Context, in *GetForumPostRequest, opts ...grpc.CallOption) (*GetForumPostResponse, error)
|
||||
LikePost(ctx context.Context, in *LikeForumPostRequest, opts ...grpc.CallOption) (*LikeForumPostResponse, error)
|
||||
UnlikePost(ctx context.Context, in *UnlikeForumPostRequest, opts ...grpc.CallOption) (*UnlikeForumPostResponse, error)
|
||||
ListComments(ctx context.Context, in *ListForumCommentsRequest, opts ...grpc.CallOption) (*ListForumCommentsResponse, error)
|
||||
CreateComment(ctx context.Context, in *CreateForumCommentRequest, opts ...grpc.CallOption) (*CreateForumCommentResponse, error)
|
||||
DeleteComment(ctx context.Context, in *DeleteForumCommentRequest, opts ...grpc.CallOption) (*DeleteForumCommentResponse, error)
|
||||
ImportPost(ctx context.Context, in *ImportForumPostRequest, opts ...grpc.CallOption) (*ImportForumPostResponse, error)
|
||||
}
|
||||
|
||||
type taskClassForumServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewTaskClassForumServiceClient(cc grpc.ClientConnInterface) TaskClassForumServiceClient {
|
||||
return &taskClassForumServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *taskClassForumServiceClient) ListPosts(ctx context.Context, in *ListForumPostsRequest, opts ...grpc.CallOption) (*ListForumPostsResponse, error) {
|
||||
return invokeTaskClassForum[ListForumPostsResponse](ctx, c.cc, TaskClassForumService_ListPosts_FullMethodName, in, opts...)
|
||||
}
|
||||
|
||||
func (c *taskClassForumServiceClient) ListTags(ctx context.Context, in *ListForumTagsRequest, opts ...grpc.CallOption) (*ListForumTagsResponse, error) {
|
||||
return invokeTaskClassForum[ListForumTagsResponse](ctx, c.cc, TaskClassForumService_ListTags_FullMethodName, in, opts...)
|
||||
}
|
||||
|
||||
func (c *taskClassForumServiceClient) CreatePost(ctx context.Context, in *CreateForumPostRequest, opts ...grpc.CallOption) (*CreateForumPostResponse, error) {
|
||||
return invokeTaskClassForum[CreateForumPostResponse](ctx, c.cc, TaskClassForumService_CreatePost_FullMethodName, in, opts...)
|
||||
}
|
||||
|
||||
func (c *taskClassForumServiceClient) GetPost(ctx context.Context, in *GetForumPostRequest, opts ...grpc.CallOption) (*GetForumPostResponse, error) {
|
||||
return invokeTaskClassForum[GetForumPostResponse](ctx, c.cc, TaskClassForumService_GetPost_FullMethodName, in, opts...)
|
||||
}
|
||||
|
||||
func (c *taskClassForumServiceClient) LikePost(ctx context.Context, in *LikeForumPostRequest, opts ...grpc.CallOption) (*LikeForumPostResponse, error) {
|
||||
return invokeTaskClassForum[LikeForumPostResponse](ctx, c.cc, TaskClassForumService_LikePost_FullMethodName, in, opts...)
|
||||
}
|
||||
|
||||
func (c *taskClassForumServiceClient) UnlikePost(ctx context.Context, in *UnlikeForumPostRequest, opts ...grpc.CallOption) (*UnlikeForumPostResponse, error) {
|
||||
return invokeTaskClassForum[UnlikeForumPostResponse](ctx, c.cc, TaskClassForumService_UnlikePost_FullMethodName, in, opts...)
|
||||
}
|
||||
|
||||
func (c *taskClassForumServiceClient) ListComments(ctx context.Context, in *ListForumCommentsRequest, opts ...grpc.CallOption) (*ListForumCommentsResponse, error) {
|
||||
return invokeTaskClassForum[ListForumCommentsResponse](ctx, c.cc, TaskClassForumService_ListComments_FullMethodName, in, opts...)
|
||||
}
|
||||
|
||||
func (c *taskClassForumServiceClient) CreateComment(ctx context.Context, in *CreateForumCommentRequest, opts ...grpc.CallOption) (*CreateForumCommentResponse, error) {
|
||||
return invokeTaskClassForum[CreateForumCommentResponse](ctx, c.cc, TaskClassForumService_CreateComment_FullMethodName, in, opts...)
|
||||
}
|
||||
|
||||
func (c *taskClassForumServiceClient) DeleteComment(ctx context.Context, in *DeleteForumCommentRequest, opts ...grpc.CallOption) (*DeleteForumCommentResponse, error) {
|
||||
return invokeTaskClassForum[DeleteForumCommentResponse](ctx, c.cc, TaskClassForumService_DeleteComment_FullMethodName, in, opts...)
|
||||
}
|
||||
|
||||
func (c *taskClassForumServiceClient) ImportPost(ctx context.Context, in *ImportForumPostRequest, opts ...grpc.CallOption) (*ImportForumPostResponse, error) {
|
||||
return invokeTaskClassForum[ImportForumPostResponse](ctx, c.cc, TaskClassForumService_ImportPost_FullMethodName, in, opts...)
|
||||
}
|
||||
|
||||
func invokeTaskClassForum[Resp any](ctx context.Context, cc grpc.ClientConnInterface, fullMethod string, in interface{}, opts ...grpc.CallOption) (*Resp, error) {
|
||||
out := new(Resp)
|
||||
err := cc.Invoke(ctx, fullMethod, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type TaskClassForumServiceServer interface {
|
||||
ListPosts(context.Context, *ListForumPostsRequest) (*ListForumPostsResponse, error)
|
||||
ListTags(context.Context, *ListForumTagsRequest) (*ListForumTagsResponse, error)
|
||||
CreatePost(context.Context, *CreateForumPostRequest) (*CreateForumPostResponse, error)
|
||||
GetPost(context.Context, *GetForumPostRequest) (*GetForumPostResponse, error)
|
||||
LikePost(context.Context, *LikeForumPostRequest) (*LikeForumPostResponse, error)
|
||||
UnlikePost(context.Context, *UnlikeForumPostRequest) (*UnlikeForumPostResponse, error)
|
||||
ListComments(context.Context, *ListForumCommentsRequest) (*ListForumCommentsResponse, error)
|
||||
CreateComment(context.Context, *CreateForumCommentRequest) (*CreateForumCommentResponse, error)
|
||||
DeleteComment(context.Context, *DeleteForumCommentRequest) (*DeleteForumCommentResponse, error)
|
||||
ImportPost(context.Context, *ImportForumPostRequest) (*ImportForumPostResponse, error)
|
||||
}
|
||||
|
||||
type UnimplementedTaskClassForumServiceServer struct{}
|
||||
|
||||
func (UnimplementedTaskClassForumServiceServer) ListPosts(context.Context, *ListForumPostsRequest) (*ListForumPostsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListPosts not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedTaskClassForumServiceServer) ListTags(context.Context, *ListForumTagsRequest) (*ListForumTagsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListTags not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedTaskClassForumServiceServer) CreatePost(context.Context, *CreateForumPostRequest) (*CreateForumPostResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreatePost not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedTaskClassForumServiceServer) GetPost(context.Context, *GetForumPostRequest) (*GetForumPostResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetPost not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedTaskClassForumServiceServer) LikePost(context.Context, *LikeForumPostRequest) (*LikeForumPostResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method LikePost not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedTaskClassForumServiceServer) UnlikePost(context.Context, *UnlikeForumPostRequest) (*UnlikeForumPostResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UnlikePost not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedTaskClassForumServiceServer) ListComments(context.Context, *ListForumCommentsRequest) (*ListForumCommentsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListComments not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedTaskClassForumServiceServer) CreateComment(context.Context, *CreateForumCommentRequest) (*CreateForumCommentResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateComment not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedTaskClassForumServiceServer) DeleteComment(context.Context, *DeleteForumCommentRequest) (*DeleteForumCommentResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteComment not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedTaskClassForumServiceServer) ImportPost(context.Context, *ImportForumPostRequest) (*ImportForumPostResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ImportPost not implemented")
|
||||
}
|
||||
|
||||
func RegisterTaskClassForumServiceServer(s grpc.ServiceRegistrar, srv TaskClassForumServiceServer) {
|
||||
s.RegisterService(&TaskClassForumService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func taskClassForumUnaryHandler[Req any](methodName string, fullMethod string, invoke func(TaskClassForumServiceServer, context.Context, *Req) (interface{}, error)) grpc.MethodDesc {
|
||||
return grpc.MethodDesc{
|
||||
MethodName: methodName,
|
||||
Handler: func(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(Req)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return invoke(srv.(TaskClassForumServiceServer), ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: fullMethod,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return invoke(srv.(TaskClassForumServiceServer), ctx, req.(*Req))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
var TaskClassForumService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "smartflow.taskclassforum.TaskClassForumService",
|
||||
HandlerType: (*TaskClassForumServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
taskClassForumUnaryHandler[ListForumPostsRequest]("ListPosts", TaskClassForumService_ListPosts_FullMethodName, func(s TaskClassForumServiceServer, ctx context.Context, req *ListForumPostsRequest) (interface{}, error) {
|
||||
return s.ListPosts(ctx, req)
|
||||
}),
|
||||
taskClassForumUnaryHandler[ListForumTagsRequest]("ListTags", TaskClassForumService_ListTags_FullMethodName, func(s TaskClassForumServiceServer, ctx context.Context, req *ListForumTagsRequest) (interface{}, error) {
|
||||
return s.ListTags(ctx, req)
|
||||
}),
|
||||
taskClassForumUnaryHandler[CreateForumPostRequest]("CreatePost", TaskClassForumService_CreatePost_FullMethodName, func(s TaskClassForumServiceServer, ctx context.Context, req *CreateForumPostRequest) (interface{}, error) {
|
||||
return s.CreatePost(ctx, req)
|
||||
}),
|
||||
taskClassForumUnaryHandler[GetForumPostRequest]("GetPost", TaskClassForumService_GetPost_FullMethodName, func(s TaskClassForumServiceServer, ctx context.Context, req *GetForumPostRequest) (interface{}, error) {
|
||||
return s.GetPost(ctx, req)
|
||||
}),
|
||||
taskClassForumUnaryHandler[LikeForumPostRequest]("LikePost", TaskClassForumService_LikePost_FullMethodName, func(s TaskClassForumServiceServer, ctx context.Context, req *LikeForumPostRequest) (interface{}, error) {
|
||||
return s.LikePost(ctx, req)
|
||||
}),
|
||||
taskClassForumUnaryHandler[UnlikeForumPostRequest]("UnlikePost", TaskClassForumService_UnlikePost_FullMethodName, func(s TaskClassForumServiceServer, ctx context.Context, req *UnlikeForumPostRequest) (interface{}, error) {
|
||||
return s.UnlikePost(ctx, req)
|
||||
}),
|
||||
taskClassForumUnaryHandler[ListForumCommentsRequest]("ListComments", TaskClassForumService_ListComments_FullMethodName, func(s TaskClassForumServiceServer, ctx context.Context, req *ListForumCommentsRequest) (interface{}, error) {
|
||||
return s.ListComments(ctx, req)
|
||||
}),
|
||||
taskClassForumUnaryHandler[CreateForumCommentRequest]("CreateComment", TaskClassForumService_CreateComment_FullMethodName, func(s TaskClassForumServiceServer, ctx context.Context, req *CreateForumCommentRequest) (interface{}, error) {
|
||||
return s.CreateComment(ctx, req)
|
||||
}),
|
||||
taskClassForumUnaryHandler[DeleteForumCommentRequest]("DeleteComment", TaskClassForumService_DeleteComment_FullMethodName, func(s TaskClassForumServiceServer, ctx context.Context, req *DeleteForumCommentRequest) (interface{}, error) {
|
||||
return s.DeleteComment(ctx, req)
|
||||
}),
|
||||
taskClassForumUnaryHandler[ImportForumPostRequest]("ImportPost", TaskClassForumService_ImportPost_FullMethodName, func(s TaskClassForumServiceServer, ctx context.Context, req *ImportForumPostRequest) (interface{}, error) {
|
||||
return s.ImportPost(ctx, req)
|
||||
}),
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "taskclassforum.proto",
|
||||
}
|
||||
73
backend/services/taskclassforum/rpc/server.go
Normal file
73
backend/services/taskclassforum/rpc/server.go
Normal file
@@ -0,0 +1,73 @@
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/LoveLosita/smartflow/backend/services/taskclassforum/rpc/pb"
|
||||
forumsv "github.com/LoveLosita/smartflow/backend/services/taskclassforum/sv"
|
||||
"github.com/zeromicro/go-zero/core/service"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultListenOn = "0.0.0.0:9090"
|
||||
defaultTimeout = 2 * time.Second
|
||||
)
|
||||
|
||||
type ServerOptions struct {
|
||||
ListenOn string
|
||||
Timeout time.Duration
|
||||
Service *forumsv.Service
|
||||
}
|
||||
|
||||
// Start 启动计划广场 zrpc 服务。
|
||||
//
|
||||
// 职责边界:
|
||||
// 1. 只负责装配 go-zero zrpc server 和注册 protobuf service;
|
||||
// 2. 不创建 DB 连接,也不装配 TaskClass legacy adapter,这些依赖由 cmd 入口注入;
|
||||
// 3. 启动后阻塞当前进程,保持后续“一服务一进程”的迁移方向。
|
||||
func Start(opts ServerOptions) {
|
||||
server, listenOn, err := NewServer(opts)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to build taskclassforum zrpc server: %v", err)
|
||||
}
|
||||
defer server.Stop()
|
||||
|
||||
log.Printf("taskclassforum zrpc service starting on %s", listenOn)
|
||||
server.Start()
|
||||
}
|
||||
|
||||
// NewServer 负责创建计划广场 RPC server,供 cmd 启动和测试复用。
|
||||
func NewServer(opts ServerOptions) (*zrpc.RpcServer, string, error) {
|
||||
if opts.Service == nil {
|
||||
return nil, "", errors.New("taskclassforum service dependency not initialized")
|
||||
}
|
||||
|
||||
listenOn := strings.TrimSpace(opts.ListenOn)
|
||||
if listenOn == "" {
|
||||
listenOn = defaultListenOn
|
||||
}
|
||||
timeout := opts.Timeout
|
||||
if timeout <= 0 {
|
||||
timeout = defaultTimeout
|
||||
}
|
||||
|
||||
server, err := zrpc.NewServer(zrpc.RpcServerConf{
|
||||
ServiceConf: service.ServiceConf{
|
||||
Name: "taskclassforum.rpc",
|
||||
Mode: service.DevMode,
|
||||
},
|
||||
ListenOn: listenOn,
|
||||
Timeout: int64(timeout / time.Millisecond),
|
||||
}, func(grpcServer *grpc.Server) {
|
||||
pb.RegisterTaskClassForumServiceServer(grpcServer, NewHandler(opts.Service))
|
||||
})
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return server, listenOn, nil
|
||||
}
|
||||
222
backend/services/taskclassforum/rpc/taskclassforum.proto
Normal file
222
backend/services/taskclassforum/rpc/taskclassforum.proto
Normal file
@@ -0,0 +1,222 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package smartflow.taskclassforum;
|
||||
|
||||
option go_package = "github.com/LoveLosita/smartflow/backend/services/taskclassforum/rpc/pb";
|
||||
|
||||
service TaskClassForumService {
|
||||
rpc ListPosts(ListForumPostsRequest) returns (ListForumPostsResponse);
|
||||
rpc ListTags(ListForumTagsRequest) returns (ListForumTagsResponse);
|
||||
rpc CreatePost(CreateForumPostRequest) returns (CreateForumPostResponse);
|
||||
rpc GetPost(GetForumPostRequest) returns (GetForumPostResponse);
|
||||
rpc LikePost(LikeForumPostRequest) returns (LikeForumPostResponse);
|
||||
rpc UnlikePost(UnlikeForumPostRequest) returns (UnlikeForumPostResponse);
|
||||
rpc ListComments(ListForumCommentsRequest) returns (ListForumCommentsResponse);
|
||||
rpc CreateComment(CreateForumCommentRequest) returns (CreateForumCommentResponse);
|
||||
rpc DeleteComment(DeleteForumCommentRequest) returns (DeleteForumCommentResponse);
|
||||
rpc ImportPost(ImportForumPostRequest) returns (ImportForumPostResponse);
|
||||
}
|
||||
|
||||
message PageRequest {
|
||||
int32 page = 1;
|
||||
int32 page_size = 2;
|
||||
}
|
||||
|
||||
message PageResponse {
|
||||
int32 page = 1;
|
||||
int32 page_size = 2;
|
||||
int32 total = 3;
|
||||
bool has_more = 4;
|
||||
}
|
||||
|
||||
message UserBrief {
|
||||
uint64 user_id = 1;
|
||||
string nickname = 2;
|
||||
string avatar_url = 3;
|
||||
}
|
||||
|
||||
message TemplateSummary {
|
||||
int32 task_count = 1;
|
||||
string mode = 2;
|
||||
string start_date = 3;
|
||||
string end_date = 4;
|
||||
repeated string strategy_labels = 5;
|
||||
}
|
||||
|
||||
message ForumPostCounters {
|
||||
int64 like_count = 1;
|
||||
int64 comment_count = 2;
|
||||
int64 import_count = 3;
|
||||
}
|
||||
|
||||
message ForumPostViewerState {
|
||||
bool liked = 1;
|
||||
bool imported_once = 2;
|
||||
}
|
||||
|
||||
message ForumPostBrief {
|
||||
uint64 post_id = 1;
|
||||
string title = 2;
|
||||
string summary = 3;
|
||||
repeated string tags = 4;
|
||||
UserBrief author = 5;
|
||||
TemplateSummary template_summary = 6;
|
||||
ForumPostCounters counters = 7;
|
||||
ForumPostViewerState viewer_state = 8;
|
||||
string status = 9;
|
||||
string created_at = 10;
|
||||
}
|
||||
|
||||
message TemplateItemPreview {
|
||||
uint64 item_id = 1;
|
||||
int32 order = 2;
|
||||
string content = 3;
|
||||
}
|
||||
|
||||
message TemplateDetail {
|
||||
string mode = 1;
|
||||
string start_date = 2;
|
||||
string end_date = 3;
|
||||
repeated string strategy_labels = 4;
|
||||
int32 task_count = 5;
|
||||
repeated TemplateItemPreview items_preview = 6;
|
||||
}
|
||||
|
||||
message ForumPostDetail {
|
||||
ForumPostBrief post = 1;
|
||||
TemplateDetail template = 2;
|
||||
}
|
||||
|
||||
message ForumCommentNode {
|
||||
uint64 comment_id = 1;
|
||||
uint64 post_id = 2;
|
||||
uint64 parent_comment_id = 3;
|
||||
string content = 4;
|
||||
string status = 5;
|
||||
UserBrief author = 6;
|
||||
bool can_delete = 7;
|
||||
string created_at = 8;
|
||||
string deleted_at = 9;
|
||||
repeated ForumCommentNode children = 10;
|
||||
}
|
||||
|
||||
message ListForumPostsRequest {
|
||||
uint64 actor_user_id = 1;
|
||||
int32 page = 2;
|
||||
int32 page_size = 3;
|
||||
string sort = 4;
|
||||
string keyword = 5;
|
||||
string tag = 6;
|
||||
}
|
||||
|
||||
message ListForumPostsResponse {
|
||||
repeated ForumPostBrief items = 1;
|
||||
PageResponse page = 2;
|
||||
}
|
||||
|
||||
message ListForumTagsRequest {
|
||||
uint64 actor_user_id = 1;
|
||||
int32 limit = 2;
|
||||
}
|
||||
|
||||
message ForumTagItem {
|
||||
string tag = 1;
|
||||
int32 post_count = 2;
|
||||
}
|
||||
|
||||
message ListForumTagsResponse {
|
||||
repeated ForumTagItem items = 1;
|
||||
}
|
||||
|
||||
message CreateForumPostRequest {
|
||||
uint64 actor_user_id = 1;
|
||||
uint64 task_class_id = 2;
|
||||
string title = 3;
|
||||
string summary = 4;
|
||||
repeated string tags = 5;
|
||||
string idempotency_key = 6;
|
||||
}
|
||||
|
||||
message CreateForumPostResponse {
|
||||
ForumPostBrief post = 1;
|
||||
}
|
||||
|
||||
message GetForumPostRequest {
|
||||
uint64 actor_user_id = 1;
|
||||
uint64 post_id = 2;
|
||||
}
|
||||
|
||||
message GetForumPostResponse {
|
||||
ForumPostDetail data = 1;
|
||||
}
|
||||
|
||||
message LikeForumPostRequest {
|
||||
uint64 actor_user_id = 1;
|
||||
uint64 post_id = 2;
|
||||
}
|
||||
|
||||
message LikeForumPostResponse {
|
||||
ForumPostCounters counters = 1;
|
||||
ForumPostViewerState viewer_state = 2;
|
||||
}
|
||||
|
||||
message UnlikeForumPostRequest {
|
||||
uint64 actor_user_id = 1;
|
||||
uint64 post_id = 2;
|
||||
}
|
||||
|
||||
message UnlikeForumPostResponse {
|
||||
ForumPostCounters counters = 1;
|
||||
ForumPostViewerState viewer_state = 2;
|
||||
}
|
||||
|
||||
message ListForumCommentsRequest {
|
||||
uint64 actor_user_id = 1;
|
||||
uint64 post_id = 2;
|
||||
int32 page = 3;
|
||||
int32 page_size = 4;
|
||||
string sort = 5;
|
||||
}
|
||||
|
||||
message ListForumCommentsResponse {
|
||||
repeated ForumCommentNode items = 1;
|
||||
PageResponse page = 2;
|
||||
}
|
||||
|
||||
message CreateForumCommentRequest {
|
||||
uint64 actor_user_id = 1;
|
||||
uint64 post_id = 2;
|
||||
string content = 3;
|
||||
uint64 parent_comment_id = 4;
|
||||
string idempotency_key = 5;
|
||||
}
|
||||
|
||||
message CreateForumCommentResponse {
|
||||
ForumCommentNode comment = 1;
|
||||
}
|
||||
|
||||
message DeleteForumCommentRequest {
|
||||
uint64 actor_user_id = 1;
|
||||
uint64 comment_id = 2;
|
||||
}
|
||||
|
||||
message DeleteForumCommentResponse {
|
||||
uint64 comment_id = 1;
|
||||
string status = 2;
|
||||
}
|
||||
|
||||
message ImportForumPostRequest {
|
||||
uint64 actor_user_id = 1;
|
||||
uint64 post_id = 2;
|
||||
string target_title = 3;
|
||||
string idempotency_key = 4;
|
||||
}
|
||||
|
||||
message ImportForumPostResponse {
|
||||
uint64 import_id = 1;
|
||||
uint64 post_id = 2;
|
||||
uint64 new_task_class_id = 3;
|
||||
string task_class_title = 4;
|
||||
int64 import_count = 5;
|
||||
string created_at = 6;
|
||||
}
|
||||
Reference in New Issue
Block a user