@barumetric/contracts 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gen/ts/categories.ts +4 -45
- package/package.json +2 -2
- package/proto/categories.proto +17 -31
package/gen/ts/categories.ts
CHANGED
|
@@ -11,7 +11,6 @@ import { Empty } from "./google/protobuf/empty";
|
|
|
11
11
|
|
|
12
12
|
export const protobufPackage = "categories.v1";
|
|
13
13
|
|
|
14
|
-
/** Типы атрибутов */
|
|
15
14
|
export enum AttributeType {
|
|
16
15
|
ATTRIBUTE_TYPE_UNSPECIFIED = 0,
|
|
17
16
|
ATTRIBUTE_TYPE_STRING = 1,
|
|
@@ -28,20 +27,13 @@ export enum AttributeType {
|
|
|
28
27
|
|
|
29
28
|
export interface GetCategoryRequest {
|
|
30
29
|
id: string;
|
|
31
|
-
/** Включить атрибуты */
|
|
32
30
|
includeAttributes: boolean;
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
export interface GetCategoryAttributesRequest {
|
|
36
|
-
|
|
37
|
-
categoryId: string;
|
|
38
|
-
/** Только фильтруемые атрибуты (для фильтров на фронте) */
|
|
39
|
-
onlyFilterable: boolean;
|
|
40
|
-
/** Включить наследуемые атрибуты от родительских категорий */
|
|
41
|
-
includeInherited: boolean;
|
|
34
|
+
id: string;
|
|
42
35
|
}
|
|
43
36
|
|
|
44
|
-
/** Ответы */
|
|
45
37
|
export interface GetAllCategoriesResponse {
|
|
46
38
|
categories: Category[];
|
|
47
39
|
}
|
|
@@ -68,44 +60,23 @@ export interface Category {
|
|
|
68
60
|
path: string;
|
|
69
61
|
depth: number;
|
|
70
62
|
adsCount: number;
|
|
71
|
-
/** Для дерева */
|
|
72
63
|
children: Category[];
|
|
73
|
-
/** Если include_attributes = true */
|
|
74
64
|
attributes: CategoryAttribute[];
|
|
75
65
|
}
|
|
76
66
|
|
|
77
67
|
export interface CategoryAttribute {
|
|
78
|
-
/** ID CategoryAttribute (связи) */
|
|
79
68
|
id: string;
|
|
80
|
-
/** ID категории */
|
|
81
69
|
categoryId: string;
|
|
82
|
-
/** Название из глобального Attribute */
|
|
83
70
|
name: string;
|
|
84
|
-
/** Ключ из глобального Attribute */
|
|
85
71
|
key: string;
|
|
86
|
-
/** Тип из глобального Attribute */
|
|
87
72
|
type: AttributeType;
|
|
88
|
-
/** Финальное значение (override или default из Attribute) */
|
|
89
73
|
isRequired: boolean;
|
|
90
|
-
/** Финальное значение (override или default из Attribute) */
|
|
91
74
|
isFilterable: boolean;
|
|
92
|
-
/** Наследуется ли дочерним категориям */
|
|
93
75
|
inherited: boolean;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
| undefined;
|
|
98
|
-
/** Минимальное значение из глобального Attribute */
|
|
99
|
-
minValue?:
|
|
100
|
-
| number
|
|
101
|
-
| undefined;
|
|
102
|
-
/** Максимальное значение из глобального Attribute */
|
|
103
|
-
maxValue?:
|
|
104
|
-
| number
|
|
105
|
-
| undefined;
|
|
106
|
-
/** Порядок сортировки в категории */
|
|
76
|
+
unit?: string | undefined;
|
|
77
|
+
minValue?: number | undefined;
|
|
78
|
+
maxValue?: number | undefined;
|
|
107
79
|
sortOrder: number;
|
|
108
|
-
/** Значения из глобального Attribute */
|
|
109
80
|
enumValues: EnumValue[];
|
|
110
81
|
}
|
|
111
82
|
|
|
@@ -125,34 +96,22 @@ export interface EnumValueInput {
|
|
|
125
96
|
export const CATEGORIES_V1_PACKAGE_NAME = "categories.v1";
|
|
126
97
|
|
|
127
98
|
export interface CategoriesServiceClient {
|
|
128
|
-
/** Получить все категории */
|
|
129
|
-
|
|
130
99
|
getAllCategories(request: Empty): Observable<GetAllCategoriesResponse>;
|
|
131
100
|
|
|
132
|
-
/** Получить категорию по ID */
|
|
133
|
-
|
|
134
101
|
getCategory(request: GetCategoryRequest): Observable<GetCategoryResponse>;
|
|
135
102
|
|
|
136
|
-
/** Получить атрибуты категории (для фильтрации) */
|
|
137
|
-
|
|
138
103
|
getCategoryAttributes(request: GetCategoryAttributesRequest): Observable<GetCategoryAttributesResponse>;
|
|
139
104
|
}
|
|
140
105
|
|
|
141
106
|
export interface CategoriesServiceController {
|
|
142
|
-
/** Получить все категории */
|
|
143
|
-
|
|
144
107
|
getAllCategories(
|
|
145
108
|
request: Empty,
|
|
146
109
|
): Promise<GetAllCategoriesResponse> | Observable<GetAllCategoriesResponse> | GetAllCategoriesResponse;
|
|
147
110
|
|
|
148
|
-
/** Получить категорию по ID */
|
|
149
|
-
|
|
150
111
|
getCategory(
|
|
151
112
|
request: GetCategoryRequest,
|
|
152
113
|
): Promise<GetCategoryResponse> | Observable<GetCategoryResponse> | GetCategoryResponse;
|
|
153
114
|
|
|
154
|
-
/** Получить атрибуты категории (для фильтрации) */
|
|
155
|
-
|
|
156
115
|
getCategoryAttributes(
|
|
157
116
|
request: GetCategoryAttributesRequest,
|
|
158
117
|
): Promise<GetCategoryAttributesResponse> | Observable<GetCategoryAttributesResponse> | GetCategoryAttributesResponse;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barumetric/contracts",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Protobuf definitions and generated TypeScript types",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
"dist",
|
|
13
13
|
"proto",
|
|
14
14
|
"gen"
|
|
15
|
-
|
|
16
15
|
],
|
|
17
16
|
"publishConfig": {
|
|
18
17
|
"access": "public"
|
|
19
18
|
},
|
|
20
19
|
"dependencies": {
|
|
20
|
+
"@barumetric/contracts": "^1.2.3",
|
|
21
21
|
"@nestjs/microservices": "^11.1.9",
|
|
22
22
|
"rxjs": "^7.8.2",
|
|
23
23
|
"ts-proto": "^2.8.3"
|
package/proto/categories.proto
CHANGED
|
@@ -5,28 +5,20 @@ package categories.v1;
|
|
|
5
5
|
import "google/protobuf/empty.proto";
|
|
6
6
|
|
|
7
7
|
service CategoriesService {
|
|
8
|
-
// Получить все категории
|
|
9
8
|
rpc GetAllCategories (google.protobuf.Empty) returns (GetAllCategoriesResponse);
|
|
10
|
-
|
|
11
|
-
// Получить категорию по ID
|
|
12
9
|
rpc GetCategory (GetCategoryRequest) returns (GetCategoryResponse);
|
|
13
|
-
|
|
14
|
-
// Получить атрибуты категории (для фильтрации)
|
|
15
10
|
rpc GetCategoryAttributes (GetCategoryAttributesRequest) returns (GetCategoryAttributesResponse);
|
|
16
11
|
}
|
|
17
12
|
|
|
18
13
|
message GetCategoryRequest {
|
|
19
14
|
string id = 1;
|
|
20
|
-
bool include_attributes = 2;
|
|
15
|
+
bool include_attributes = 2;
|
|
21
16
|
}
|
|
22
17
|
|
|
23
18
|
message GetCategoryAttributesRequest {
|
|
24
|
-
string
|
|
25
|
-
bool only_filterable = 2; // Только фильтруемые атрибуты (для фильтров на фронте)
|
|
26
|
-
bool include_inherited = 3; // Включить наследуемые атрибуты от родительских категорий
|
|
19
|
+
string id = 1;
|
|
27
20
|
}
|
|
28
21
|
|
|
29
|
-
// Ответы
|
|
30
22
|
message GetAllCategoriesResponse {
|
|
31
23
|
repeated Category categories = 1;
|
|
32
24
|
}
|
|
@@ -39,8 +31,6 @@ message GetCategoryAttributesResponse {
|
|
|
39
31
|
repeated CategoryAttribute attributes = 1;
|
|
40
32
|
}
|
|
41
33
|
|
|
42
|
-
// Модели
|
|
43
|
-
|
|
44
34
|
message Category {
|
|
45
35
|
string id = 1;
|
|
46
36
|
string name = 2;
|
|
@@ -55,24 +45,24 @@ message Category {
|
|
|
55
45
|
string path = 11;
|
|
56
46
|
int32 depth = 12;
|
|
57
47
|
int64 ads_count = 13;
|
|
58
|
-
repeated Category children = 14;
|
|
59
|
-
repeated CategoryAttribute attributes = 15;
|
|
48
|
+
repeated Category children = 14;
|
|
49
|
+
repeated CategoryAttribute attributes = 15;
|
|
60
50
|
}
|
|
61
51
|
|
|
62
52
|
message CategoryAttribute {
|
|
63
|
-
string id = 1;
|
|
64
|
-
string category_id = 2;
|
|
65
|
-
string name = 3;
|
|
66
|
-
string key = 4;
|
|
67
|
-
AttributeType type = 5;
|
|
68
|
-
bool is_required = 6;
|
|
69
|
-
bool is_filterable = 7;
|
|
70
|
-
bool inherited = 8;
|
|
71
|
-
optional string unit = 9;
|
|
72
|
-
optional float min_value = 10;
|
|
73
|
-
optional float max_value = 11;
|
|
74
|
-
int32 sort_order = 12;
|
|
75
|
-
repeated EnumValue enum_values = 13;
|
|
53
|
+
string id = 1;
|
|
54
|
+
string category_id = 2;
|
|
55
|
+
string name = 3;
|
|
56
|
+
string key = 4;
|
|
57
|
+
AttributeType type = 5;
|
|
58
|
+
bool is_required = 6;
|
|
59
|
+
bool is_filterable = 7;
|
|
60
|
+
bool inherited = 8;
|
|
61
|
+
optional string unit = 9;
|
|
62
|
+
optional float min_value = 10;
|
|
63
|
+
optional float max_value = 11;
|
|
64
|
+
int32 sort_order = 12;
|
|
65
|
+
repeated EnumValue enum_values = 13;
|
|
76
66
|
}
|
|
77
67
|
|
|
78
68
|
message EnumValue {
|
|
@@ -88,7 +78,6 @@ message EnumValueInput {
|
|
|
88
78
|
int32 sort_order = 3;
|
|
89
79
|
}
|
|
90
80
|
|
|
91
|
-
// Типы атрибутов
|
|
92
81
|
enum AttributeType {
|
|
93
82
|
ATTRIBUTE_TYPE_UNSPECIFIED = 0;
|
|
94
83
|
ATTRIBUTE_TYPE_STRING = 1;
|
|
@@ -101,6 +90,3 @@ enum AttributeType {
|
|
|
101
90
|
ATTRIBUTE_TYPE_RANGE = 8;
|
|
102
91
|
ATTRIBUTE_TYPE_DATE = 9;
|
|
103
92
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|