72 lines
2.2 KiB
Go
72 lines
2.2 KiB
Go
|
// Code generated by goctl. DO NOT EDIT.
|
||
|
// Source: feed.proto
|
||
|
|
||
|
package server
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"app-cloudep-feed-service/gen_result/pb/feed"
|
||
|
"app-cloudep-feed-service/internal/logic/postservice"
|
||
|
"app-cloudep-feed-service/internal/svc"
|
||
|
)
|
||
|
|
||
|
type PostServiceServer struct {
|
||
|
svcCtx *svc.ServiceContext
|
||
|
feed.UnimplementedPostServiceServer
|
||
|
}
|
||
|
|
||
|
func NewPostServiceServer(svcCtx *svc.ServiceContext) *PostServiceServer {
|
||
|
return &PostServiceServer{
|
||
|
svcCtx: svcCtx,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// NewPost 新增貼文
|
||
|
func (s *PostServiceServer) NewPost(ctx context.Context, in *feed.NewPostReq) (*feed.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) {
|
||
|
l := postservicelogic.NewDeletePostLogic(ctx, s.svcCtx)
|
||
|
return l.DeletePost(in)
|
||
|
}
|
||
|
|
||
|
// UpdatePost 更新貼文
|
||
|
func (s *PostServiceServer) UpdatePost(ctx context.Context, in *feed.UpdatePostReq) (*feed.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) {
|
||
|
l := postservicelogic.NewListPostsLogic(ctx, s.svcCtx)
|
||
|
return l.ListPosts(in)
|
||
|
}
|
||
|
|
||
|
// Like 點讚/取消讚 貼文
|
||
|
func (s *PostServiceServer) Like(ctx context.Context, in *feed.LikeReq) (*feed.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) {
|
||
|
l := postservicelogic.NewGetLikeStatusLogic(ctx, s.svcCtx)
|
||
|
return l.GetLikeStatus(in)
|
||
|
}
|
||
|
|
||
|
// LikeList 取得讚/不讚列表
|
||
|
func (s *PostServiceServer) LikeList(ctx context.Context, in *feed.LikeListReq) (*feed.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) {
|
||
|
l := postservicelogic.NewCountLikeLogic(ctx, s.svcCtx)
|
||
|
return l.CountLike(in)
|
||
|
}
|