add positions
This commit is contained in:
parent
0960f3e9dc
commit
afd5536246
|
@ -12,17 +12,66 @@ service CRM {
|
||||||
get: "/catalog"
|
get: "/catalog"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
rpc GetPositions(GetPositionsReq) returns (PositionsRsp) {
|
||||||
|
option (google.api.http) = {
|
||||||
|
get: "/positions/{id}"
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetCatalogReq {}
|
message GetCatalogReq {}
|
||||||
|
|
||||||
message CatalogRsp {
|
message CatalogRsp {
|
||||||
message Category {
|
|
||||||
int64 id = 1;
|
|
||||||
string name = 2;
|
|
||||||
string uri = 3;
|
|
||||||
repeated Category children = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
repeated Category categories = 1;
|
repeated Category categories = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message Category {
|
||||||
|
int64 id = 1;
|
||||||
|
string name = 2;
|
||||||
|
string uri = 3;
|
||||||
|
repeated Category children = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetPositionsReq {
|
||||||
|
int64 id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PositionsRsp {
|
||||||
|
repeated Product products = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Product {
|
||||||
|
int64 id = 1;
|
||||||
|
string article = 2;
|
||||||
|
string name = 3;
|
||||||
|
string uri = 4;
|
||||||
|
repeated string images = 5;
|
||||||
|
string description = 6;
|
||||||
|
repeated GroupedProduct grouped_products = 7;
|
||||||
|
string unit = 8;
|
||||||
|
double inventory = 9;
|
||||||
|
repeated Variant variants = 10;
|
||||||
|
repeated Characteristic characteristics = 11;
|
||||||
|
int64 category = 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GroupedProduct {
|
||||||
|
string name = 1;
|
||||||
|
string uri = 2;
|
||||||
|
string image = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Variant {
|
||||||
|
int64 price = 1;
|
||||||
|
repeated Property properties = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Property {
|
||||||
|
string name = 1;
|
||||||
|
string value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Characteristic {
|
||||||
|
string name = 1;
|
||||||
|
string value = 2;
|
||||||
|
}
|
||||||
|
|
|
@ -24,3 +24,11 @@ func (s *Server) GetCatalog(ctx context.Context, _ *crm.GetCatalogReq) (*crm.Cat
|
||||||
}
|
}
|
||||||
return &crm.CatalogRsp{Categories: categories}, nil
|
return &crm.CatalogRsp{Categories: categories}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) GetPositions(ctx context.Context, req *crm.GetPositionsReq) (*crm.PositionsRsp, error) {
|
||||||
|
products, err := s.storage.GetPositions(ctx, req.Id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &crm.PositionsRsp{Products: products}, nil
|
||||||
|
}
|
||||||
|
|
|
@ -17,8 +17,6 @@ type Breadcrumb struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type IStorage interface {
|
type IStorage interface {
|
||||||
GetAllProducts(ctx context.Context) ([]Product, error)
|
GetCatalog(ctx context.Context) ([]*crm.Category, error)
|
||||||
GetProductByID(ctx context.Context, id int) (Product, error)
|
GetPositions(ctx context.Context, id int64) ([]*crm.Product, error)
|
||||||
GetBreadcrumbs(ctx context.Context, id int) ([]Breadcrumb, error)
|
|
||||||
GetCatalog(ctx context.Context) ([]*crm.CatalogRsp_Category, error)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,29 +14,32 @@ func NewStorageFile() storage.IStorage {
|
||||||
return &storageFile{}
|
return &storageFile{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storageFile) GetCatalog(_ context.Context) ([]*crm.CatalogRsp_Category, error) {
|
func (s *storageFile) GetCatalog(_ context.Context) ([]*crm.Category, error) {
|
||||||
data, err := os.ReadFile("resources/catalog.json")
|
data, err := os.ReadFile("resources/catalog.json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var res []*crm.CatalogRsp_Category
|
var res []*crm.Category
|
||||||
if err := json.Unmarshal(data, &res); err != nil {
|
if err := json.Unmarshal(data, &res); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *storageFile) GetAllProducts(ctx context.Context) ([]storage.Product, error) {
|
func (s *storageFile) GetPositions(_ context.Context, id int64) ([]*crm.Product, error) {
|
||||||
//TODO implement me
|
data, err := os.ReadFile("resources/products.json")
|
||||||
panic("implement me")
|
if err != nil {
|
||||||
}
|
return nil, err
|
||||||
|
}
|
||||||
func (s *storageFile) GetProductByID(ctx context.Context, id int) (storage.Product, error) {
|
var products []*crm.Product
|
||||||
//TODO implement me
|
if err := json.Unmarshal(data, &products); err != nil {
|
||||||
panic("implement me")
|
return nil, err
|
||||||
}
|
}
|
||||||
|
res := make([]*crm.Product, 0, len(products))
|
||||||
func (s *storageFile) GetBreadcrumbs(ctx context.Context, id int) ([]storage.Breadcrumb, error) {
|
for _, product := range products {
|
||||||
//TODO implement me
|
if id == 0 || product.Category == id {
|
||||||
panic("implement me")
|
res = append(res, product)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
715
proto/main.pb.go
715
proto/main.pb.go
|
@ -64,7 +64,7 @@ type CatalogRsp struct {
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Categories []*CatalogRsp_Category `protobuf:"bytes,1,rep,name=categories,proto3" json:"categories,omitempty"`
|
Categories []*Category `protobuf:"bytes,1,rep,name=categories,proto3" json:"categories,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CatalogRsp) Reset() {
|
func (x *CatalogRsp) Reset() {
|
||||||
|
@ -99,26 +99,26 @@ func (*CatalogRsp) Descriptor() ([]byte, []int) {
|
||||||
return file_main_proto_rawDescGZIP(), []int{1}
|
return file_main_proto_rawDescGZIP(), []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CatalogRsp) GetCategories() []*CatalogRsp_Category {
|
func (x *CatalogRsp) GetCategories() []*Category {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Categories
|
return x.Categories
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type CatalogRsp_Category struct {
|
type Category struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
Uri string `protobuf:"bytes,3,opt,name=uri,proto3" json:"uri,omitempty"`
|
Uri string `protobuf:"bytes,3,opt,name=uri,proto3" json:"uri,omitempty"`
|
||||||
Children []*CatalogRsp_Category `protobuf:"bytes,4,rep,name=children,proto3" json:"children,omitempty"`
|
Children []*Category `protobuf:"bytes,4,rep,name=children,proto3" json:"children,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CatalogRsp_Category) Reset() {
|
func (x *Category) Reset() {
|
||||||
*x = CatalogRsp_Category{}
|
*x = Category{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_main_proto_msgTypes[2]
|
mi := &file_main_proto_msgTypes[2]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
@ -126,13 +126,13 @@ func (x *CatalogRsp_Category) Reset() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CatalogRsp_Category) String() string {
|
func (x *Category) String() string {
|
||||||
return protoimpl.X.MessageStringOf(x)
|
return protoimpl.X.MessageStringOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*CatalogRsp_Category) ProtoMessage() {}
|
func (*Category) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *CatalogRsp_Category) ProtoReflect() protoreflect.Message {
|
func (x *Category) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_main_proto_msgTypes[2]
|
mi := &file_main_proto_msgTypes[2]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
@ -144,39 +144,496 @@ func (x *CatalogRsp_Category) ProtoReflect() protoreflect.Message {
|
||||||
return mi.MessageOf(x)
|
return mi.MessageOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use CatalogRsp_Category.ProtoReflect.Descriptor instead.
|
// Deprecated: Use Category.ProtoReflect.Descriptor instead.
|
||||||
func (*CatalogRsp_Category) Descriptor() ([]byte, []int) {
|
func (*Category) Descriptor() ([]byte, []int) {
|
||||||
return file_main_proto_rawDescGZIP(), []int{1, 0}
|
return file_main_proto_rawDescGZIP(), []int{2}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CatalogRsp_Category) GetId() int64 {
|
func (x *Category) GetId() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Id
|
return x.Id
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CatalogRsp_Category) GetName() string {
|
func (x *Category) GetName() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Name
|
return x.Name
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CatalogRsp_Category) GetUri() string {
|
func (x *Category) GetUri() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Uri
|
return x.Uri
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CatalogRsp_Category) GetChildren() []*CatalogRsp_Category {
|
func (x *Category) GetChildren() []*Category {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Children
|
return x.Children
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GetPositionsReq struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetPositionsReq) Reset() {
|
||||||
|
*x = GetPositionsReq{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_main_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetPositionsReq) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GetPositionsReq) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GetPositionsReq) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_main_proto_msgTypes[3]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use GetPositionsReq.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GetPositionsReq) Descriptor() ([]byte, []int) {
|
||||||
|
return file_main_proto_rawDescGZIP(), []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetPositionsReq) GetId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type PositionsRsp struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Products []*Product `protobuf:"bytes,1,rep,name=products,proto3" json:"products,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PositionsRsp) Reset() {
|
||||||
|
*x = PositionsRsp{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_main_proto_msgTypes[4]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PositionsRsp) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*PositionsRsp) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *PositionsRsp) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_main_proto_msgTypes[4]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use PositionsRsp.ProtoReflect.Descriptor instead.
|
||||||
|
func (*PositionsRsp) Descriptor() ([]byte, []int) {
|
||||||
|
return file_main_proto_rawDescGZIP(), []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PositionsRsp) GetProducts() []*Product {
|
||||||
|
if x != nil {
|
||||||
|
return x.Products
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Product struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
Article string `protobuf:"bytes,2,opt,name=article,proto3" json:"article,omitempty"`
|
||||||
|
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
Uri string `protobuf:"bytes,4,opt,name=uri,proto3" json:"uri,omitempty"`
|
||||||
|
Images []string `protobuf:"bytes,5,rep,name=images,proto3" json:"images,omitempty"`
|
||||||
|
Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"`
|
||||||
|
GroupedProducts []*GroupedProduct `protobuf:"bytes,7,rep,name=grouped_products,json=groupedProducts,proto3" json:"grouped_products,omitempty"`
|
||||||
|
Unit string `protobuf:"bytes,8,opt,name=unit,proto3" json:"unit,omitempty"`
|
||||||
|
Inventory float64 `protobuf:"fixed64,9,opt,name=inventory,proto3" json:"inventory,omitempty"`
|
||||||
|
Variants []*Variant `protobuf:"bytes,10,rep,name=variants,proto3" json:"variants,omitempty"`
|
||||||
|
Characteristics []*Characteristic `protobuf:"bytes,11,rep,name=characteristics,proto3" json:"characteristics,omitempty"`
|
||||||
|
Category int64 `protobuf:"varint,12,opt,name=category,proto3" json:"category,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Product) Reset() {
|
||||||
|
*x = Product{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_main_proto_msgTypes[5]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Product) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Product) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Product) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_main_proto_msgTypes[5]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Product.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Product) Descriptor() ([]byte, []int) {
|
||||||
|
return file_main_proto_rawDescGZIP(), []int{5}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Product) GetId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Product) GetArticle() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Article
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Product) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Product) GetUri() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Uri
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Product) GetImages() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Images
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Product) GetDescription() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Description
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Product) GetGroupedProducts() []*GroupedProduct {
|
||||||
|
if x != nil {
|
||||||
|
return x.GroupedProducts
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Product) GetUnit() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Unit
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Product) GetInventory() float64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Inventory
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Product) GetVariants() []*Variant {
|
||||||
|
if x != nil {
|
||||||
|
return x.Variants
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Product) GetCharacteristics() []*Characteristic {
|
||||||
|
if x != nil {
|
||||||
|
return x.Characteristics
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Product) GetCategory() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Category
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type GroupedProduct struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
Uri string `protobuf:"bytes,2,opt,name=uri,proto3" json:"uri,omitempty"`
|
||||||
|
Image string `protobuf:"bytes,3,opt,name=image,proto3" json:"image,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GroupedProduct) Reset() {
|
||||||
|
*x = GroupedProduct{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_main_proto_msgTypes[6]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GroupedProduct) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GroupedProduct) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GroupedProduct) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_main_proto_msgTypes[6]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use GroupedProduct.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GroupedProduct) Descriptor() ([]byte, []int) {
|
||||||
|
return file_main_proto_rawDescGZIP(), []int{6}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GroupedProduct) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GroupedProduct) GetUri() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Uri
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GroupedProduct) GetImage() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Image
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type Variant struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Price int64 `protobuf:"varint,1,opt,name=price,proto3" json:"price,omitempty"`
|
||||||
|
Properties []*Property `protobuf:"bytes,2,rep,name=properties,proto3" json:"properties,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Variant) Reset() {
|
||||||
|
*x = Variant{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_main_proto_msgTypes[7]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Variant) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Variant) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Variant) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_main_proto_msgTypes[7]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Variant.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Variant) Descriptor() ([]byte, []int) {
|
||||||
|
return file_main_proto_rawDescGZIP(), []int{7}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Variant) GetPrice() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Price
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Variant) GetProperties() []*Property {
|
||||||
|
if x != nil {
|
||||||
|
return x.Properties
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Property struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Property) Reset() {
|
||||||
|
*x = Property{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_main_proto_msgTypes[8]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Property) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Property) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Property) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_main_proto_msgTypes[8]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Property.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Property) Descriptor() ([]byte, []int) {
|
||||||
|
return file_main_proto_rawDescGZIP(), []int{8}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Property) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Property) GetValue() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Value
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type Characteristic struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Characteristic) Reset() {
|
||||||
|
*x = Characteristic{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_main_proto_msgTypes[9]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Characteristic) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Characteristic) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Characteristic) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_main_proto_msgTypes[9]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Characteristic.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Characteristic) Descriptor() ([]byte, []int) {
|
||||||
|
return file_main_proto_rawDescGZIP(), []int{9}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Characteristic) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Characteristic) GetValue() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Value
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
var File_main_proto protoreflect.FileDescriptor
|
var File_main_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_main_proto_rawDesc = []byte{
|
var file_main_proto_rawDesc = []byte{
|
||||||
|
@ -184,25 +641,79 @@ var file_main_proto_rawDesc = []byte{
|
||||||
0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
|
0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
|
||||||
0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
|
0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0f, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x43, 0x61, 0x74, 0x61,
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0f, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x43, 0x61, 0x74, 0x61,
|
||||||
0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x22, 0xca, 0x01, 0x0a, 0x0a, 0x43, 0x61, 0x74, 0x61, 0x6c,
|
0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x22, 0x41, 0x0a, 0x0a, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f,
|
||||||
0x6f, 0x67, 0x52, 0x73, 0x70, 0x12, 0x3e, 0x0a, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72,
|
0x67, 0x52, 0x73, 0x70, 0x12, 0x33, 0x0a, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x69,
|
||||||
0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x72, 0x61, 0x62,
|
0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73,
|
||||||
0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x73, 0x70,
|
0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x0a, 0x63,
|
||||||
0x2e, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x0a, 0x63, 0x61, 0x74, 0x65, 0x67,
|
0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x22, 0x71, 0x0a, 0x08, 0x43, 0x61, 0x74,
|
||||||
0x6f, 0x72, 0x69, 0x65, 0x73, 0x1a, 0x7c, 0x0a, 0x08, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72,
|
0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69,
|
0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
|
||||||
0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69,
|
||||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x03, 0x20, 0x01,
|
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x2f, 0x0a, 0x08, 0x63,
|
||||||
0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x3a, 0x0a, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64,
|
0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e,
|
||||||
0x72, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x72, 0x61, 0x62,
|
0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f,
|
||||||
0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x73, 0x70,
|
0x72, 0x79, 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x22, 0x21, 0x0a, 0x0f,
|
||||||
0x2e, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x08, 0x63, 0x68, 0x69, 0x6c, 0x64,
|
0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x12,
|
||||||
0x72, 0x65, 0x6e, 0x32, 0x56, 0x0a, 0x03, 0x43, 0x52, 0x4d, 0x12, 0x4f, 0x0a, 0x0a, 0x47, 0x65,
|
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x22,
|
||||||
0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x18, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73,
|
0x3e, 0x0a, 0x0c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x73, 0x70, 0x12,
|
||||||
0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52,
|
0x2e, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
|
||||||
0x65, 0x71, 0x1a, 0x15, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43,
|
0x0b, 0x32, 0x12, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x50, 0x72,
|
||||||
0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x73, 0x70, 0x22, 0x10, 0x82, 0xd3, 0xe4, 0x93, 0x02,
|
0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x22,
|
||||||
0x0a, 0x12, 0x08, 0x2f, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x42, 0x09, 0x5a, 0x07, 0x70,
|
0x9c, 0x03, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 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, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
|
||||||
|
0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
|
||||||
|
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x44, 0x0a, 0x10, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x65, 0x64,
|
||||||
|
0x5f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
||||||
|
0x19, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x72, 0x6f, 0x75,
|
||||||
|
0x70, 0x65, 0x64, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x0f, 0x67, 0x72, 0x6f, 0x75,
|
||||||
|
0x70, 0x65, 0x64, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 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, 0x2e, 0x0a,
|
||||||
|
0x08, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x0a, 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, 0x43, 0x0a,
|
||||||
|
0x0f, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73,
|
||||||
|
0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63,
|
||||||
|
0x72, 0x6d, 0x2e, 0x43, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x69, 0x73, 0x74, 0x69,
|
||||||
|
0x63, 0x52, 0x0f, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x69, 0x73, 0x74, 0x69,
|
||||||
|
0x63, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x0c,
|
||||||
|
0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x22, 0x4c,
|
||||||
|
0x0a, 0x0e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x65, 0x64, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
|
||||||
|
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 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, 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, 0x32, 0xb4, 0x01, 0x0a, 0x03, 0x43, 0x52, 0x4d, 0x12, 0x4f, 0x0a, 0x0a,
|
||||||
|
0x47, 0x65, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x18, 0x2e, 0x63, 0x72, 0x61,
|
||||||
|
0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f,
|
||||||
|
0x67, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d,
|
||||||
|
0x2e, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x73, 0x70, 0x22, 0x10, 0x82, 0xd3, 0xe4,
|
||||||
|
0x93, 0x02, 0x0a, 0x12, 0x08, 0x2f, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x5c, 0x0a,
|
||||||
|
0x0c, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x2e,
|
||||||
|
0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73,
|
||||||
|
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x63, 0x72, 0x61, 0x62,
|
||||||
|
0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52,
|
||||||
|
0x73, 0x70, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, 0x2f, 0x70, 0x6f, 0x73,
|
||||||
|
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x42, 0x09, 0x5a, 0x07, 0x70,
|
||||||
0x6b, 0x67, 0x2f, 0x63, 0x72, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6b, 0x67, 0x2f, 0x63, 0x72, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,22 +729,36 @@ func file_main_proto_rawDescGZIP() []byte {
|
||||||
return file_main_proto_rawDescData
|
return file_main_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_main_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
var file_main_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
||||||
var file_main_proto_goTypes = []interface{}{
|
var file_main_proto_goTypes = []interface{}{
|
||||||
(*GetCatalogReq)(nil), // 0: crabs.crm.GetCatalogReq
|
(*GetCatalogReq)(nil), // 0: crabs.crm.GetCatalogReq
|
||||||
(*CatalogRsp)(nil), // 1: crabs.crm.CatalogRsp
|
(*CatalogRsp)(nil), // 1: crabs.crm.CatalogRsp
|
||||||
(*CatalogRsp_Category)(nil), // 2: crabs.crm.CatalogRsp.Category
|
(*Category)(nil), // 2: crabs.crm.Category
|
||||||
|
(*GetPositionsReq)(nil), // 3: crabs.crm.GetPositionsReq
|
||||||
|
(*PositionsRsp)(nil), // 4: crabs.crm.PositionsRsp
|
||||||
|
(*Product)(nil), // 5: crabs.crm.Product
|
||||||
|
(*GroupedProduct)(nil), // 6: crabs.crm.GroupedProduct
|
||||||
|
(*Variant)(nil), // 7: crabs.crm.Variant
|
||||||
|
(*Property)(nil), // 8: crabs.crm.Property
|
||||||
|
(*Characteristic)(nil), // 9: crabs.crm.Characteristic
|
||||||
}
|
}
|
||||||
var file_main_proto_depIdxs = []int32{
|
var file_main_proto_depIdxs = []int32{
|
||||||
2, // 0: crabs.crm.CatalogRsp.categories:type_name -> crabs.crm.CatalogRsp.Category
|
2, // 0: crabs.crm.CatalogRsp.categories:type_name -> crabs.crm.Category
|
||||||
2, // 1: crabs.crm.CatalogRsp.Category.children:type_name -> crabs.crm.CatalogRsp.Category
|
2, // 1: crabs.crm.Category.children:type_name -> crabs.crm.Category
|
||||||
0, // 2: crabs.crm.CRM.GetCatalog:input_type -> crabs.crm.GetCatalogReq
|
5, // 2: crabs.crm.PositionsRsp.products:type_name -> crabs.crm.Product
|
||||||
1, // 3: crabs.crm.CRM.GetCatalog:output_type -> crabs.crm.CatalogRsp
|
6, // 3: crabs.crm.Product.grouped_products:type_name -> crabs.crm.GroupedProduct
|
||||||
3, // [3:4] is the sub-list for method output_type
|
7, // 4: crabs.crm.Product.variants:type_name -> crabs.crm.Variant
|
||||||
2, // [2:3] is the sub-list for method input_type
|
9, // 5: crabs.crm.Product.characteristics:type_name -> crabs.crm.Characteristic
|
||||||
2, // [2:2] is the sub-list for extension type_name
|
8, // 6: crabs.crm.Variant.properties:type_name -> crabs.crm.Property
|
||||||
2, // [2:2] is the sub-list for extension extendee
|
0, // 7: crabs.crm.CRM.GetCatalog:input_type -> crabs.crm.GetCatalogReq
|
||||||
0, // [0:2] is the sub-list for field type_name
|
3, // 8: crabs.crm.CRM.GetPositions:input_type -> crabs.crm.GetPositionsReq
|
||||||
|
1, // 9: crabs.crm.CRM.GetCatalog:output_type -> crabs.crm.CatalogRsp
|
||||||
|
4, // 10: crabs.crm.CRM.GetPositions:output_type -> crabs.crm.PositionsRsp
|
||||||
|
9, // [9:11] is the sub-list for method output_type
|
||||||
|
7, // [7:9] is the sub-list for method input_type
|
||||||
|
7, // [7:7] is the sub-list for extension type_name
|
||||||
|
7, // [7:7] is the sub-list for extension extendee
|
||||||
|
0, // [0:7] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_main_proto_init() }
|
func init() { file_main_proto_init() }
|
||||||
|
@ -267,7 +792,91 @@ func file_main_proto_init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_main_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
file_main_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*CatalogRsp_Category); i {
|
switch v := v.(*Category); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_main_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*GetPositionsReq); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_main_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*PositionsRsp); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_main_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Product); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_main_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*GroupedProduct); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_main_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Variant); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_main_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Property); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_main_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Characteristic); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -285,7 +894,7 @@ func file_main_proto_init() {
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_main_proto_rawDesc,
|
RawDescriptor: file_main_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 3,
|
NumMessages: 10,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
|
|
|
@ -49,6 +49,58 @@ func local_request_CRM_GetCatalog_0(ctx context.Context, marshaler runtime.Marsh
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func request_CRM_GetPositions_0(ctx context.Context, marshaler runtime.Marshaler, client CRMClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var protoReq GetPositionsReq
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
var (
|
||||||
|
val string
|
||||||
|
ok bool
|
||||||
|
err error
|
||||||
|
_ = err
|
||||||
|
)
|
||||||
|
|
||||||
|
val, ok = pathParams["id"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||||
|
}
|
||||||
|
|
||||||
|
protoReq.Id, err = runtime.Int64(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := client.GetPositions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_CRM_GetPositions_0(ctx context.Context, marshaler runtime.Marshaler, server CRMServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var protoReq GetPositionsReq
|
||||||
|
var metadata runtime.ServerMetadata
|
||||||
|
|
||||||
|
var (
|
||||||
|
val string
|
||||||
|
ok bool
|
||||||
|
err error
|
||||||
|
_ = err
|
||||||
|
)
|
||||||
|
|
||||||
|
val, ok = pathParams["id"]
|
||||||
|
if !ok {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||||
|
}
|
||||||
|
|
||||||
|
protoReq.Id, err = runtime.Int64(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := server.GetPositions(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// RegisterCRMHandlerServer registers the http handlers for service CRM to "mux".
|
// RegisterCRMHandlerServer registers the http handlers for service CRM to "mux".
|
||||||
// UnaryRPC :call CRMServer directly.
|
// UnaryRPC :call CRMServer directly.
|
||||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||||
|
@ -80,6 +132,31 @@ func RegisterCRMHandlerServer(ctx context.Context, mux *runtime.ServeMux, server
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mux.Handle("GET", pattern_CRM_GetPositions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
var stream runtime.ServerTransportStream
|
||||||
|
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
var err error
|
||||||
|
var annotatedContext context.Context
|
||||||
|
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.crm.CRM/GetPositions", runtime.WithHTTPPathPattern("/positions/{id}"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := local_request_CRM_GetPositions_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||||
|
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
forward_CRM_GetPositions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,13 +220,39 @@ func RegisterCRMHandlerClient(ctx context.Context, mux *runtime.ServeMux, client
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mux.Handle("GET", pattern_CRM_GetPositions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
var err error
|
||||||
|
var annotatedContext context.Context
|
||||||
|
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/crabs.crm.CRM/GetPositions", runtime.WithHTTPPathPattern("/positions/{id}"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := request_CRM_GetPositions_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
forward_CRM_GetPositions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
pattern_CRM_GetCatalog_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"catalog"}, ""))
|
pattern_CRM_GetCatalog_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"catalog"}, ""))
|
||||||
|
|
||||||
|
pattern_CRM_GetPositions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"positions", "id"}, ""))
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
forward_CRM_GetCatalog_0 = runtime.ForwardResponseMessage
|
forward_CRM_GetCatalog_0 = runtime.ForwardResponseMessage
|
||||||
|
|
||||||
|
forward_CRM_GetPositions_0 = runtime.ForwardResponseMessage
|
||||||
)
|
)
|
||||||
|
|
|
@ -32,10 +32,52 @@
|
||||||
"CRM"
|
"CRM"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/positions/{id}": {
|
||||||
|
"get": {
|
||||||
|
"operationId": "CRM_GetPositions",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "A successful response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/crmPositionsRsp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"default": {
|
||||||
|
"description": "An unexpected error response.",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/runtimeError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"type": "string",
|
||||||
|
"format": "int64"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"CRM"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
"CatalogRspCategory": {
|
"crmCatalogRsp": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"categories": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/crmCategory"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"crmCategory": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
|
@ -51,18 +93,125 @@
|
||||||
"children": {
|
"children": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/CatalogRspCategory"
|
"$ref": "#/definitions/crmCategory"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"crmCatalogRsp": {
|
"crmCharacteristic": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"categories": {
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"crmGroupedProduct": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"uri": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"image": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"crmPositionsRsp": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"products": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/CatalogRspCategory"
|
"$ref": "#/definitions/crmProduct"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"crmProduct": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
"article": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"uri": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"images": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"grouped_products": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/crmGroupedProduct"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"unit": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"inventory": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "double"
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/crmVariant"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"characteristics": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/crmCharacteristic"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"category": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "int64"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"crmProperty": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"crmVariant": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"price": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/crmProperty"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,8 @@ import (
|
||||||
const _ = grpc.SupportPackageIsVersion7
|
const _ = grpc.SupportPackageIsVersion7
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CRM_GetCatalog_FullMethodName = "/crabs.crm.CRM/GetCatalog"
|
CRM_GetCatalog_FullMethodName = "/crabs.crm.CRM/GetCatalog"
|
||||||
|
CRM_GetPositions_FullMethodName = "/crabs.crm.CRM/GetPositions"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CRMClient is the client API for CRM service.
|
// CRMClient is the client API for CRM service.
|
||||||
|
@ -27,6 +28,7 @@ const (
|
||||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
type CRMClient interface {
|
type CRMClient interface {
|
||||||
GetCatalog(ctx context.Context, in *GetCatalogReq, opts ...grpc.CallOption) (*CatalogRsp, error)
|
GetCatalog(ctx context.Context, in *GetCatalogReq, opts ...grpc.CallOption) (*CatalogRsp, error)
|
||||||
|
GetPositions(ctx context.Context, in *GetPositionsReq, opts ...grpc.CallOption) (*PositionsRsp, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type cRMClient struct {
|
type cRMClient struct {
|
||||||
|
@ -46,11 +48,21 @@ func (c *cRMClient) GetCatalog(ctx context.Context, in *GetCatalogReq, opts ...g
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *cRMClient) GetPositions(ctx context.Context, in *GetPositionsReq, opts ...grpc.CallOption) (*PositionsRsp, error) {
|
||||||
|
out := new(PositionsRsp)
|
||||||
|
err := c.cc.Invoke(ctx, CRM_GetPositions_FullMethodName, in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// CRMServer is the server API for CRM service.
|
// CRMServer is the server API for CRM service.
|
||||||
// All implementations must embed UnimplementedCRMServer
|
// All implementations must embed UnimplementedCRMServer
|
||||||
// for forward compatibility
|
// for forward compatibility
|
||||||
type CRMServer interface {
|
type CRMServer interface {
|
||||||
GetCatalog(context.Context, *GetCatalogReq) (*CatalogRsp, error)
|
GetCatalog(context.Context, *GetCatalogReq) (*CatalogRsp, error)
|
||||||
|
GetPositions(context.Context, *GetPositionsReq) (*PositionsRsp, error)
|
||||||
mustEmbedUnimplementedCRMServer()
|
mustEmbedUnimplementedCRMServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +73,9 @@ type UnimplementedCRMServer struct {
|
||||||
func (UnimplementedCRMServer) GetCatalog(context.Context, *GetCatalogReq) (*CatalogRsp, error) {
|
func (UnimplementedCRMServer) GetCatalog(context.Context, *GetCatalogReq) (*CatalogRsp, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetCatalog not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetCatalog not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedCRMServer) GetPositions(context.Context, *GetPositionsReq) (*PositionsRsp, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetPositions not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedCRMServer) mustEmbedUnimplementedCRMServer() {}
|
func (UnimplementedCRMServer) mustEmbedUnimplementedCRMServer() {}
|
||||||
|
|
||||||
// UnsafeCRMServer may be embedded to opt out of forward compatibility for this service.
|
// UnsafeCRMServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
@ -92,6 +107,24 @@ func _CRM_GetCatalog_Handler(srv interface{}, ctx context.Context, dec func(inte
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _CRM_GetPositions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetPositionsReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(CRMServer).GetPositions(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: CRM_GetPositions_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(CRMServer).GetPositions(ctx, req.(*GetPositionsReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
// CRM_ServiceDesc is the grpc.ServiceDesc for CRM service.
|
// CRM_ServiceDesc is the grpc.ServiceDesc for CRM service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
@ -103,6 +136,10 @@ var CRM_ServiceDesc = grpc.ServiceDesc{
|
||||||
MethodName: "GetCatalog",
|
MethodName: "GetCatalog",
|
||||||
Handler: _CRM_GetCatalog_Handler,
|
Handler: _CRM_GetCatalog_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetPositions",
|
||||||
|
Handler: _CRM_GetPositions_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "main.proto",
|
Metadata: "main.proto",
|
||||||
|
|
|
@ -1,128 +0,0 @@
|
||||||
{
|
|
||||||
"products": [
|
|
||||||
{
|
|
||||||
"id": 1,
|
|
||||||
"article": "1",
|
|
||||||
"name": "\"Глаголик\" ванильно-сливочный",
|
|
||||||
"url": "/products/1",
|
|
||||||
"images": [
|
|
||||||
"/products/1/image-1-600x600.jpg",
|
|
||||||
"/products/1/image-2-600x600.jpg",
|
|
||||||
"/products/1/image-3-600x600.jpg"
|
|
||||||
],
|
|
||||||
"description": "",
|
|
||||||
"grouped_products": [
|
|
||||||
{
|
|
||||||
"name": "\"Глаголик\" лимонный",
|
|
||||||
"url": "/products/2",
|
|
||||||
"image": "/products/2/image-100x100.jpg"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "\"Глаголик\" мятный",
|
|
||||||
"url": "/products/3",
|
|
||||||
"image": "/products/3/image-100x100.jpg"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"unit": "kg",
|
|
||||||
"inventory": 100,
|
|
||||||
"variants": [
|
|
||||||
{
|
|
||||||
"price": 16500,
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "min",
|
|
||||||
"value": "0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "max",
|
|
||||||
"value": "5"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"price": 16000,
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "min",
|
|
||||||
"value": "6"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "max",
|
|
||||||
"value": "60"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"price": 15500,
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "min",
|
|
||||||
"value": "61"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"characteristics": [
|
|
||||||
{
|
|
||||||
"name": "Вкус",
|
|
||||||
"value": "Ванильно-сливочный"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"category": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 4,
|
|
||||||
"article": "4",
|
|
||||||
"name": "Пахлава ореховая экран 1,5 кг",
|
|
||||||
"url": "/products/4",
|
|
||||||
"images": [
|
|
||||||
"/products/4/image-1-600x600.jpg",
|
|
||||||
"/products/4/image-2-600x600.jpg",
|
|
||||||
"/products/4/image-3-600x600.jpg"
|
|
||||||
],
|
|
||||||
"description": "",
|
|
||||||
"grouped_products": [],
|
|
||||||
"unit": "piece",
|
|
||||||
"inventory": 100,
|
|
||||||
"variants": [
|
|
||||||
{
|
|
||||||
"price": 29000,
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "min",
|
|
||||||
"value": "0"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"characteristics": [
|
|
||||||
{
|
|
||||||
"name": "Вкус",
|
|
||||||
"value": "Ореховая"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"category": "2"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"categories": [
|
|
||||||
{
|
|
||||||
"id": 0,
|
|
||||||
"name": "Главная",
|
|
||||||
"url": "/categories/0",
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"id": 1,
|
|
||||||
"name": "Пряники",
|
|
||||||
"url": "/categories/1",
|
|
||||||
"children": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 2,
|
|
||||||
"name": "Пахлава",
|
|
||||||
"url": "/categories/2",
|
|
||||||
"children": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"article": "1",
|
||||||
|
"name": "\"Глаголик\" ванильно-сливочный",
|
||||||
|
"uri": "/products/1",
|
||||||
|
"images": [
|
||||||
|
"/products/1/image-1-600x600.jpg",
|
||||||
|
"/products/1/image-2-600x600.jpg",
|
||||||
|
"/products/1/image-3-600x600.jpg"
|
||||||
|
],
|
||||||
|
"description": "",
|
||||||
|
"grouped_products": [
|
||||||
|
{
|
||||||
|
"name": "\"Глаголик\" лимонный",
|
||||||
|
"uri": "/products/2",
|
||||||
|
"image": "/products/2/image-100x100.jpg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "\"Глаголик\" мятный",
|
||||||
|
"uri": "/products/3",
|
||||||
|
"image": "/products/3/image-100x100.jpg"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"unit": "kg",
|
||||||
|
"inventory": 100,
|
||||||
|
"variants": [
|
||||||
|
{
|
||||||
|
"price": 16500,
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "min",
|
||||||
|
"value": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "max",
|
||||||
|
"value": "5"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"price": 16000,
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "min",
|
||||||
|
"value": "6"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "max",
|
||||||
|
"value": "60"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"price": 15500,
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "min",
|
||||||
|
"value": "61"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"characteristics": [
|
||||||
|
{
|
||||||
|
"name": "Вкус",
|
||||||
|
"value": "Ванильно-сливочный"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"category": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"article": "4",
|
||||||
|
"name": "Пахлава ореховая экран 1,5 кг",
|
||||||
|
"uri": "/products/4",
|
||||||
|
"images": [
|
||||||
|
"/products/4/image-1-600x600.jpg",
|
||||||
|
"/products/4/image-2-600x600.jpg",
|
||||||
|
"/products/4/image-3-600x600.jpg"
|
||||||
|
],
|
||||||
|
"description": "",
|
||||||
|
"grouped_products": [],
|
||||||
|
"unit": "piece",
|
||||||
|
"inventory": 100,
|
||||||
|
"variants": [
|
||||||
|
{
|
||||||
|
"price": 29000,
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "min",
|
||||||
|
"value": "0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"characteristics": [
|
||||||
|
{
|
||||||
|
"name": "Вкус",
|
||||||
|
"value": "Ореховая"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"category": 2
|
||||||
|
}
|
||||||
|
]
|
Loading…
Reference in New Issue