enrich card
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Владимир Фёдоров 2024-05-30 03:24:20 +07:00
parent 4335d14090
commit 4917ca90fc
6 changed files with 197 additions and 115 deletions

View File

@ -96,6 +96,7 @@ message GroupedProduct {
message Variant {
int64 price = 1;
repeated Property properties = 2;
bool active = 3;
}
message Property {
@ -155,6 +156,9 @@ message CardItem {
double inventory = 9;
int64 count = 10;
int64 amount = 11;
int64 amountOld = 12;
repeated Variant variants = 13;
repeated Label labels = 14;
}
message CardReq {

9
api/request.http Normal file
View File

@ -0,0 +1,9 @@
POST http://localhost:8090/card
content-type: application/json
[
{
"product_id": 1,
"count": 7
}
]

View File

@ -30,7 +30,7 @@ func (s *Service) GetCard(ctx context.Context, items []*proto.OrderItem) ([]*pro
if err != nil {
return nil, err
}
amount, err := calcItemAmount(
amount, amountOld, err := calcItemAmount(
&ProductAndCount{
product: product,
count: item.Count,
@ -51,13 +51,17 @@ func (s *Service) GetCard(ctx context.Context, items []*proto.OrderItem) ([]*pro
Inventory: product.Inventory,
Count: item.Count,
Amount: amount,
AmountOld: amountOld,
Variants: product.Variants,
Labels: product.Labels,
},
)
}
return res, nil
}
func calcItemAmount(item *ProductAndCount) (int64, error) {
func calcItemAmount(item *ProductAndCount) (int64, int64, error) {
variantOld := item.product.Variants[0]
var variant *proto.Variant
for _, v := range item.product.Variants {
check := true
@ -65,7 +69,7 @@ func calcItemAmount(item *ProductAndCount) (int64, error) {
if property.Name == "min" {
minBorder, err := strconv.ParseInt(property.Value, 10, 64)
if err != nil {
return 0, err
return 0, 0, err
}
if item.count < minBorder {
check = false
@ -74,7 +78,7 @@ func calcItemAmount(item *ProductAndCount) (int64, error) {
if property.Name == "max" {
maxBorder, err := strconv.ParseInt(property.Value, 10, 64)
if err != nil {
return 0, err
return 0, 0, err
}
if item.count > maxBorder {
check = false
@ -86,8 +90,9 @@ func calcItemAmount(item *ProductAndCount) (int64, error) {
}
}
}
variant.Active = true
if variant == nil {
return 0, errors.New("variant not found")
return 0, 0, errors.New("variant not found")
}
return variant.Price * item.count, nil
return variant.Price * item.count, variantOld.Price * item.count, nil
}

View File

@ -486,6 +486,7 @@ type Variant struct {
Price int64 `protobuf:"varint,1,opt,name=price,proto3" json:"price,omitempty"`
Properties []*Property `protobuf:"bytes,2,rep,name=properties,proto3" json:"properties,omitempty"`
Active bool `protobuf:"varint,3,opt,name=active,proto3" json:"active,omitempty"`
}
func (x *Variant) Reset() {
@ -534,6 +535,13 @@ func (x *Variant) GetProperties() []*Property {
return nil
}
func (x *Variant) GetActive() bool {
if x != nil {
return x.Active
}
return false
}
type Property struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -1096,6 +1104,9 @@ type CardItem struct {
Inventory float64 `protobuf:"fixed64,9,opt,name=inventory,proto3" json:"inventory,omitempty"`
Count int64 `protobuf:"varint,10,opt,name=count,proto3" json:"count,omitempty"`
Amount int64 `protobuf:"varint,11,opt,name=amount,proto3" json:"amount,omitempty"`
AmountOld int64 `protobuf:"varint,12,opt,name=amountOld,proto3" json:"amountOld,omitempty"`
Variants []*Variant `protobuf:"bytes,13,rep,name=variants,proto3" json:"variants,omitempty"`
Labels []*Label `protobuf:"bytes,14,rep,name=labels,proto3" json:"labels,omitempty"`
}
func (x *CardItem) Reset() {
@ -1193,6 +1204,27 @@ func (x *CardItem) GetAmount() int64 {
return 0
}
func (x *CardItem) GetAmountOld() int64 {
if x != nil {
return x.AmountOld
}
return 0
}
func (x *CardItem) GetVariants() []*Variant {
if x != nil {
return x.Variants
}
return nil
}
func (x *CardItem) GetLabels() []*Label {
if x != nil {
return x.Labels
}
return nil
}
type CardReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -1397,61 +1429,70 @@ var file_main_proto_rawDesc = []byte{
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x14, 0x0a, 0x05, 0x69,
0x6d, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67,
0x65, 0x22, 0x54, 0x0a, 0x07, 0x56, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05,
0x65, 0x22, 0x6c, 0x0a, 0x07, 0x56, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05,
0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69,
0x63, 0x65, 0x12, 0x33, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73,
0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63,
0x72, 0x6d, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x52, 0x0a, 0x70, 0x72, 0x6f,
0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x34, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x70, 0x65,
0x72, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x0a,
0x0e, 0x43, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x69, 0x73, 0x74, 0x69, 0x63, 0x12,
0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x1b, 0x0a, 0x05, 0x4c, 0x61, 0x62,
0x65, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x1f, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f,
0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x22, 0x3a, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x74, 0x52, 0x73, 0x70, 0x12, 0x2c, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63,
0x72, 0x6d, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x64,
0x75, 0x63, 0x74, 0x22, 0x23, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x42, 0x72, 0x65, 0x61, 0x64, 0x63,
0x72, 0x75, 0x6d, 0x62, 0x73, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x22, 0x45, 0x0a, 0x0e, 0x42, 0x72, 0x65, 0x61,
0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x52, 0x73, 0x70, 0x12, 0x33, 0x0a, 0x0a, 0x63, 0x61,
0x74, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13,
0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x74, 0x65, 0x67,
0x6f, 0x72, 0x79, 0x52, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x22,
0x32, 0x0a, 0x08, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x26, 0x0a, 0x05, 0x6f,
0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x72, 0x61,
0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x05, 0x6f, 0x72,
0x64, 0x65, 0x72, 0x22, 0x0a, 0x0a, 0x08, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x73, 0x70, 0x22,
0x5d, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05,
0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f,
0x6e, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x14, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72,
0x64, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x40,
0x0a, 0x09, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x70,
0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x22, 0xd2, 0x01, 0x0a, 0x08, 0x43, 0x61, 0x72, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a,
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a,
0x07, 0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75,
0x72, 0x69, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x16, 0x0a,
0x06, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x69,
0x6d, 0x61, 0x67, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x6e, 0x69, 0x74, 0x18, 0x08, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x6e, 0x69, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x76,
0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x69, 0x6e,
0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a,
0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x61,
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x35, 0x0a, 0x07, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71,
0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22,
0x34, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x0a, 0x0e, 0x43, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74,
0x65, 0x72, 0x69, 0x73, 0x74, 0x69, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x22, 0x1b, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x1f,
0x0a, 0x0d, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x12,
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x22,
0x3a, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x73, 0x70, 0x12, 0x2c, 0x0a,
0x07, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12,
0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x74, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x22, 0x23, 0x0a, 0x11, 0x47,
0x65, 0x74, 0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x52, 0x65, 0x71,
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64,
0x22, 0x45, 0x0a, 0x0e, 0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x52,
0x73, 0x70, 0x12, 0x33, 0x0a, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73,
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63,
0x72, 0x6d, 0x2e, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x0a, 0x63, 0x61, 0x74,
0x65, 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x22, 0x32, 0x0a, 0x08, 0x4f, 0x72, 0x64, 0x65, 0x72,
0x52, 0x65, 0x71, 0x12, 0x26, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f,
0x72, 0x64, 0x65, 0x72, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x0a, 0x0a, 0x08, 0x4f,
0x72, 0x64, 0x65, 0x72, 0x52, 0x73, 0x70, 0x22, 0x5d, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72,
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x03, 0x20,
0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74,
0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x72, 0x61, 0x62,
0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x52,
0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x40, 0x0a, 0x09, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49,
0x74, 0x65, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28,
0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xca, 0x02, 0x0a, 0x08, 0x43, 0x61, 0x72,
0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x12,
0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x18,
0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x12, 0x12, 0x0a,
0x04, 0x75, 0x6e, 0x69, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x6e, 0x69,
0x74, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x09,
0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x12,
0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18,
0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a,
0x09, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x6c, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03,
0x52, 0x09, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x6c, 0x64, 0x12, 0x2e, 0x0a, 0x08, 0x76,
0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e,
0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x6e,
0x74, 0x52, 0x08, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x28, 0x0a, 0x06, 0x6c,
0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x72,
0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x06, 0x6c,
0x61, 0x62, 0x65, 0x6c, 0x73, 0x22, 0x35, 0x0a, 0x07, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71,
0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x14, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, 0x65,
0x72, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x34, 0x0a, 0x07,
@ -1554,27 +1595,29 @@ var file_main_proto_depIdxs = []int32{
2, // 9: crabs.crm.BreadcrumbsRsp.categories:type_name -> crabs.crm.Category
17, // 10: crabs.crm.OrderReq.order:type_name -> crabs.crm.Order
18, // 11: crabs.crm.Order.items:type_name -> crabs.crm.OrderItem
18, // 12: crabs.crm.CardReq.items:type_name -> crabs.crm.OrderItem
19, // 13: crabs.crm.CardRsp.items:type_name -> crabs.crm.CardItem
0, // 14: crabs.crm.CRM.GetCatalog:input_type -> crabs.crm.GetCatalogReq
3, // 15: crabs.crm.CRM.GetPositions:input_type -> crabs.crm.GetPositionsReq
11, // 16: crabs.crm.CRM.GetProduct:input_type -> crabs.crm.GetProductReq
13, // 17: crabs.crm.CRM.GetBreadcrumbs:input_type -> crabs.crm.GetBreadcrumbsReq
15, // 18: crabs.crm.CRM.Order:input_type -> crabs.crm.OrderReq
20, // 19: crabs.crm.CRM.GetCard:input_type -> crabs.crm.CardReq
22, // 20: crabs.crm.CRM.GetImage:input_type -> crabs.crm.GetImageReq
1, // 21: crabs.crm.CRM.GetCatalog:output_type -> crabs.crm.CatalogRsp
4, // 22: crabs.crm.CRM.GetPositions:output_type -> crabs.crm.PositionsRsp
12, // 23: crabs.crm.CRM.GetProduct:output_type -> crabs.crm.ProductRsp
14, // 24: crabs.crm.CRM.GetBreadcrumbs:output_type -> crabs.crm.BreadcrumbsRsp
16, // 25: crabs.crm.CRM.Order:output_type -> crabs.crm.OrderRsp
21, // 26: crabs.crm.CRM.GetCard:output_type -> crabs.crm.CardRsp
23, // 27: crabs.crm.CRM.GetImage:output_type -> google.api.HttpBody
21, // [21:28] is the sub-list for method output_type
14, // [14:21] is the sub-list for method input_type
14, // [14:14] is the sub-list for extension type_name
14, // [14:14] is the sub-list for extension extendee
0, // [0:14] is the sub-list for field type_name
7, // 12: crabs.crm.CardItem.variants:type_name -> crabs.crm.Variant
10, // 13: crabs.crm.CardItem.labels:type_name -> crabs.crm.Label
18, // 14: crabs.crm.CardReq.items:type_name -> crabs.crm.OrderItem
19, // 15: crabs.crm.CardRsp.items:type_name -> crabs.crm.CardItem
0, // 16: crabs.crm.CRM.GetCatalog:input_type -> crabs.crm.GetCatalogReq
3, // 17: crabs.crm.CRM.GetPositions:input_type -> crabs.crm.GetPositionsReq
11, // 18: crabs.crm.CRM.GetProduct:input_type -> crabs.crm.GetProductReq
13, // 19: crabs.crm.CRM.GetBreadcrumbs:input_type -> crabs.crm.GetBreadcrumbsReq
15, // 20: crabs.crm.CRM.Order:input_type -> crabs.crm.OrderReq
20, // 21: crabs.crm.CRM.GetCard:input_type -> crabs.crm.CardReq
22, // 22: crabs.crm.CRM.GetImage:input_type -> crabs.crm.GetImageReq
1, // 23: crabs.crm.CRM.GetCatalog:output_type -> crabs.crm.CatalogRsp
4, // 24: crabs.crm.CRM.GetPositions:output_type -> crabs.crm.PositionsRsp
12, // 25: crabs.crm.CRM.GetProduct:output_type -> crabs.crm.ProductRsp
14, // 26: crabs.crm.CRM.GetBreadcrumbs:output_type -> crabs.crm.BreadcrumbsRsp
16, // 27: crabs.crm.CRM.Order:output_type -> crabs.crm.OrderRsp
21, // 28: crabs.crm.CRM.GetCard:output_type -> crabs.crm.CardRsp
23, // 29: crabs.crm.CRM.GetImage:output_type -> google.api.HttpBody
23, // [23:30] is the sub-list for method output_type
16, // [16:23] is the sub-list for method input_type
16, // [16:16] is the sub-list for extension type_name
16, // [16:16] is the sub-list for extension extendee
0, // [0:16] is the sub-list for field type_name
}
func init() { file_main_proto_init() }

View File

@ -328,6 +328,24 @@
"amount": {
"type": "string",
"format": "int64"
},
"amountOld": {
"type": "string",
"format": "int64"
},
"variants": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/crmVariant"
}
},
"labels": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/crabscrmLabel"
}
}
}
},
@ -528,6 +546,9 @@
"type": "object",
"$ref": "#/definitions/crmProperty"
}
},
"active": {
"type": "boolean"
}
}
},

View File

@ -10,7 +10,7 @@
"description": "",
"group": 1,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 16500,
@ -62,7 +62,7 @@
"description": "",
"group": 1,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 16500,
@ -114,7 +114,7 @@
"description": "",
"group": 1,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 16500,
@ -166,7 +166,7 @@
"description": "",
"group": 1,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 16500,
@ -218,7 +218,7 @@
"description": "",
"group": 1,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 17000,
@ -270,7 +270,7 @@
"description": "",
"group": 1,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 16500,
@ -322,7 +322,7 @@
"description": "",
"group": 1,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 16500,
@ -374,7 +374,7 @@
"description": "",
"group": 1,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 16500,
@ -426,7 +426,7 @@
"description": "",
"group": 2,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 16500,
@ -478,7 +478,7 @@
"description": "",
"group": 2,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 16500,
@ -530,7 +530,7 @@
"description": "",
"group": 2,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 16500,
@ -582,7 +582,7 @@
"description": "",
"group": 2,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 17000,
@ -634,7 +634,7 @@
"description": "",
"group": 3,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 16500,
@ -686,7 +686,7 @@
"description": "",
"group": 3,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 16500,
@ -738,7 +738,7 @@
"description": "",
"group": 3,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 16500,
@ -790,7 +790,7 @@
"description": "",
"group": 4,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 16500,
@ -842,7 +842,7 @@
"description": "",
"group": 5,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 16500,
@ -894,7 +894,7 @@
"description": "",
"group": 6,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 18000,
@ -920,7 +920,7 @@
"description": "",
"group": 6,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 18000,
@ -946,7 +946,7 @@
"description": "",
"group": 7,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 18000,
@ -972,7 +972,7 @@
"description": "",
"group": 8,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 18000,
@ -998,7 +998,7 @@
"description": "",
"group": 9,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 18000,
@ -1024,7 +1024,7 @@
"description": "",
"group": 10,
"unit": "piece",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 11000,
@ -1050,7 +1050,7 @@
"description": "",
"group": 10,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 29000,
@ -1076,7 +1076,7 @@
"description": "",
"group": 10,
"unit": "piece",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 12000,
@ -1102,7 +1102,7 @@
"description": "",
"group": 10,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 30000,
@ -1128,7 +1128,7 @@
"description": "",
"group": 11,
"unit": "piece",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 11000,
@ -1154,7 +1154,7 @@
"description": "",
"group": 11,
"unit": "kg",
"inventory": 100,
"inventory": 999,
"variants": [
{
"price": 26000,