adding inputs output struct based on argo naming for now
This commit is contained in:
parent
1521b8fac5
commit
fbb55e64dc
@ -67,10 +67,7 @@ func (a *collaborativeAreaMongoAccessor) StoreOne(data utils.DBObject) (utils.DB
|
|||||||
_, id := (&peer.Peer{}).IsMySelf() // get the local peer
|
_, id := (&peer.Peer{}).IsMySelf() // get the local peer
|
||||||
data.(*CollaborativeArea).Clear(id) // set the creator
|
data.(*CollaborativeArea).Clear(id) // set the creator
|
||||||
// retrieve or proper peer
|
// retrieve or proper peer
|
||||||
dd, code, err := a.peerAccessor.Search(&dbs.Filters{
|
dd, code, err := a.peerAccessor.Search(nil, fmt.Sprintf("%v", peer.SELF.EnumIndex()), false)
|
||||||
Or: map[string][]dbs.Filter{
|
|
||||||
"state": {{Operator: dbs.EQUAL.String(), Value: peer.SELF.EnumIndex()}},
|
|
||||||
}}, "", false)
|
|
||||||
fmt.Println(dd, code, err)
|
fmt.Println(dd, code, err)
|
||||||
if code != 200 || dd == nil || len(dd) == 0 {
|
if code != 200 || dd == nil || len(dd) == 0 {
|
||||||
return nil, code, errors.New("could not retrieve the peer")
|
return nil, code, errors.New("could not retrieve the peer")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package peer
|
package peer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"cloud.o-forge.io/core/oc-lib/dbs"
|
"cloud.o-forge.io/core/oc-lib/dbs"
|
||||||
@ -79,14 +80,15 @@ func (wfa *peerMongoAccessor) Search(filters *dbs.Filters, search string, isDraf
|
|||||||
}, isDraft, wfa)
|
}, isDraft, wfa)
|
||||||
}
|
}
|
||||||
func (a *peerMongoAccessor) getDefaultFilter(search string) *dbs.Filters {
|
func (a *peerMongoAccessor) getDefaultFilter(search string) *dbs.Filters {
|
||||||
s, err := strconv.Atoi(search)
|
if i, err := strconv.Atoi(search); err == nil {
|
||||||
if err == nil {
|
fmt.Println("is state search", search)
|
||||||
return &dbs.Filters{
|
return &dbs.Filters{
|
||||||
Or: map[string][]dbs.Filter{ // search by name if no filters are provided
|
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 {
|
} else {
|
||||||
|
fmt.Println("search", search)
|
||||||
if search == "*" {
|
if search == "*" {
|
||||||
search = ""
|
search = ""
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user