app-cloudep-tweeting-service/internal/server/postservice/post_service_server.go

72 lines
2.3 KiB
Go
Raw Normal View History

2024-08-28 09:09:01 +00:00
// Code generated by goctl. DO NOT EDIT.
2024-08-28 14:24:47 +00:00
// Source: tweeting.proto
2024-08-28 09:09:01 +00:00
package server
import (
"context"
2024-08-28 14:29:42 +00:00
"app-cloudep-tweeting-service/gen_result/pb/tweeting"
"app-cloudep-tweeting-service/internal/logic/postservice"
"app-cloudep-tweeting-service/internal/svc"
2024-08-28 09:09:01 +00:00
)
type PostServiceServer struct {
svcCtx *svc.ServiceContext
2024-08-28 14:24:47 +00:00
tweeting.UnimplementedPostServiceServer
2024-08-28 09:09:01 +00:00
}
func NewPostServiceServer(svcCtx *svc.ServiceContext) *PostServiceServer {
return &PostServiceServer{
svcCtx: svcCtx,
}
}
// NewPost 新增貼文
2024-08-28 14:24:47 +00:00
func (s *PostServiceServer) NewPost(ctx context.Context, in *tweeting.NewPostReq) (*tweeting.PostResp, error) {
2024-08-28 09:09:01 +00:00
l := postservicelogic.NewNewPostLogic(ctx, s.svcCtx)
return l.NewPost(in)
}
// DeletePost 刪除貼文
2024-08-28 14:24:47 +00:00
func (s *PostServiceServer) DeletePost(ctx context.Context, in *tweeting.DeletePostsReq) (*tweeting.OKResp, error) {
2024-08-28 09:09:01 +00:00
l := postservicelogic.NewDeletePostLogic(ctx, s.svcCtx)
return l.DeletePost(in)
}
// UpdatePost 更新貼文
2024-08-28 14:24:47 +00:00
func (s *PostServiceServer) UpdatePost(ctx context.Context, in *tweeting.UpdatePostReq) (*tweeting.OKResp, error) {
2024-08-28 09:09:01 +00:00
l := postservicelogic.NewUpdatePostLogic(ctx, s.svcCtx)
return l.UpdatePost(in)
}
// ListPosts 查詢貼文
2024-08-28 14:24:47 +00:00
func (s *PostServiceServer) ListPosts(ctx context.Context, in *tweeting.QueryPostsReq) (*tweeting.ListPostsResp, error) {
2024-08-28 09:09:01 +00:00
l := postservicelogic.NewListPostsLogic(ctx, s.svcCtx)
return l.ListPosts(in)
}
// Like 點讚/取消讚 貼文
2024-08-28 14:24:47 +00:00
func (s *PostServiceServer) Like(ctx context.Context, in *tweeting.LikeReq) (*tweeting.OKResp, error) {
2024-08-28 09:09:01 +00:00
l := postservicelogic.NewLikeLogic(ctx, s.svcCtx)
return l.Like(in)
}
// GetLikeStatus 取得讚/不讚狀態
2024-08-28 14:24:47 +00:00
func (s *PostServiceServer) GetLikeStatus(ctx context.Context, in *tweeting.LikeReq) (*tweeting.OKResp, error) {
2024-08-28 09:09:01 +00:00
l := postservicelogic.NewGetLikeStatusLogic(ctx, s.svcCtx)
return l.GetLikeStatus(in)
}
// LikeList 取得讚/不讚列表
2024-08-28 14:24:47 +00:00
func (s *PostServiceServer) LikeList(ctx context.Context, in *tweeting.LikeListReq) (*tweeting.LikeListResp, error) {
2024-08-28 09:09:01 +00:00
l := postservicelogic.NewLikeListLogic(ctx, s.svcCtx)
return l.LikeList(in)
}
// CountLike 取得讚/不讚數量
2024-08-28 14:24:47 +00:00
func (s *PostServiceServer) CountLike(ctx context.Context, in *tweeting.LikeCountReq) (*tweeting.LikeCountResp, error) {
2024-08-28 09:09:01 +00:00
l := postservicelogic.NewCountLikeLogic(ctx, s.svcCtx)
return l.CountLike(in)
}