adding inputs output struct based on argo naming for now

This commit is contained in:
mr 2025-01-27 09:05:47 +01:00
parent 1521b8fac5
commit fbb55e64dc
2 changed files with 6 additions and 7 deletions

View File

@ -67,10 +67,7 @@ func (a *collaborativeAreaMongoAccessor) StoreOne(data utils.DBObject) (utils.DB
_, id := (&peer.Peer{}).IsMySelf() // get the local peer
data.(*CollaborativeArea).Clear(id) // set the creator
// retrieve or proper peer
dd, code, err := a.peerAccessor.Search(&dbs.Filters{
Or: map[string][]dbs.Filter{
"state": {{Operator: dbs.EQUAL.String(), Value: peer.SELF.EnumIndex()}},
}}, "", false)
dd, code, err := a.peerAccessor.Search(nil, fmt.Sprintf("%v", peer.SELF.EnumIndex()), false)
fmt.Println(dd, code, err)
if code != 200 || dd == nil || len(dd) == 0 {
return nil, code, errors.New("could not retrieve the peer")

View File

@ -1,6 +1,7 @@
package peer
import (
"fmt"
"strconv"
"cloud.o-forge.io/core/oc-lib/dbs"
@ -79,14 +80,15 @@ func (wfa *peerMongoAccessor) Search(filters *dbs.Filters, search string, isDraf
}, isDraft, wfa)
}
func (a *peerMongoAccessor) getDefaultFilter(search string) *dbs.Filters {
s, err := strconv.Atoi(search)
if err == nil {
if i, err := strconv.Atoi(search); err == nil {
fmt.Println("is state search", search)
return &dbs.Filters{
Or: map[string][]dbs.Filter{ // search by name if no filters are provided
"state": {{Operator: dbs.EQUAL.String(), Value: s}},
"state": {{Operator: dbs.EQUAL.String(), Value: i}},
},
}
} else {
fmt.Println("search", search)
if search == "*" {
search = ""
}