Discovery Nats automate

This commit is contained in:
mr
2024-08-22 13:11:21 +02:00
parent ce34345914
commit 0bfe87793b
8 changed files with 227 additions and 13 deletions

View File

@@ -6,31 +6,31 @@ import (
"cloud.o-forge.io/core/oc-lib/models/utils"
)
type bookingExecutionMongoAccessor struct {
type bookingMongoAccessor struct {
utils.AbstractAccessor
}
func New() *bookingExecutionMongoAccessor {
return &bookingExecutionMongoAccessor{}
func New() *bookingMongoAccessor {
return &bookingMongoAccessor{}
}
func (wfa *bookingExecutionMongoAccessor) DeleteOne(id string) (utils.DBObject, int, error) {
func (wfa *bookingMongoAccessor) DeleteOne(id string) (utils.DBObject, int, error) {
return wfa.GenericDeleteOne(id, wfa)
}
func (wfa *bookingExecutionMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) {
func (wfa *bookingMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) {
return wfa.GenericUpdateOne(set, id, wfa, &Booking{})
}
func (wfa *bookingExecutionMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
func (wfa *bookingMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
return wfa.GenericStoreOne(data, wfa)
}
func (wfa *bookingExecutionMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) {
func (wfa *bookingMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) {
return wfa.GenericStoreOne(data, wfa)
}
func (wfa *bookingExecutionMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
func (wfa *bookingMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
var workflow Booking
res_mongo, code, err := mongo.MONGOService.LoadOne(id, wfa.GetType())
if err != nil {
@@ -41,7 +41,7 @@ func (wfa *bookingExecutionMongoAccessor) LoadOne(id string) (utils.DBObject, in
return &workflow, 200, nil
}
func (wfa bookingExecutionMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error) {
func (wfa bookingMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error) {
objs := []utils.ShallowDBObject{}
res_mongo, code, err := mongo.MONGOService.LoadAll(wfa.GetType())
if err != nil {
@@ -58,7 +58,7 @@ func (wfa bookingExecutionMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int
return objs, 200, nil
}
func (wfa *bookingExecutionMongoAccessor) Search(filters *dbs.Filters, search string) ([]utils.ShallowDBObject, int, error) {
func (wfa *bookingMongoAccessor) Search(filters *dbs.Filters, search string) ([]utils.ShallowDBObject, int, error) {
objs := []utils.ShallowDBObject{}
if (filters == nil || len(filters.And) == 0 || len(filters.Or) == 0) && search != "" {
filters = &dbs.Filters{