Product View aufgebaut
This commit is contained in:
@@ -216,7 +216,7 @@ func (rr ProductgroupRepository) GetProductgroup(ProductgroupId int) (*models.Pr
|
||||
}
|
||||
|
||||
// get property types of this product group
|
||||
propertyTypes, err3 := rr.GetPropertyTypesByProductGroupID(pg.ID)
|
||||
propertyTypes, err3 := rr.GetPropertyTypesByProductGroup(pg)
|
||||
if err3 != nil {
|
||||
return nil, &models.ResponseError{
|
||||
Message: err3.Message,
|
||||
@@ -233,6 +233,30 @@ func (rr ProductgroupRepository) GetProductgroup(ProductgroupId int) (*models.Pr
|
||||
return pg, nil
|
||||
}
|
||||
|
||||
func (rr ProductgroupRepository) GetPropertyTypesByProductGroup(productGroup *models.Productgroup) ([]*models.PropertyType, *models.ResponseError) {
|
||||
if productGroup.Label == "Simply CPQ" {
|
||||
return rr.GetPropertyTypesByProductGroupID(productGroup.ID)
|
||||
} else {
|
||||
PropertyTypesParent, err := rr.GetPropertyTypesByProductGroupID(productGroup.ParentProductGroupID)
|
||||
if err != nil {
|
||||
return nil, &models.ResponseError{
|
||||
Message: err.Message,
|
||||
Status: http.StatusInternalServerError,
|
||||
}
|
||||
}
|
||||
PropertyTypesChild, err := rr.GetPropertyTypesByProductGroupID(productGroup.ID)
|
||||
if err != nil {
|
||||
return nil, &models.ResponseError{
|
||||
Message: err.Message,
|
||||
Status: http.StatusInternalServerError,
|
||||
}
|
||||
}
|
||||
|
||||
return append(PropertyTypesParent, PropertyTypesChild...), nil
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (rr ProductgroupRepository) GetPropertyTypesByProductGroupID(productGroupID int) ([]*models.PropertyType, *models.ResponseError) {
|
||||
var propertyTypes []*models.PropertyType
|
||||
query := `SELECT property_type_id FROM product_group_property_types_list WHERE product_group_id=$1`
|
||||
|
||||
Reference in New Issue
Block a user