feat:#36 updated feed service with more protobuf endpoints

This commit is contained in:
Elmar Kresse
2024-06-18 23:46:23 +02:00
parent 4792b07e8c
commit acc048a80a
10 changed files with 197 additions and 69 deletions

View File

@@ -0,0 +1,33 @@
package grpc
import (
"context"
"github.com/pocketbase/pocketbase"
pb "htwkalender/common/genproto/modules"
"htwkalender/data-manager/service/db"
)
type FeedServiceHandler struct {
app *pocketbase.PocketBase
pb.UnimplementedFeedServiceServer
}
func (s *FeedServiceHandler) GetFeed(ctx context.Context, in *pb.GetFeedRequest) (*pb.GetFeedResponse, error) {
s.app.Logger().Info(
"Protobuf - GetFeed",
"uuid", in.Id,
)
// get feed from database by UUID
feed, err := db.FindFeedByToken(s.app, in.Id)
if err != nil {
return nil, err
}
// Implement your logic here to fetch feed data based on the UUID
// Example response
return &pb.GetFeedResponse{
Feed: feedToProto(feed),
}, nil
}