add purchase info
This commit is contained in:
@@ -22,7 +22,7 @@ import (
|
||||
// AbstractResource is the struct containing all of the attributes commons to all ressources
|
||||
type AbstractResource struct {
|
||||
utils.AbstractObject // AbstractObject contains the basic fields of an object (id, name)
|
||||
IsBuy bool `json:"is_buy"` // is_buy precise if a resource is buy or not
|
||||
PurchaseInfo *purchase_resource.PurchaseResource `json:"purchase_info,omitempty"` // is_buy precise if a resource is buy or not
|
||||
Type string `json:"type,omitempty" bson:"type,omitempty"` // Type is the type of the resource
|
||||
Logo string `json:"logo,omitempty" bson:"logo,omitempty"` // Logo is the logo of the resource
|
||||
Description string `json:"description,omitempty" bson:"description,omitempty"` // Description is the description of the resource
|
||||
@@ -40,12 +40,14 @@ func (abs *AbstractResource) VerifyBuy() {
|
||||
p := &purchase_resource.PurchaseResource{}
|
||||
access := p.GetAccessor(&tools.APIRequest{Admin: true})
|
||||
|
||||
access.Search(&dbs.Filters{
|
||||
purchase, _, _ := access.Search(&dbs.Filters{
|
||||
And: map[string][]dbs.Filter{
|
||||
"resource_id": {{Operator: dbs.EQUAL.String(), Value: abs.GetID()}},
|
||||
},
|
||||
}, "", false, 0, 1)
|
||||
|
||||
if len(purchase) > 0 {
|
||||
abs.PurchaseInfo = purchase[0].(*purchase_resource.PurchaseResource)
|
||||
}
|
||||
}
|
||||
|
||||
func (abs *AbstractResource) GetEnv() []models.Param {
|
||||
|
||||
Reference in New Issue
Block a user