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 { message Variant {
int64 price = 1; int64 price = 1;
repeated Property properties = 2; repeated Property properties = 2;
bool active = 3;
} }
message Property { message Property {
@ -155,6 +156,9 @@ message CardItem {
double inventory = 9; double inventory = 9;
int64 count = 10; int64 count = 10;
int64 amount = 11; int64 amount = 11;
int64 amountOld = 12;
repeated Variant variants = 13;
repeated Label labels = 14;
} }
message CardReq { 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 { if err != nil {
return nil, err return nil, err
} }
amount, err := calcItemAmount( amount, amountOld, err := calcItemAmount(
&ProductAndCount{ &ProductAndCount{
product: product, product: product,
count: item.Count, count: item.Count,
@ -51,13 +51,17 @@ func (s *Service) GetCard(ctx context.Context, items []*proto.OrderItem) ([]*pro
Inventory: product.Inventory, Inventory: product.Inventory,
Count: item.Count, Count: item.Count,
Amount: amount, Amount: amount,
AmountOld: amountOld,
Variants: product.Variants,
Labels: product.Labels,
}, },
) )
} }
return res, nil 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 var variant *proto.Variant
for _, v := range item.product.Variants { for _, v := range item.product.Variants {
check := true check := true
@ -65,7 +69,7 @@ func calcItemAmount(item *ProductAndCount) (int64, error) {
if property.Name == "min" { if property.Name == "min" {
minBorder, err := strconv.ParseInt(property.Value, 10, 64) minBorder, err := strconv.ParseInt(property.Value, 10, 64)
if err != nil { if err != nil {
return 0, err return 0, 0, err
} }
if item.count < minBorder { if item.count < minBorder {
check = false check = false
@ -74,7 +78,7 @@ func calcItemAmount(item *ProductAndCount) (int64, error) {
if property.Name == "max" { if property.Name == "max" {
maxBorder, err := strconv.ParseInt(property.Value, 10, 64) maxBorder, err := strconv.ParseInt(property.Value, 10, 64)
if err != nil { if err != nil {
return 0, err return 0, 0, err
} }
if item.count > maxBorder { if item.count > maxBorder {
check = false check = false
@ -86,8 +90,9 @@ func calcItemAmount(item *ProductAndCount) (int64, error) {
} }
} }
} }
variant.Active = true
if variant == nil { 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"` Price int64 `protobuf:"varint,1,opt,name=price,proto3" json:"price,omitempty"`
Properties []*Property `protobuf:"bytes,2,rep,name=properties,proto3" json:"properties,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() { func (x *Variant) Reset() {
@ -534,6 +535,13 @@ func (x *Variant) GetProperties() []*Property {
return nil return nil
} }
func (x *Variant) GetActive() bool {
if x != nil {
return x.Active
}
return false
}
type Property struct { type Property struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -1096,6 +1104,9 @@ type CardItem struct {
Inventory float64 `protobuf:"fixed64,9,opt,name=inventory,proto3" json:"inventory,omitempty"` Inventory float64 `protobuf:"fixed64,9,opt,name=inventory,proto3" json:"inventory,omitempty"`
Count int64 `protobuf:"varint,10,opt,name=count,proto3" json:"count,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"` 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() { func (x *CardItem) Reset() {
@ -1193,6 +1204,27 @@ func (x *CardItem) GetAmount() int64 {
return 0 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 { type CardReq struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache 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, 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, 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, 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, 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, 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, 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, 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, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76,
0x72, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22,
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x34, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x0a, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
0x0e, 0x43, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x69, 0x73, 0x74, 0x69, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3a, 0x0a, 0x0e, 0x43, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74,
0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x65, 0x72, 0x69, 0x73, 0x74, 0x69, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x1b, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76,
0x65, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x1f, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x65, 0x22, 0x1b, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x1f,
0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x22, 0x3a, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x12,
0x63, 0x74, 0x52, 0x73, 0x70, 0x12, 0x2c, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x22,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x3a, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x73, 0x70, 0x12, 0x2c, 0x0a,
0x72, 0x6d, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x64, 0x07, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12,
0x75, 0x63, 0x74, 0x22, 0x23, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75,
0x72, 0x75, 0x6d, 0x62, 0x73, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x63, 0x74, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x22, 0x23, 0x0a, 0x11, 0x47,
0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x22, 0x45, 0x0a, 0x0e, 0x42, 0x72, 0x65, 0x61, 0x65, 0x74, 0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x52, 0x65, 0x71,
0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x52, 0x73, 0x70, 0x12, 0x33, 0x0a, 0x0a, 0x63, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64,
0x74, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x22, 0x45, 0x0a, 0x0e, 0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x52,
0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x74, 0x65, 0x67, 0x73, 0x70, 0x12, 0x33, 0x0a, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73,
0x6f, 0x72, 0x79, 0x52, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x22, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63,
0x32, 0x0a, 0x08, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x26, 0x0a, 0x05, 0x6f, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x0a, 0x63, 0x61, 0x74,
0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x72, 0x61, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x22, 0x32, 0x0a, 0x08, 0x4f, 0x72, 0x64, 0x65, 0x72,
0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x05, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x12, 0x26, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
0x64, 0x65, 0x72, 0x22, 0x0a, 0x0a, 0x08, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x73, 0x70, 0x22, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f,
0x5d, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x64, 0x65, 0x72, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x0a, 0x0a, 0x08, 0x4f,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x64, 0x65, 0x72, 0x52, 0x73, 0x70, 0x22, 0x5d, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72,
0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x6e, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x03, 0x20,
0x0b, 0x32, 0x14, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74,
0x64, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x40, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x72, 0x61, 0x62,
0x0a, 0x09, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x52,
0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x40, 0x0a, 0x09, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49,
0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x74, 0x65, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69,
0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
0x22, 0xd2, 0x01, 0x0a, 0x08, 0x43, 0x61, 0x72, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28,
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xca, 0x02, 0x0a, 0x08, 0x43, 0x61, 0x72,
0x07, 0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65,
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x12,
0x72, 0x69, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x16, 0x0a, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
0x06, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x69, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
0x6d, 0x61, 0x67, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x6e, 0x69, 0x74, 0x18, 0x08, 0x20, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x18,
0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x6e, 0x69, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x76, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x12, 0x12, 0x0a,
0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x69, 0x6e, 0x04, 0x75, 0x6e, 0x69, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x6e, 0x69,
0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x09,
0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x12,
0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x61, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05,
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x35, 0x0a, 0x07, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 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, 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, 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, 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 2, // 9: crabs.crm.BreadcrumbsRsp.categories:type_name -> crabs.crm.Category
17, // 10: crabs.crm.OrderReq.order:type_name -> crabs.crm.Order 17, // 10: crabs.crm.OrderReq.order:type_name -> crabs.crm.Order
18, // 11: crabs.crm.Order.items:type_name -> crabs.crm.OrderItem 18, // 11: crabs.crm.Order.items:type_name -> crabs.crm.OrderItem
18, // 12: crabs.crm.CardReq.items:type_name -> crabs.crm.OrderItem 7, // 12: crabs.crm.CardItem.variants:type_name -> crabs.crm.Variant
19, // 13: crabs.crm.CardRsp.items:type_name -> crabs.crm.CardItem 10, // 13: crabs.crm.CardItem.labels:type_name -> crabs.crm.Label
0, // 14: crabs.crm.CRM.GetCatalog:input_type -> crabs.crm.GetCatalogReq 18, // 14: crabs.crm.CardReq.items:type_name -> crabs.crm.OrderItem
3, // 15: crabs.crm.CRM.GetPositions:input_type -> crabs.crm.GetPositionsReq 19, // 15: crabs.crm.CardRsp.items:type_name -> crabs.crm.CardItem
11, // 16: crabs.crm.CRM.GetProduct:input_type -> crabs.crm.GetProductReq 0, // 16: crabs.crm.CRM.GetCatalog:input_type -> crabs.crm.GetCatalogReq
13, // 17: crabs.crm.CRM.GetBreadcrumbs:input_type -> crabs.crm.GetBreadcrumbsReq 3, // 17: crabs.crm.CRM.GetPositions:input_type -> crabs.crm.GetPositionsReq
15, // 18: crabs.crm.CRM.Order:input_type -> crabs.crm.OrderReq 11, // 18: crabs.crm.CRM.GetProduct:input_type -> crabs.crm.GetProductReq
20, // 19: crabs.crm.CRM.GetCard:input_type -> crabs.crm.CardReq 13, // 19: crabs.crm.CRM.GetBreadcrumbs:input_type -> crabs.crm.GetBreadcrumbsReq
22, // 20: crabs.crm.CRM.GetImage:input_type -> crabs.crm.GetImageReq 15, // 20: crabs.crm.CRM.Order:input_type -> crabs.crm.OrderReq
1, // 21: crabs.crm.CRM.GetCatalog:output_type -> crabs.crm.CatalogRsp 20, // 21: crabs.crm.CRM.GetCard:input_type -> crabs.crm.CardReq
4, // 22: crabs.crm.CRM.GetPositions:output_type -> crabs.crm.PositionsRsp 22, // 22: crabs.crm.CRM.GetImage:input_type -> crabs.crm.GetImageReq
12, // 23: crabs.crm.CRM.GetProduct:output_type -> crabs.crm.ProductRsp 1, // 23: crabs.crm.CRM.GetCatalog:output_type -> crabs.crm.CatalogRsp
14, // 24: crabs.crm.CRM.GetBreadcrumbs:output_type -> crabs.crm.BreadcrumbsRsp 4, // 24: crabs.crm.CRM.GetPositions:output_type -> crabs.crm.PositionsRsp
16, // 25: crabs.crm.CRM.Order:output_type -> crabs.crm.OrderRsp 12, // 25: crabs.crm.CRM.GetProduct:output_type -> crabs.crm.ProductRsp
21, // 26: crabs.crm.CRM.GetCard:output_type -> crabs.crm.CardRsp 14, // 26: crabs.crm.CRM.GetBreadcrumbs:output_type -> crabs.crm.BreadcrumbsRsp
23, // 27: crabs.crm.CRM.GetImage:output_type -> google.api.HttpBody 16, // 27: crabs.crm.CRM.Order:output_type -> crabs.crm.OrderRsp
21, // [21:28] is the sub-list for method output_type 21, // 28: crabs.crm.CRM.GetCard:output_type -> crabs.crm.CardRsp
14, // [14:21] is the sub-list for method input_type 23, // 29: crabs.crm.CRM.GetImage:output_type -> google.api.HttpBody
14, // [14:14] is the sub-list for extension type_name 23, // [23:30] is the sub-list for method output_type
14, // [14:14] is the sub-list for extension extendee 16, // [16:23] is the sub-list for method input_type
0, // [0:14] is the sub-list for field type_name 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() } func init() { file_main_proto_init() }

View File

@ -328,6 +328,24 @@
"amount": { "amount": {
"type": "string", "type": "string",
"format": "int64" "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", "type": "object",
"$ref": "#/definitions/crmProperty" "$ref": "#/definitions/crmProperty"
} }
},
"active": {
"type": "boolean"
} }
} }
}, },

View File

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