Add InstanceID
This commit is contained in:
@@ -26,7 +26,9 @@ type PricedResource struct {
|
|||||||
Variations []*pricing.PricingVariation `json:"pricing_variations" bson:"pricing_variations"`
|
Variations []*pricing.PricingVariation `json:"pricing_variations" bson:"pricing_variations"`
|
||||||
CreatorID string `json:"peer_id,omitempty" bson:"peer_id,omitempty"`
|
CreatorID string `json:"peer_id,omitempty" bson:"peer_id,omitempty"`
|
||||||
ResourceID string `json:"resource_id,omitempty" bson:"resource_id,omitempty"`
|
ResourceID string `json:"resource_id,omitempty" bson:"resource_id,omitempty"`
|
||||||
ResourceType tools.DataType `json:"resource_type,omitempty" bson:"resource_type,omitempty"`
|
InstanceID string `json:"instance_id,omitempty" bson:"resource_id,omitempty"`
|
||||||
|
|
||||||
|
ResourceType tools.DataType `json:"resource_type,omitempty" bson:"resource_type,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (abs *PricedResource) GetQuantity() int {
|
func (abs *PricedResource) GetQuantity() int {
|
||||||
|
|||||||
@@ -81,11 +81,16 @@ func (abs *AbstractInstanciatedResource[T]) ConvertToPricedResource(t tools.Data
|
|||||||
selectedBookingModeIndex *int, request *tools.APIRequest) (pricing.PricedItemITF, error) {
|
selectedBookingModeIndex *int, request *tools.APIRequest) (pricing.PricedItemITF, error) {
|
||||||
instances := map[string]string{}
|
instances := map[string]string{}
|
||||||
var profile pricing.PricingProfileITF
|
var profile pricing.PricingProfileITF
|
||||||
|
var inst ResourceInstanceITF
|
||||||
if t := abs.GetSelectedInstance(selectedInstance); t != nil {
|
if t := abs.GetSelectedInstance(selectedInstance); t != nil {
|
||||||
|
inst = t
|
||||||
instances[t.GetID()] = t.GetName()
|
instances[t.GetID()] = t.GetName()
|
||||||
profile = t.GetProfile(request.PeerID, selectedPartnership, selectedBuyingStrategy, selectedStrategy)
|
profile = t.GetProfile(request.PeerID, selectedPartnership, selectedBuyingStrategy, selectedStrategy)
|
||||||
} else {
|
} else {
|
||||||
for _, instance := range abs.Instances { // TODO why it crush before ?
|
for i, instance := range abs.Instances { // TODO why it crush before ?
|
||||||
|
if i == 0 {
|
||||||
|
inst = instance
|
||||||
|
}
|
||||||
instances[instance.GetID()] = instance.GetName()
|
instances[instance.GetID()] = instance.GetName()
|
||||||
profiles := instance.GetPricingsProfiles(request.PeerID, request.Groups)
|
profiles := instance.GetPricingsProfiles(request.PeerID, request.Groups)
|
||||||
if len(profiles) > 0 {
|
if len(profiles) > 0 {
|
||||||
@@ -111,6 +116,7 @@ func (abs *AbstractInstanciatedResource[T]) ConvertToPricedResource(t tools.Data
|
|||||||
Name: abs.Name,
|
Name: abs.Name,
|
||||||
Logo: abs.Logo,
|
Logo: abs.Logo,
|
||||||
ResourceID: abs.UUID,
|
ResourceID: abs.UUID,
|
||||||
|
InstanceID: inst.GetID(),
|
||||||
ResourceType: t,
|
ResourceType: t,
|
||||||
Quantity: 1,
|
Quantity: 1,
|
||||||
InstancesRefs: instances,
|
InstancesRefs: instances,
|
||||||
|
|||||||
Reference in New Issue
Block a user