diff --git a/injector/service/service.go b/injector/service/service.go index 221e5ae..8f0cba2 100644 --- a/injector/service/service.go +++ b/injector/service/service.go @@ -2,6 +2,7 @@ package service import ( "context" + "time" "git.espin.casa/albert/cml04-falcon-system/injector/types" "git.espin.casa/albert/cml04-falcon-system/internal/publisher" @@ -17,7 +18,14 @@ type service struct { // Bundle implements IService. func (s *service) Bundle(ctx context.Context, req *types.PostBundleReq) (res *types.PostBundleRes, err error) { - return &types.PostBundleRes{}, nil + // publish bundle data + if err := s.pub.NewBundle(ctx, req.BundleData); err != nil { + return nil, err + } + return &types.PostBundleRes{ + Message: "bundle data posted success", + TimeStamp: time.Now().UTC().Format(time.RFC3339), + }, nil } func New(pub publisher.Publisher) IService { diff --git a/injector/types/api.go b/injector/types/api.go index 0d1d905..4f82d53 100644 --- a/injector/types/api.go +++ b/injector/types/api.go @@ -3,12 +3,12 @@ package types import "git.espin.casa/albert/cml04-falcon-system/internal/types" type PostBundleRes struct { + Message string + TimeStamp string +} + +type PostBundleReq struct { Sender string BundleData *types.BundleData TimeStamp string } - -type PostBundleReq struct { - Message string - TimeStamp string -}