diff --git a/Makefile b/Makefile index 83e8b5c..5a391e5 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ fmt: # 格式優化 .PHONY: gen-rpc gen-rpc: # 建立 rpc code - $(GO_CTL_NAME) rpc protoc ./generate/protobuf/feed.proto -m --style=$(GO_ZERO_STYLE) --go_out=./gen_result/pb --go-grpc_out=./gen_result/pb --zrpc_out=. + $(GO_CTL_NAME) rpc protoc ./generate/protobuf/tweeting.proto -m --style=$(GO_ZERO_STYLE) --go_out=./gen_result/pb --go-grpc_out=./gen_result/pb --zrpc_out=. go mod tidy @echo "Generate core-api files successfully" @@ -49,5 +49,9 @@ build-docker: gen-mongo-model: # 建立 rpc 資料庫 # 只產生 Model 剩下的要自己撰寫,連欄位名稱也是 - goctl model mongo -t AutoId --dir ./internal/model/mongo --style $(GO_ZERO_STYLE) + goctl model mongo -c no -t post --dir ./internal/model/mongo --style $(GO_ZERO_STYLE) + goctl model mongo -c no -t comment --dir ./internal/model/mongo --style $(GO_ZERO_STYLE) + goctl model mongo -t tags --dir ./internal/model/mongo --style $(GO_ZERO_STYLE) + goctl model mongo -t post_likes --dir ./internal/model/mongo --style $(GO_ZERO_STYLE) + goctl model mongo -t comment_likes --dir ./internal/model/mongo --style $(GO_ZERO_STYLE) @echo "Generate mongo model files successfully" \ No newline at end of file diff --git a/etc/tweeting.yaml b/etc/tweeting.yaml new file mode 100644 index 0000000..c611c48 --- /dev/null +++ b/etc/tweeting.yaml @@ -0,0 +1,6 @@ +Name: tweeting.rpc +ListenOn: 0.0.0.0:8080 +Etcd: + Hosts: + - 127.0.0.1:2379 + Key: tweeting.rpc diff --git a/generate/protobuf/feed.proto b/generate/protobuf/tweeting.proto similarity index 99% rename from generate/protobuf/feed.proto rename to generate/protobuf/tweeting.proto index 6e6ee1f..be6b914 100644 --- a/generate/protobuf/feed.proto +++ b/generate/protobuf/tweeting.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package feed; -option go_package="./feed"; +package tweeting; +option go_package="./tweeting"; // 基本回應 message OKResp {} diff --git a/go.mod b/go.mod index 4a50b6c..236e9bb 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22.3 require ( github.com/zeromicro/go-zero v1.7.0 - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 ) @@ -66,7 +66,7 @@ require ( go.uber.org/multierr v1.9.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/oauth2 v0.20.0 // indirect + golang.org/x/oauth2 v0.21.0 // indirect golang.org/x/sys v0.22.0 // indirect golang.org/x/term v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect diff --git a/internal/logic/commentservice/count_like_logic.go b/internal/logic/commentservice/count_like_logic.go index 2582b32..9df9c01 100644 --- a/internal/logic/commentservice/count_like_logic.go +++ b/internal/logic/commentservice/count_like_logic.go @@ -3,7 +3,7 @@ package commentservicelogic import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/svc" "github.com/zeromicro/go-zero/core/logx" @@ -24,8 +24,8 @@ func NewCountLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CountLi } // CountLike 取得讚/不讚評論數量 -func (l *CountLikeLogic) CountLike(in *feed.LikeCountReq) (*feed.LikeCountResp, error) { +func (l *CountLikeLogic) CountLike(in *tweeting.LikeCountReq) (*tweeting.LikeCountResp, error) { // todo: add your logic here and delete this line - return &feed.LikeCountResp{}, nil + return &tweeting.LikeCountResp{}, nil } diff --git a/internal/logic/commentservice/delete_comment_logic.go b/internal/logic/commentservice/delete_comment_logic.go index dad3261..77143ba 100644 --- a/internal/logic/commentservice/delete_comment_logic.go +++ b/internal/logic/commentservice/delete_comment_logic.go @@ -3,7 +3,7 @@ package commentservicelogic import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/svc" "github.com/zeromicro/go-zero/core/logx" @@ -24,8 +24,8 @@ func NewDeleteCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Del } // DeleteComment 刪除評論 -func (l *DeleteCommentLogic) DeleteComment(in *feed.DeleteCommentReq) (*feed.OKResp, error) { +func (l *DeleteCommentLogic) DeleteComment(in *tweeting.DeleteCommentReq) (*tweeting.OKResp, error) { // todo: add your logic here and delete this line - return &feed.OKResp{}, nil + return &tweeting.OKResp{}, nil } diff --git a/internal/logic/commentservice/get_comments_logic.go b/internal/logic/commentservice/get_comments_logic.go index b34254b..7a1e2e4 100644 --- a/internal/logic/commentservice/get_comments_logic.go +++ b/internal/logic/commentservice/get_comments_logic.go @@ -3,7 +3,7 @@ package commentservicelogic import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/svc" "github.com/zeromicro/go-zero/core/logx" @@ -24,8 +24,8 @@ func NewGetCommentsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetCo } // GetComments 查詢評論 -func (l *GetCommentsLogic) GetComments(in *feed.GetCommentsReq) (*feed.GetCommentsResp, error) { +func (l *GetCommentsLogic) GetComments(in *tweeting.GetCommentsReq) (*tweeting.GetCommentsResp, error) { // todo: add your logic here and delete this line - return &feed.GetCommentsResp{}, nil + return &tweeting.GetCommentsResp{}, nil } diff --git a/internal/logic/commentservice/get_like_status_logic.go b/internal/logic/commentservice/get_like_status_logic.go index ce2ee0f..9e6bcfd 100644 --- a/internal/logic/commentservice/get_like_status_logic.go +++ b/internal/logic/commentservice/get_like_status_logic.go @@ -3,7 +3,7 @@ package commentservicelogic import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/svc" "github.com/zeromicro/go-zero/core/logx" @@ -24,8 +24,8 @@ func NewGetLikeStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Get } // GetLikeStatus 取得讚/不讚評論狀態 -func (l *GetLikeStatusLogic) GetLikeStatus(in *feed.LikeReq) (*feed.OKResp, error) { +func (l *GetLikeStatusLogic) GetLikeStatus(in *tweeting.LikeReq) (*tweeting.OKResp, error) { // todo: add your logic here and delete this line - return &feed.OKResp{}, nil + return &tweeting.OKResp{}, nil } diff --git a/internal/logic/commentservice/like_comment_logic.go b/internal/logic/commentservice/like_comment_logic.go index 58b6570..a3ba0de 100644 --- a/internal/logic/commentservice/like_comment_logic.go +++ b/internal/logic/commentservice/like_comment_logic.go @@ -3,7 +3,7 @@ package commentservicelogic import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/svc" "github.com/zeromicro/go-zero/core/logx" @@ -24,8 +24,8 @@ func NewLikeCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LikeC } // LikeComment 點讚/取消讚 評論 -func (l *LikeCommentLogic) LikeComment(in *feed.LikeReq) (*feed.OKResp, error) { +func (l *LikeCommentLogic) LikeComment(in *tweeting.LikeReq) (*tweeting.OKResp, error) { // todo: add your logic here and delete this line - return &feed.OKResp{}, nil + return &tweeting.OKResp{}, nil } diff --git a/internal/logic/commentservice/like_list_logic.go b/internal/logic/commentservice/like_list_logic.go index 3e126b5..20659e0 100644 --- a/internal/logic/commentservice/like_list_logic.go +++ b/internal/logic/commentservice/like_list_logic.go @@ -3,7 +3,7 @@ package commentservicelogic import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/svc" "github.com/zeromicro/go-zero/core/logx" @@ -24,8 +24,8 @@ func NewLikeListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LikeList } // LikeList 取得讚/不讚評論列表 -func (l *LikeListLogic) LikeList(in *feed.LikeListReq) (*feed.LikeListResp, error) { +func (l *LikeListLogic) LikeList(in *tweeting.LikeListReq) (*tweeting.LikeListResp, error) { // todo: add your logic here and delete this line - return &feed.LikeListResp{}, nil + return &tweeting.LikeListResp{}, nil } diff --git a/internal/logic/commentservice/new_comment_logic.go b/internal/logic/commentservice/new_comment_logic.go index a93688a..8e8e78b 100644 --- a/internal/logic/commentservice/new_comment_logic.go +++ b/internal/logic/commentservice/new_comment_logic.go @@ -3,7 +3,7 @@ package commentservicelogic import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/svc" "github.com/zeromicro/go-zero/core/logx" @@ -24,8 +24,8 @@ func NewNewCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *NewCom } // NewComment 發表評論 -func (l *NewCommentLogic) NewComment(in *feed.CommentPostReq) (*feed.OKResp, error) { +func (l *NewCommentLogic) NewComment(in *tweeting.CommentPostReq) (*tweeting.OKResp, error) { // todo: add your logic here and delete this line - return &feed.OKResp{}, nil + return &tweeting.OKResp{}, nil } diff --git a/internal/logic/commentservice/update_comment_logic.go b/internal/logic/commentservice/update_comment_logic.go index cd217b6..bc0807b 100644 --- a/internal/logic/commentservice/update_comment_logic.go +++ b/internal/logic/commentservice/update_comment_logic.go @@ -3,7 +3,7 @@ package commentservicelogic import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/svc" "github.com/zeromicro/go-zero/core/logx" @@ -24,8 +24,8 @@ func NewUpdateCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Upd } // UpdateComment 更新評論 -func (l *UpdateCommentLogic) UpdateComment(in *feed.UpdateCommentReq) (*feed.OKResp, error) { +func (l *UpdateCommentLogic) UpdateComment(in *tweeting.UpdateCommentReq) (*tweeting.OKResp, error) { // todo: add your logic here and delete this line - return &feed.OKResp{}, nil + return &tweeting.OKResp{}, nil } diff --git a/internal/logic/postservice/count_like_logic.go b/internal/logic/postservice/count_like_logic.go index 8399be7..7dbacc8 100644 --- a/internal/logic/postservice/count_like_logic.go +++ b/internal/logic/postservice/count_like_logic.go @@ -3,7 +3,7 @@ package postservicelogic import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/svc" "github.com/zeromicro/go-zero/core/logx" @@ -24,8 +24,8 @@ func NewCountLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CountLi } // CountLike 取得讚/不讚數量 -func (l *CountLikeLogic) CountLike(in *feed.LikeCountReq) (*feed.LikeCountResp, error) { +func (l *CountLikeLogic) CountLike(in *tweeting.LikeCountReq) (*tweeting.LikeCountResp, error) { // todo: add your logic here and delete this line - return &feed.LikeCountResp{}, nil + return &tweeting.LikeCountResp{}, nil } diff --git a/internal/logic/postservice/delete_post_logic.go b/internal/logic/postservice/delete_post_logic.go index 0a7841f..fbdaa9d 100644 --- a/internal/logic/postservice/delete_post_logic.go +++ b/internal/logic/postservice/delete_post_logic.go @@ -3,7 +3,7 @@ package postservicelogic import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/svc" "github.com/zeromicro/go-zero/core/logx" @@ -24,8 +24,8 @@ func NewDeletePostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Delete } // DeletePost 刪除貼文 -func (l *DeletePostLogic) DeletePost(in *feed.DeletePostsReq) (*feed.OKResp, error) { +func (l *DeletePostLogic) DeletePost(in *tweeting.DeletePostsReq) (*tweeting.OKResp, error) { // todo: add your logic here and delete this line - return &feed.OKResp{}, nil + return &tweeting.OKResp{}, nil } diff --git a/internal/logic/postservice/get_like_status_logic.go b/internal/logic/postservice/get_like_status_logic.go index eaf5f0c..1bdec6c 100644 --- a/internal/logic/postservice/get_like_status_logic.go +++ b/internal/logic/postservice/get_like_status_logic.go @@ -3,7 +3,7 @@ package postservicelogic import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/svc" "github.com/zeromicro/go-zero/core/logx" @@ -24,8 +24,8 @@ func NewGetLikeStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Get } // GetLikeStatus 取得讚/不讚狀態 -func (l *GetLikeStatusLogic) GetLikeStatus(in *feed.LikeReq) (*feed.OKResp, error) { +func (l *GetLikeStatusLogic) GetLikeStatus(in *tweeting.LikeReq) (*tweeting.OKResp, error) { // todo: add your logic here and delete this line - return &feed.OKResp{}, nil + return &tweeting.OKResp{}, nil } diff --git a/internal/logic/postservice/like_list_logic.go b/internal/logic/postservice/like_list_logic.go index 9131c90..19eb5aa 100644 --- a/internal/logic/postservice/like_list_logic.go +++ b/internal/logic/postservice/like_list_logic.go @@ -3,7 +3,7 @@ package postservicelogic import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/svc" "github.com/zeromicro/go-zero/core/logx" @@ -24,8 +24,8 @@ func NewLikeListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LikeList } // LikeList 取得讚/不讚列表 -func (l *LikeListLogic) LikeList(in *feed.LikeListReq) (*feed.LikeListResp, error) { +func (l *LikeListLogic) LikeList(in *tweeting.LikeListReq) (*tweeting.LikeListResp, error) { // todo: add your logic here and delete this line - return &feed.LikeListResp{}, nil + return &tweeting.LikeListResp{}, nil } diff --git a/internal/logic/postservice/like_logic.go b/internal/logic/postservice/like_logic.go index 5116713..d00a928 100644 --- a/internal/logic/postservice/like_logic.go +++ b/internal/logic/postservice/like_logic.go @@ -3,7 +3,7 @@ package postservicelogic import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/svc" "github.com/zeromicro/go-zero/core/logx" @@ -24,8 +24,8 @@ func NewLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LikeLogic { } // Like 點讚/取消讚 貼文 -func (l *LikeLogic) Like(in *feed.LikeReq) (*feed.OKResp, error) { +func (l *LikeLogic) Like(in *tweeting.LikeReq) (*tweeting.OKResp, error) { // todo: add your logic here and delete this line - return &feed.OKResp{}, nil + return &tweeting.OKResp{}, nil } diff --git a/internal/logic/postservice/list_posts_logic.go b/internal/logic/postservice/list_posts_logic.go index 4c41f3b..5c15897 100644 --- a/internal/logic/postservice/list_posts_logic.go +++ b/internal/logic/postservice/list_posts_logic.go @@ -3,7 +3,7 @@ package postservicelogic import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/svc" "github.com/zeromicro/go-zero/core/logx" @@ -24,8 +24,8 @@ func NewListPostsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListPos } // ListPosts 查詢貼文 -func (l *ListPostsLogic) ListPosts(in *feed.QueryPostsReq) (*feed.ListPostsResp, error) { +func (l *ListPostsLogic) ListPosts(in *tweeting.QueryPostsReq) (*tweeting.ListPostsResp, error) { // todo: add your logic here and delete this line - return &feed.ListPostsResp{}, nil + return &tweeting.ListPostsResp{}, nil } diff --git a/internal/logic/postservice/new_post_logic.go b/internal/logic/postservice/new_post_logic.go index 75cdd24..b009feb 100644 --- a/internal/logic/postservice/new_post_logic.go +++ b/internal/logic/postservice/new_post_logic.go @@ -3,7 +3,7 @@ package postservicelogic import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/svc" "github.com/zeromicro/go-zero/core/logx" @@ -24,8 +24,8 @@ func NewNewPostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *NewPostLo } // NewPost 新增貼文 -func (l *NewPostLogic) NewPost(in *feed.NewPostReq) (*feed.PostResp, error) { +func (l *NewPostLogic) NewPost(in *tweeting.NewPostReq) (*tweeting.PostResp, error) { // todo: add your logic here and delete this line - return &feed.PostResp{}, nil + return &tweeting.PostResp{}, nil } diff --git a/internal/logic/postservice/update_post_logic.go b/internal/logic/postservice/update_post_logic.go index 7c8cf19..cc39640 100644 --- a/internal/logic/postservice/update_post_logic.go +++ b/internal/logic/postservice/update_post_logic.go @@ -3,7 +3,7 @@ package postservicelogic import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/svc" "github.com/zeromicro/go-zero/core/logx" @@ -24,8 +24,8 @@ func NewUpdatePostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Update } // UpdatePost 更新貼文 -func (l *UpdatePostLogic) UpdatePost(in *feed.UpdatePostReq) (*feed.OKResp, error) { +func (l *UpdatePostLogic) UpdatePost(in *tweeting.UpdatePostReq) (*tweeting.OKResp, error) { // todo: add your logic here and delete this line - return &feed.OKResp{}, nil + return &tweeting.OKResp{}, nil } diff --git a/internal/server/commentservice/comment_service_server.go b/internal/server/commentservice/comment_service_server.go index e79059d..7fb5962 100644 --- a/internal/server/commentservice/comment_service_server.go +++ b/internal/server/commentservice/comment_service_server.go @@ -1,19 +1,19 @@ // Code generated by goctl. DO NOT EDIT. -// Source: feed.proto +// Source: tweeting.proto package server import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/logic/commentservice" "app-cloudep-feed-service/internal/svc" ) type CommentServiceServer struct { svcCtx *svc.ServiceContext - feed.UnimplementedCommentServiceServer + tweeting.UnimplementedCommentServiceServer } func NewCommentServiceServer(svcCtx *svc.ServiceContext) *CommentServiceServer { @@ -23,49 +23,49 @@ func NewCommentServiceServer(svcCtx *svc.ServiceContext) *CommentServiceServer { } // NewComment 發表評論 -func (s *CommentServiceServer) NewComment(ctx context.Context, in *feed.CommentPostReq) (*feed.OKResp, error) { +func (s *CommentServiceServer) NewComment(ctx context.Context, in *tweeting.CommentPostReq) (*tweeting.OKResp, error) { l := commentservicelogic.NewNewCommentLogic(ctx, s.svcCtx) return l.NewComment(in) } // GetComments 查詢評論 -func (s *CommentServiceServer) GetComments(ctx context.Context, in *feed.GetCommentsReq) (*feed.GetCommentsResp, error) { +func (s *CommentServiceServer) GetComments(ctx context.Context, in *tweeting.GetCommentsReq) (*tweeting.GetCommentsResp, error) { l := commentservicelogic.NewGetCommentsLogic(ctx, s.svcCtx) return l.GetComments(in) } // DeleteComment 刪除評論 -func (s *CommentServiceServer) DeleteComment(ctx context.Context, in *feed.DeleteCommentReq) (*feed.OKResp, error) { +func (s *CommentServiceServer) DeleteComment(ctx context.Context, in *tweeting.DeleteCommentReq) (*tweeting.OKResp, error) { l := commentservicelogic.NewDeleteCommentLogic(ctx, s.svcCtx) return l.DeleteComment(in) } // UpdateComment 更新評論 -func (s *CommentServiceServer) UpdateComment(ctx context.Context, in *feed.UpdateCommentReq) (*feed.OKResp, error) { +func (s *CommentServiceServer) UpdateComment(ctx context.Context, in *tweeting.UpdateCommentReq) (*tweeting.OKResp, error) { l := commentservicelogic.NewUpdateCommentLogic(ctx, s.svcCtx) return l.UpdateComment(in) } // LikeComment 點讚/取消讚 評論 -func (s *CommentServiceServer) LikeComment(ctx context.Context, in *feed.LikeReq) (*feed.OKResp, error) { +func (s *CommentServiceServer) LikeComment(ctx context.Context, in *tweeting.LikeReq) (*tweeting.OKResp, error) { l := commentservicelogic.NewLikeCommentLogic(ctx, s.svcCtx) return l.LikeComment(in) } // GetLikeStatus 取得讚/不讚評論狀態 -func (s *CommentServiceServer) GetLikeStatus(ctx context.Context, in *feed.LikeReq) (*feed.OKResp, error) { +func (s *CommentServiceServer) GetLikeStatus(ctx context.Context, in *tweeting.LikeReq) (*tweeting.OKResp, error) { l := commentservicelogic.NewGetLikeStatusLogic(ctx, s.svcCtx) return l.GetLikeStatus(in) } // LikeList 取得讚/不讚評論列表 -func (s *CommentServiceServer) LikeList(ctx context.Context, in *feed.LikeListReq) (*feed.LikeListResp, error) { +func (s *CommentServiceServer) LikeList(ctx context.Context, in *tweeting.LikeListReq) (*tweeting.LikeListResp, error) { l := commentservicelogic.NewLikeListLogic(ctx, s.svcCtx) return l.LikeList(in) } // CountLike 取得讚/不讚評論數量 -func (s *CommentServiceServer) CountLike(ctx context.Context, in *feed.LikeCountReq) (*feed.LikeCountResp, error) { +func (s *CommentServiceServer) CountLike(ctx context.Context, in *tweeting.LikeCountReq) (*tweeting.LikeCountResp, error) { l := commentservicelogic.NewCountLikeLogic(ctx, s.svcCtx) return l.CountLike(in) } diff --git a/internal/server/postservice/post_service_server.go b/internal/server/postservice/post_service_server.go index 8f44a16..9745c48 100644 --- a/internal/server/postservice/post_service_server.go +++ b/internal/server/postservice/post_service_server.go @@ -1,19 +1,19 @@ // Code generated by goctl. DO NOT EDIT. -// Source: feed.proto +// Source: tweeting.proto package server import ( "context" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/logic/postservice" "app-cloudep-feed-service/internal/svc" ) type PostServiceServer struct { svcCtx *svc.ServiceContext - feed.UnimplementedPostServiceServer + tweeting.UnimplementedPostServiceServer } func NewPostServiceServer(svcCtx *svc.ServiceContext) *PostServiceServer { @@ -23,49 +23,49 @@ func NewPostServiceServer(svcCtx *svc.ServiceContext) *PostServiceServer { } // NewPost 新增貼文 -func (s *PostServiceServer) NewPost(ctx context.Context, in *feed.NewPostReq) (*feed.PostResp, error) { +func (s *PostServiceServer) NewPost(ctx context.Context, in *tweeting.NewPostReq) (*tweeting.PostResp, error) { l := postservicelogic.NewNewPostLogic(ctx, s.svcCtx) return l.NewPost(in) } // DeletePost 刪除貼文 -func (s *PostServiceServer) DeletePost(ctx context.Context, in *feed.DeletePostsReq) (*feed.OKResp, error) { +func (s *PostServiceServer) DeletePost(ctx context.Context, in *tweeting.DeletePostsReq) (*tweeting.OKResp, error) { l := postservicelogic.NewDeletePostLogic(ctx, s.svcCtx) return l.DeletePost(in) } // UpdatePost 更新貼文 -func (s *PostServiceServer) UpdatePost(ctx context.Context, in *feed.UpdatePostReq) (*feed.OKResp, error) { +func (s *PostServiceServer) UpdatePost(ctx context.Context, in *tweeting.UpdatePostReq) (*tweeting.OKResp, error) { l := postservicelogic.NewUpdatePostLogic(ctx, s.svcCtx) return l.UpdatePost(in) } // ListPosts 查詢貼文 -func (s *PostServiceServer) ListPosts(ctx context.Context, in *feed.QueryPostsReq) (*feed.ListPostsResp, error) { +func (s *PostServiceServer) ListPosts(ctx context.Context, in *tweeting.QueryPostsReq) (*tweeting.ListPostsResp, error) { l := postservicelogic.NewListPostsLogic(ctx, s.svcCtx) return l.ListPosts(in) } // Like 點讚/取消讚 貼文 -func (s *PostServiceServer) Like(ctx context.Context, in *feed.LikeReq) (*feed.OKResp, error) { +func (s *PostServiceServer) Like(ctx context.Context, in *tweeting.LikeReq) (*tweeting.OKResp, error) { l := postservicelogic.NewLikeLogic(ctx, s.svcCtx) return l.Like(in) } // GetLikeStatus 取得讚/不讚狀態 -func (s *PostServiceServer) GetLikeStatus(ctx context.Context, in *feed.LikeReq) (*feed.OKResp, error) { +func (s *PostServiceServer) GetLikeStatus(ctx context.Context, in *tweeting.LikeReq) (*tweeting.OKResp, error) { l := postservicelogic.NewGetLikeStatusLogic(ctx, s.svcCtx) return l.GetLikeStatus(in) } // LikeList 取得讚/不讚列表 -func (s *PostServiceServer) LikeList(ctx context.Context, in *feed.LikeListReq) (*feed.LikeListResp, error) { +func (s *PostServiceServer) LikeList(ctx context.Context, in *tweeting.LikeListReq) (*tweeting.LikeListResp, error) { l := postservicelogic.NewLikeListLogic(ctx, s.svcCtx) return l.LikeList(in) } // CountLike 取得讚/不讚數量 -func (s *PostServiceServer) CountLike(ctx context.Context, in *feed.LikeCountReq) (*feed.LikeCountResp, error) { +func (s *PostServiceServer) CountLike(ctx context.Context, in *tweeting.LikeCountReq) (*tweeting.LikeCountResp, error) { l := postservicelogic.NewCountLikeLogic(ctx, s.svcCtx) return l.CountLike(in) } diff --git a/feed.go b/tweeting.go similarity index 72% rename from feed.go rename to tweeting.go index e20632c..b68a41d 100644 --- a/feed.go +++ b/tweeting.go @@ -4,7 +4,7 @@ import ( "flag" "fmt" - "app-cloudep-feed-service/gen_result/pb/feed" + "app-cloudep-feed-service/gen_result/pb/tweeting" "app-cloudep-feed-service/internal/config" commentserviceServer "app-cloudep-feed-service/internal/server/commentservice" postserviceServer "app-cloudep-feed-service/internal/server/postservice" @@ -17,7 +17,7 @@ import ( "google.golang.org/grpc/reflection" ) -var configFile = flag.String("f", "etc/feed.yaml", "the config file") +var configFile = flag.String("f", "etc/tweeting.yaml", "the config file") func main() { flag.Parse() @@ -27,8 +27,8 @@ func main() { ctx := svc.NewServiceContext(c) s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { - feed.RegisterPostServiceServer(grpcServer, postserviceServer.NewPostServiceServer(ctx)) - feed.RegisterCommentServiceServer(grpcServer, commentserviceServer.NewCommentServiceServer(ctx)) + tweeting.RegisterPostServiceServer(grpcServer, postserviceServer.NewPostServiceServer(ctx)) + tweeting.RegisterCommentServiceServer(grpcServer, commentserviceServer.NewCommentServiceServer(ctx)) if c.Mode == service.DevMode || c.Mode == service.TestMode { reflection.Register(grpcServer)