optionnal vars failed
This commit is contained in:
parent
1ff4cb08d1
commit
2795c924f7
@ -16,6 +16,7 @@ type AbstractResource struct {
|
||||
OwnerLogo string `json:"owner_logo,omitempty" bson:"owner_logo,omitempty"`
|
||||
SourceUrl string `json:"source_url,omitempty" bson:"source_url,omitempty" validate:"required"`
|
||||
Price string `json:"price,omitempty" bson:"price,omitempty"`
|
||||
Currency string `json:"price,omitempty" bson:"price,omitempty"`
|
||||
License string `json:"license,omitempty" bson:"license,omitempty"`
|
||||
ResourceModel *ResourceModel `json:"resource_model,omitempty" bson:"resource_model,omitempty"`
|
||||
//Proxy *ResourceProxy `json:"proxy,omitempty" bson:"proxy,omitempty"`
|
||||
|
@ -45,7 +45,7 @@ func (dma *AbstractAccessor) SetLogger(t DataType) {
|
||||
|
||||
func (wfa *AbstractAccessor) GenericStoreOne(data DBObject, accessor Accessor) (DBObject, int, error) {
|
||||
data.GenerateID()
|
||||
if cursor, _, _ := accessor.Search(data.GetName(), []string{"abstractresource.abstractobject.name", "abstractobject.name"}...); len(cursor) > 0 {
|
||||
if cursor, _, _ := accessor.Search(data.GetName(), "abstractresource.abstractobject.name", "abstractobject.name"); len(cursor) > 0 {
|
||||
return nil, 409, errors.New(accessor.GetType() + " with name " + data.GetName() + " already exists")
|
||||
}
|
||||
err := validate.Struct(data)
|
||||
|
8
models/utils/common.go
Normal file
8
models/utils/common.go
Normal file
@ -0,0 +1,8 @@
|
||||
package utils
|
||||
|
||||
/*
|
||||
type Price struct {
|
||||
Price float64 `json:"price,omitempty" bson:"price,omitempty"`
|
||||
Currency string `json:"currency,omitempty" bson:"currency,omitempty"`
|
||||
}
|
||||
*/
|
Loading…
Reference in New Issue
Block a user