wip
This commit is contained in:
parent
534a80f0d6
commit
be36bdc42b
@ -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 {
|
||||||
|
@ -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 {
|
||||||
Sender string
|
Message string
|
||||||
BundleData *types.BundleData
|
|
||||||
TimeStamp string
|
TimeStamp string
|
||||||
}
|
}
|
||||||
|
|
||||||
type PostBundleReq struct {
|
type PostBundleReq struct {
|
||||||
Message string
|
Sender string
|
||||||
|
BundleData *types.BundleData
|
||||||
TimeStamp string
|
TimeStamp string
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user