add images
continuous-integration/drone/push Build is failing

This commit is contained in:
2024-05-28 03:11:47 +07:00
parent 820306f654
commit 3822d4b23e
9 changed files with 615 additions and 185 deletions
+14
View File
@@ -7,6 +7,9 @@ import (
"cake_crm/internal/services/order"
proto "cake_crm/proto"
"context"
"fmt"
"google.golang.org/genproto/googleapis/api/httpbody"
"os"
)
type Server struct {
@@ -82,3 +85,14 @@ func (s *Server) GetCard(ctx context.Context, req *proto.CardReq) (*proto.CardRs
}
return &proto.CardRsp{Items: enrichItems}, nil
}
func (s *Server) GetImage(_ context.Context, req *proto.GetImageReq) (*httpbody.HttpBody, error) {
data, err := os.ReadFile(fmt.Sprintf("resources/images/%s", req.Name))
if err != nil {
return nil, err
}
return &httpbody.HttpBody{
ContentType: "image/jpeg",
Data: data,
}, nil
}