wip
This commit is contained in:
parent
534a80f0d6
commit
be36bdc42b
@ -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 {
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user