@barumetric/contracts 1.1.9 → 1.2.0

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.
@@ -49,18 +49,6 @@ export interface GetCategoryBySlugRequest {
49
49
  includeAttributes: boolean;
50
50
  }
51
51
 
52
- export interface GetChildrenRequest {
53
- parentId: string;
54
- onlyActive: boolean;
55
- }
56
-
57
- export interface GetPopularRequest {
58
- /** Количество категорий */
59
- limit: number;
60
- /** Популярные в конкретной категории */
61
- parentId?: string | undefined;
62
- }
63
-
64
52
  export interface GetAttributesRequest {
65
53
  categoryId: string;
66
54
  /** Только для фильтров */
@@ -99,53 +87,73 @@ export interface DeleteCategoryRequest {
99
87
  }
100
88
 
101
89
  export interface CreateAttributeRequest {
90
+ /** Категория, к которой привязываем атрибут */
102
91
  categoryId: string;
92
+ /** Название атрибута */
103
93
  name: string;
94
+ /** Глобальный ключ (если атрибут с таким key уже существует, он будет переиспользован) */
104
95
  key: string;
105
96
  type: AttributeType;
106
- isRequired: boolean;
107
- isFilterable: boolean;
97
+ /** Override для категории (null = использовать default из Attribute) */
98
+ isRequired?:
99
+ | boolean
100
+ | undefined;
101
+ /** Override для категории (null = использовать default из Attribute) */
102
+ isFilterable?:
103
+ | boolean
104
+ | undefined;
105
+ /** Наследуется ли атрибут дочерним категориям */
108
106
  inherited: boolean;
109
- unit?: string | undefined;
110
- minValue?: number | undefined;
111
- maxValue?: number | undefined;
107
+ /** Единица измерения (₽, км и т.д.) */
108
+ unit?:
109
+ | string
110
+ | undefined;
111
+ /** Минимальное значение */
112
+ minValue?:
113
+ | number
114
+ | undefined;
115
+ /** Максимальное значение */
116
+ maxValue?:
117
+ | number
118
+ | undefined;
119
+ /** Порядок сортировки в категории */
112
120
  sortOrder: number;
113
- /** Для ENUM/MULTI_ENUM типов */
121
+ /** Для ENUM/MULTI_ENUM типов (создаются только если атрибут новый) */
114
122
  enumValues: EnumValueInput[];
115
123
  }
116
124
 
117
125
  export interface UpdateAttributeRequest {
126
+ /** ID CategoryAttribute (связи) */
118
127
  id: string;
119
- name?: string | undefined;
120
- isRequired?: boolean | undefined;
121
- isFilterable?: boolean | undefined;
122
- unit?: string | undefined;
123
- minValue?: number | undefined;
124
- maxValue?: number | undefined;
125
- sortOrder?: number | undefined;
128
+ /** Override для категории (null = использовать default из Attribute) */
129
+ isRequired?:
130
+ | boolean
131
+ | undefined;
132
+ /** Override для категории (null = использовать default из Attribute) */
133
+ isFilterable?:
134
+ | boolean
135
+ | undefined;
136
+ /** Порядок сортировки в категории */
137
+ sortOrder?:
138
+ | number
139
+ | undefined;
140
+ /** Обновить enum values глобального атрибута */
126
141
  enumValues: EnumValueInput[];
127
142
  }
128
143
 
129
144
  export interface DeleteAttributeRequest {
145
+ /** ID CategoryAttribute (связи) - удаляется только связь, глобальный Attribute остается */
130
146
  id: string;
131
147
  }
132
148
 
133
149
  export interface GetTreeResponse {
134
- nodes: CategoryNode[];
150
+ categories: Category[];
135
151
  }
136
152
 
137
153
  export interface GetCategoryResponse {
138
154
  category: Category | undefined;
139
155
  }
140
156
 
141
- export interface GetChildrenResponse {
142
- categories: Category[];
143
- }
144
-
145
- export interface GetPopularResponse {
146
- categories: Category[];
147
- }
148
-
149
157
  export interface GetAttributesResponse {
150
158
  attributes: CategoryAttribute[];
151
159
  }
@@ -194,24 +202,38 @@ export interface Category {
194
202
  attributes: CategoryAttribute[];
195
203
  }
196
204
 
197
- export interface CategoryNode {
198
- category: Category | undefined;
199
- children: CategoryNode[];
200
- }
201
-
202
205
  export interface CategoryAttribute {
206
+ /** ID CategoryAttribute (связи) */
203
207
  id: string;
208
+ /** ID категории */
204
209
  categoryId: string;
210
+ /** Название из глобального Attribute */
205
211
  name: string;
212
+ /** Ключ из глобального Attribute */
206
213
  key: string;
214
+ /** Тип из глобального Attribute */
207
215
  type: AttributeType;
216
+ /** Финальное значение (override или default из Attribute) */
208
217
  isRequired: boolean;
218
+ /** Финальное значение (override или default из Attribute) */
209
219
  isFilterable: boolean;
220
+ /** Наследуется ли дочерним категориям */
210
221
  inherited: boolean;
211
- unit?: string | undefined;
212
- minValue?: number | undefined;
213
- maxValue?: number | undefined;
222
+ /** Единица измерения из глобального Attribute */
223
+ unit?:
224
+ | string
225
+ | undefined;
226
+ /** Минимальное значение из глобального Attribute */
227
+ minValue?:
228
+ | number
229
+ | undefined;
230
+ /** Максимальное значение из глобального Attribute */
231
+ maxValue?:
232
+ | number
233
+ | undefined;
234
+ /** Порядок сортировки в категории */
214
235
  sortOrder: number;
236
+ /** Значения из глобального Attribute */
215
237
  enumValues: EnumValue[];
216
238
  }
217
239
 
@@ -243,14 +265,6 @@ export interface CategoriesServiceClient {
243
265
 
244
266
  getCategoryBySlug(request: GetCategoryBySlugRequest): Observable<GetCategoryResponse>;
245
267
 
246
- /** Получить дочерние категории */
247
-
248
- getChildren(request: GetChildrenRequest): Observable<GetChildrenResponse>;
249
-
250
- /** Получить популярные категории */
251
-
252
- getPopular(request: GetPopularRequest): Observable<GetPopularResponse>;
253
-
254
268
  /** Получить атрибуты категории (для фильтров) */
255
269
 
256
270
  getAttributes(request: GetAttributesRequest): Observable<GetAttributesResponse>;
@@ -297,18 +311,6 @@ export interface CategoriesServiceController {
297
311
  request: GetCategoryBySlugRequest,
298
312
  ): Promise<GetCategoryResponse> | Observable<GetCategoryResponse> | GetCategoryResponse;
299
313
 
300
- /** Получить дочерние категории */
301
-
302
- getChildren(
303
- request: GetChildrenRequest,
304
- ): Promise<GetChildrenResponse> | Observable<GetChildrenResponse> | GetChildrenResponse;
305
-
306
- /** Получить популярные категории */
307
-
308
- getPopular(
309
- request: GetPopularRequest,
310
- ): Promise<GetPopularResponse> | Observable<GetPopularResponse> | GetPopularResponse;
311
-
312
314
  /** Получить атрибуты категории (для фильтров) */
313
315
 
314
316
  getAttributes(
@@ -358,8 +360,6 @@ export function CategoriesServiceControllerMethods() {
358
360
  "getTree",
359
361
  "getCategory",
360
362
  "getCategoryBySlug",
361
- "getChildren",
362
- "getPopular",
363
363
  "getAttributes",
364
364
  "createCategory",
365
365
  "updateCategory",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barumetric/contracts",
3
- "version": "1.1.9",
3
+ "version": "1.2.0",
4
4
  "description": "Protobuf definitions and generated TypeScript types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -14,12 +14,6 @@ service CategoriesService {
14
14
  // Получить категорию по slug
15
15
  rpc GetCategoryBySlug (GetCategoryBySlugRequest) returns (GetCategoryResponse);
16
16
 
17
- // Получить дочерние категории
18
- rpc GetChildren (GetChildrenRequest) returns (GetChildrenResponse);
19
-
20
- // Получить популярные категории
21
- rpc GetPopular (GetPopularRequest) returns (GetPopularResponse);
22
-
23
17
  // Получить атрибуты категории (для фильтров)
24
18
  rpc GetAttributes (GetAttributesRequest) returns (GetAttributesResponse);
25
19
 
@@ -61,16 +55,6 @@ message GetCategoryBySlugRequest {
61
55
  bool include_attributes = 3;
62
56
  }
63
57
 
64
- message GetChildrenRequest {
65
- string parent_id = 1;
66
- bool only_active = 2;
67
- }
68
-
69
- message GetPopularRequest {
70
- int32 limit = 1; // Количество категорий
71
- optional string parent_id = 2; // Популярные в конкретной категории
72
- }
73
-
74
58
  message GetAttributesRequest {
75
59
  string category_id = 1;
76
60
  bool only_filterable = 2; // Только для фильтров
@@ -106,54 +90,42 @@ message DeleteCategoryRequest {
106
90
  }
107
91
 
108
92
  message CreateAttributeRequest {
109
- string category_id = 1;
110
- string name = 2;
111
- string key = 3;
93
+ string category_id = 1; // Категория, к которой привязываем атрибут
94
+ string name = 2; // Название атрибута
95
+ string key = 3; // Глобальный ключ (если атрибут с таким key уже существует, он будет переиспользован)
112
96
  AttributeType type = 4;
113
- bool is_required = 5;
114
- bool is_filterable = 6;
115
- bool inherited = 7;
116
- optional string unit = 8;
117
- optional float min_value = 9;
118
- optional float max_value = 10;
119
- int32 sort_order = 11;
120
- repeated EnumValueInput enum_values = 12; // Для ENUM/MULTI_ENUM типов
97
+ optional bool is_required = 5; // Override для категории (null = использовать default из Attribute)
98
+ optional bool is_filterable = 6; // Override для категории (null = использовать default из Attribute)
99
+ bool inherited = 7; // Наследуется ли атрибут дочерним категориям
100
+ optional string unit = 8; // Единица измерения (₽, км и т.д.)
101
+ optional float min_value = 9; // Минимальное значение
102
+ optional float max_value = 10; // Максимальное значение
103
+ int32 sort_order = 11; // Порядок сортировки в категории
104
+ repeated EnumValueInput enum_values = 12; // Для ENUM/MULTI_ENUM типов (создаются только если атрибут новый)
121
105
  }
122
106
 
123
107
  message UpdateAttributeRequest {
124
- string id = 1;
125
- optional string name = 2;
126
- optional bool is_required = 3;
127
- optional bool is_filterable = 4;
128
- optional string unit = 5;
129
- optional float min_value = 6;
130
- optional float max_value = 7;
131
- optional int32 sort_order = 8;
132
- repeated EnumValueInput enum_values = 9;
108
+ string id = 1; // ID CategoryAttribute (связи)
109
+ optional bool is_required = 2; // Override для категории (null = использовать default из Attribute)
110
+ optional bool is_filterable = 3; // Override для категории (null = использовать default из Attribute)
111
+ optional int32 sort_order = 4; // Порядок сортировки в категории
112
+ repeated EnumValueInput enum_values = 5; // Обновить enum values глобального атрибута
133
113
  }
134
114
 
135
115
  message DeleteAttributeRequest {
136
- string id = 1;
116
+ string id = 1; // ID CategoryAttribute (связи) - удаляется только связь, глобальный Attribute остается
137
117
  }
138
118
 
139
119
  // Ответы
140
120
 
141
121
  message GetTreeResponse {
142
- repeated CategoryNode nodes = 1;
122
+ repeated Category categories = 1;
143
123
  }
144
124
 
145
125
  message GetCategoryResponse {
146
126
  Category category = 1;
147
127
  }
148
128
 
149
- message GetChildrenResponse {
150
- repeated Category categories = 1;
151
- }
152
-
153
- message GetPopularResponse {
154
- repeated Category categories = 1;
155
- }
156
-
157
129
  message GetAttributesResponse {
158
130
  repeated CategoryAttribute attributes = 1;
159
131
  }
@@ -202,25 +174,20 @@ message Category {
202
174
  repeated CategoryAttribute attributes = 15; // Если include_attributes = true
203
175
  }
204
176
 
205
- message CategoryNode {
206
- Category category = 1;
207
- repeated CategoryNode children = 2;
208
- }
209
-
210
177
  message CategoryAttribute {
211
- string id = 1;
212
- string category_id = 2;
213
- string name = 3;
214
- string key = 4;
215
- AttributeType type = 5;
216
- bool is_required = 6;
217
- bool is_filterable = 7;
218
- bool inherited = 8;
219
- optional string unit = 9;
220
- optional float min_value = 10;
221
- optional float max_value = 11;
222
- int32 sort_order = 12;
223
- repeated EnumValue enum_values = 13;
178
+ string id = 1; // ID CategoryAttribute (связи)
179
+ string category_id = 2; // ID категории
180
+ string name = 3; // Название из глобального Attribute
181
+ string key = 4; // Ключ из глобального Attribute
182
+ AttributeType type = 5; // Тип из глобального Attribute
183
+ bool is_required = 6; // Финальное значение (override или default из Attribute)
184
+ bool is_filterable = 7; // Финальное значение (override или default из Attribute)
185
+ bool inherited = 8; // Наследуется ли дочерним категориям
186
+ optional string unit = 9; // Единица измерения из глобального Attribute
187
+ optional float min_value = 10; // Минимальное значение из глобального Attribute
188
+ optional float max_value = 11; // Максимальное значение из глобального Attribute
189
+ int32 sort_order = 12; // Порядок сортировки в категории
190
+ repeated EnumValue enum_values = 13; // Значения из глобального Attribute
224
191
  }
225
192
 
226
193
  message EnumValue {
@@ -250,3 +217,5 @@ enum AttributeType {
250
217
  ATTRIBUTE_TYPE_DATE = 9;
251
218
  }
252
219
 
220
+
221
+