@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user