This commit is contained in:
aespin 2024-10-04 09:45:09 +02:00
parent 534a80f0d6
commit be36bdc42b
2 changed files with 14 additions and 6 deletions

View File

@ -2,6 +2,7 @@ package service
import ( import (
"context" "context"
"time"
"git.espin.casa/albert/cml04-falcon-system/injector/types" "git.espin.casa/albert/cml04-falcon-system/injector/types"
"git.espin.casa/albert/cml04-falcon-system/internal/publisher" "git.espin.casa/albert/cml04-falcon-system/internal/publisher"
@ -17,7 +18,14 @@ type service struct {
// Bundle implements IService. // Bundle implements IService.
func (s *service) Bundle(ctx context.Context, req *types.PostBundleReq) (res *types.PostBundleRes, err error) { 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 { func New(pub publisher.Publisher) IService {

View File

@ -3,12 +3,12 @@ package types
import "git.espin.casa/albert/cml04-falcon-system/internal/types" import "git.espin.casa/albert/cml04-falcon-system/internal/types"
type PostBundleRes struct { type PostBundleRes struct {
Message string
TimeStamp string
}
type PostBundleReq struct {
Sender string Sender string
BundleData *types.BundleData BundleData *types.BundleData
TimeStamp string TimeStamp string
} }
type PostBundleReq struct {
Message string
TimeStamp string
}