@barumetric/contracts 1.2.1 → 1.2.2
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 +2 -235
- package/package.json +1 -1
- package/proto/categories.proto +0 -128
package/gen/ts/categories.ts
CHANGED
|
@@ -26,127 +26,13 @@ export enum AttributeType {
|
|
|
26
26
|
UNRECOGNIZED = -1,
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export interface GetTreeRequest {
|
|
30
|
-
/** Если не указан, возвращает корневые категории */
|
|
31
|
-
parentId?:
|
|
32
|
-
| string
|
|
33
|
-
| undefined;
|
|
34
|
-
/** Максимальная глубина (0 = без ограничений) */
|
|
35
|
-
maxDepth: number;
|
|
36
|
-
/** Только активные категории */
|
|
37
|
-
onlyActive: boolean;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
29
|
export interface GetCategoryRequest {
|
|
41
30
|
id: string;
|
|
42
31
|
/** Включить атрибуты */
|
|
43
32
|
includeAttributes: boolean;
|
|
44
33
|
}
|
|
45
34
|
|
|
46
|
-
|
|
47
|
-
slug: string;
|
|
48
|
-
/** Для уникальности */
|
|
49
|
-
parentId?: string | undefined;
|
|
50
|
-
includeAttributes: boolean;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface GetAttributesRequest {
|
|
54
|
-
categoryId: string;
|
|
55
|
-
/** Только для фильтров */
|
|
56
|
-
onlyFilterable: boolean;
|
|
57
|
-
/** Включить наследуемые от родителей */
|
|
58
|
-
includeInherited: boolean;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface CreateCategoryRequest {
|
|
62
|
-
name: string;
|
|
63
|
-
slug: string;
|
|
64
|
-
description?: string | undefined;
|
|
65
|
-
iconUrl?: string | undefined;
|
|
66
|
-
bannerUrl?: string | undefined;
|
|
67
|
-
parentId?: string | undefined;
|
|
68
|
-
isLeaf: boolean;
|
|
69
|
-
sortOrder: number;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface UpdateCategoryRequest {
|
|
73
|
-
id: string;
|
|
74
|
-
name?: string | undefined;
|
|
75
|
-
slug?: string | undefined;
|
|
76
|
-
description?: string | undefined;
|
|
77
|
-
iconUrl?: string | undefined;
|
|
78
|
-
bannerUrl?: string | undefined;
|
|
79
|
-
isLeaf?: boolean | undefined;
|
|
80
|
-
isActive?: boolean | undefined;
|
|
81
|
-
sortOrder?: number | undefined;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface DeleteCategoryRequest {
|
|
85
|
-
id: string;
|
|
86
|
-
/** Удалить дочерние категории */
|
|
87
|
-
cascade: boolean;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface CreateAttributeRequest {
|
|
91
|
-
/** Категория, к которой привязываем атрибут */
|
|
92
|
-
categoryId: string;
|
|
93
|
-
/** Название атрибута */
|
|
94
|
-
name: string;
|
|
95
|
-
/** Глобальный ключ (если атрибут с таким key уже существует, он будет переиспользован) */
|
|
96
|
-
key: string;
|
|
97
|
-
type: AttributeType;
|
|
98
|
-
/** Override для категории (null = использовать default из Attribute) */
|
|
99
|
-
isRequired?:
|
|
100
|
-
| boolean
|
|
101
|
-
| undefined;
|
|
102
|
-
/** Override для категории (null = использовать default из Attribute) */
|
|
103
|
-
isFilterable?:
|
|
104
|
-
| boolean
|
|
105
|
-
| undefined;
|
|
106
|
-
/** Наследуется ли атрибут дочерним категориям */
|
|
107
|
-
inherited: boolean;
|
|
108
|
-
/** Единица измерения (₽, км и т.д.) */
|
|
109
|
-
unit?:
|
|
110
|
-
| string
|
|
111
|
-
| undefined;
|
|
112
|
-
/** Минимальное значение */
|
|
113
|
-
minValue?:
|
|
114
|
-
| number
|
|
115
|
-
| undefined;
|
|
116
|
-
/** Максимальное значение */
|
|
117
|
-
maxValue?:
|
|
118
|
-
| number
|
|
119
|
-
| undefined;
|
|
120
|
-
/** Порядок сортировки в категории */
|
|
121
|
-
sortOrder: number;
|
|
122
|
-
/** Для ENUM/MULTI_ENUM типов (создаются только если атрибут новый) */
|
|
123
|
-
enumValues: EnumValueInput[];
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export interface UpdateAttributeRequest {
|
|
127
|
-
/** ID CategoryAttribute (связи) */
|
|
128
|
-
id: string;
|
|
129
|
-
/** Override для категории (null = использовать default из Attribute) */
|
|
130
|
-
isRequired?:
|
|
131
|
-
| boolean
|
|
132
|
-
| undefined;
|
|
133
|
-
/** Override для категории (null = использовать default из Attribute) */
|
|
134
|
-
isFilterable?:
|
|
135
|
-
| boolean
|
|
136
|
-
| undefined;
|
|
137
|
-
/** Порядок сортировки в категории */
|
|
138
|
-
sortOrder?:
|
|
139
|
-
| number
|
|
140
|
-
| undefined;
|
|
141
|
-
/** Обновить enum values глобального атрибута */
|
|
142
|
-
enumValues: EnumValueInput[];
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export interface DeleteAttributeRequest {
|
|
146
|
-
/** ID CategoryAttribute (связи) - удаляется только связь, глобальный Attribute остается */
|
|
147
|
-
id: string;
|
|
148
|
-
}
|
|
149
|
-
|
|
35
|
+
/** Ответы */
|
|
150
36
|
export interface GetAllCategoriesResponse {
|
|
151
37
|
categories: Category[];
|
|
152
38
|
}
|
|
@@ -155,34 +41,6 @@ export interface GetCategoryResponse {
|
|
|
155
41
|
category: Category | undefined;
|
|
156
42
|
}
|
|
157
43
|
|
|
158
|
-
export interface GetAttributesResponse {
|
|
159
|
-
attributes: CategoryAttribute[];
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export interface CreateCategoryResponse {
|
|
163
|
-
category: Category | undefined;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export interface UpdateCategoryResponse {
|
|
167
|
-
category: Category | undefined;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export interface DeleteCategoryResponse {
|
|
171
|
-
ok: boolean;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export interface CreateAttributeResponse {
|
|
175
|
-
attribute: CategoryAttribute | undefined;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export interface UpdateAttributeResponse {
|
|
179
|
-
attribute: CategoryAttribute | undefined;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export interface DeleteAttributeResponse {
|
|
183
|
-
ok: boolean;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
44
|
export interface Category {
|
|
187
45
|
id: string;
|
|
188
46
|
name: string;
|
|
@@ -261,38 +119,6 @@ export interface CategoriesServiceClient {
|
|
|
261
119
|
/** Получить категорию по ID */
|
|
262
120
|
|
|
263
121
|
getCategory(request: GetCategoryRequest): Observable<GetCategoryResponse>;
|
|
264
|
-
|
|
265
|
-
/** Получить категорию по slug */
|
|
266
|
-
|
|
267
|
-
getCategoryBySlug(request: GetCategoryBySlugRequest): Observable<GetCategoryResponse>;
|
|
268
|
-
|
|
269
|
-
/** Получить атрибуты категории (для фильтров) */
|
|
270
|
-
|
|
271
|
-
getAttributes(request: GetAttributesRequest): Observable<GetAttributesResponse>;
|
|
272
|
-
|
|
273
|
-
/** Создать категорию (админ) */
|
|
274
|
-
|
|
275
|
-
createCategory(request: CreateCategoryRequest): Observable<CreateCategoryResponse>;
|
|
276
|
-
|
|
277
|
-
/** Обновить категорию (админ) */
|
|
278
|
-
|
|
279
|
-
updateCategory(request: UpdateCategoryRequest): Observable<UpdateCategoryResponse>;
|
|
280
|
-
|
|
281
|
-
/** Удалить категорию (админ) */
|
|
282
|
-
|
|
283
|
-
deleteCategory(request: DeleteCategoryRequest): Observable<DeleteCategoryResponse>;
|
|
284
|
-
|
|
285
|
-
/** Создать атрибут (админ) */
|
|
286
|
-
|
|
287
|
-
createAttribute(request: CreateAttributeRequest): Observable<CreateAttributeResponse>;
|
|
288
|
-
|
|
289
|
-
/** Обновить атрибут (админ) */
|
|
290
|
-
|
|
291
|
-
updateAttribute(request: UpdateAttributeRequest): Observable<UpdateAttributeResponse>;
|
|
292
|
-
|
|
293
|
-
/** Удалить атрибут (админ) */
|
|
294
|
-
|
|
295
|
-
deleteAttribute(request: DeleteAttributeRequest): Observable<DeleteAttributeResponse>;
|
|
296
122
|
}
|
|
297
123
|
|
|
298
124
|
export interface CategoriesServiceController {
|
|
@@ -307,70 +133,11 @@ export interface CategoriesServiceController {
|
|
|
307
133
|
getCategory(
|
|
308
134
|
request: GetCategoryRequest,
|
|
309
135
|
): Promise<GetCategoryResponse> | Observable<GetCategoryResponse> | GetCategoryResponse;
|
|
310
|
-
|
|
311
|
-
/** Получить категорию по slug */
|
|
312
|
-
|
|
313
|
-
getCategoryBySlug(
|
|
314
|
-
request: GetCategoryBySlugRequest,
|
|
315
|
-
): Promise<GetCategoryResponse> | Observable<GetCategoryResponse> | GetCategoryResponse;
|
|
316
|
-
|
|
317
|
-
/** Получить атрибуты категории (для фильтров) */
|
|
318
|
-
|
|
319
|
-
getAttributes(
|
|
320
|
-
request: GetAttributesRequest,
|
|
321
|
-
): Promise<GetAttributesResponse> | Observable<GetAttributesResponse> | GetAttributesResponse;
|
|
322
|
-
|
|
323
|
-
/** Создать категорию (админ) */
|
|
324
|
-
|
|
325
|
-
createCategory(
|
|
326
|
-
request: CreateCategoryRequest,
|
|
327
|
-
): Promise<CreateCategoryResponse> | Observable<CreateCategoryResponse> | CreateCategoryResponse;
|
|
328
|
-
|
|
329
|
-
/** Обновить категорию (админ) */
|
|
330
|
-
|
|
331
|
-
updateCategory(
|
|
332
|
-
request: UpdateCategoryRequest,
|
|
333
|
-
): Promise<UpdateCategoryResponse> | Observable<UpdateCategoryResponse> | UpdateCategoryResponse;
|
|
334
|
-
|
|
335
|
-
/** Удалить категорию (админ) */
|
|
336
|
-
|
|
337
|
-
deleteCategory(
|
|
338
|
-
request: DeleteCategoryRequest,
|
|
339
|
-
): Promise<DeleteCategoryResponse> | Observable<DeleteCategoryResponse> | DeleteCategoryResponse;
|
|
340
|
-
|
|
341
|
-
/** Создать атрибут (админ) */
|
|
342
|
-
|
|
343
|
-
createAttribute(
|
|
344
|
-
request: CreateAttributeRequest,
|
|
345
|
-
): Promise<CreateAttributeResponse> | Observable<CreateAttributeResponse> | CreateAttributeResponse;
|
|
346
|
-
|
|
347
|
-
/** Обновить атрибут (админ) */
|
|
348
|
-
|
|
349
|
-
updateAttribute(
|
|
350
|
-
request: UpdateAttributeRequest,
|
|
351
|
-
): Promise<UpdateAttributeResponse> | Observable<UpdateAttributeResponse> | UpdateAttributeResponse;
|
|
352
|
-
|
|
353
|
-
/** Удалить атрибут (админ) */
|
|
354
|
-
|
|
355
|
-
deleteAttribute(
|
|
356
|
-
request: DeleteAttributeRequest,
|
|
357
|
-
): Promise<DeleteAttributeResponse> | Observable<DeleteAttributeResponse> | DeleteAttributeResponse;
|
|
358
136
|
}
|
|
359
137
|
|
|
360
138
|
export function CategoriesServiceControllerMethods() {
|
|
361
139
|
return function (constructor: Function) {
|
|
362
|
-
const grpcMethods: string[] = [
|
|
363
|
-
"getAllCategories",
|
|
364
|
-
"getCategory",
|
|
365
|
-
"getCategoryBySlug",
|
|
366
|
-
"getAttributes",
|
|
367
|
-
"createCategory",
|
|
368
|
-
"updateCategory",
|
|
369
|
-
"deleteCategory",
|
|
370
|
-
"createAttribute",
|
|
371
|
-
"updateAttribute",
|
|
372
|
-
"deleteAttribute",
|
|
373
|
-
];
|
|
140
|
+
const grpcMethods: string[] = ["getAllCategories", "getCategory"];
|
|
374
141
|
for (const method of grpcMethods) {
|
|
375
142
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
376
143
|
GrpcMethod("CategoriesService", method)(constructor.prototype[method], method, descriptor);
|
package/package.json
CHANGED
package/proto/categories.proto
CHANGED
|
@@ -10,38 +10,6 @@ service CategoriesService {
|
|
|
10
10
|
|
|
11
11
|
// Получить категорию по ID
|
|
12
12
|
rpc GetCategory (GetCategoryRequest) returns (GetCategoryResponse);
|
|
13
|
-
|
|
14
|
-
// Получить категорию по slug
|
|
15
|
-
rpc GetCategoryBySlug (GetCategoryBySlugRequest) returns (GetCategoryResponse);
|
|
16
|
-
|
|
17
|
-
// Получить атрибуты категории (для фильтров)
|
|
18
|
-
rpc GetAttributes (GetAttributesRequest) returns (GetAttributesResponse);
|
|
19
|
-
|
|
20
|
-
// Создать категорию (админ)
|
|
21
|
-
rpc CreateCategory (CreateCategoryRequest) returns (CreateCategoryResponse);
|
|
22
|
-
|
|
23
|
-
// Обновить категорию (админ)
|
|
24
|
-
rpc UpdateCategory (UpdateCategoryRequest) returns (UpdateCategoryResponse);
|
|
25
|
-
|
|
26
|
-
// Удалить категорию (админ)
|
|
27
|
-
rpc DeleteCategory (DeleteCategoryRequest) returns (DeleteCategoryResponse);
|
|
28
|
-
|
|
29
|
-
// Создать атрибут (админ)
|
|
30
|
-
rpc CreateAttribute (CreateAttributeRequest) returns (CreateAttributeResponse);
|
|
31
|
-
|
|
32
|
-
// Обновить атрибут (админ)
|
|
33
|
-
rpc UpdateAttribute (UpdateAttributeRequest) returns (UpdateAttributeResponse);
|
|
34
|
-
|
|
35
|
-
// Удалить атрибут (админ)
|
|
36
|
-
rpc DeleteAttribute (DeleteAttributeRequest) returns (DeleteAttributeResponse);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Запросы
|
|
40
|
-
|
|
41
|
-
message GetTreeRequest {
|
|
42
|
-
optional string parent_id = 1; // Если не указан, возвращает корневые категории
|
|
43
|
-
int32 max_depth = 2; // Максимальная глубина (0 = без ограничений)
|
|
44
|
-
bool only_active = 3; // Только активные категории
|
|
45
13
|
}
|
|
46
14
|
|
|
47
15
|
message GetCategoryRequest {
|
|
@@ -49,75 +17,7 @@ message GetCategoryRequest {
|
|
|
49
17
|
bool include_attributes = 2; // Включить атрибуты
|
|
50
18
|
}
|
|
51
19
|
|
|
52
|
-
message GetCategoryBySlugRequest {
|
|
53
|
-
string slug = 1;
|
|
54
|
-
optional string parent_id = 2; // Для уникальности
|
|
55
|
-
bool include_attributes = 3;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
message GetAttributesRequest {
|
|
59
|
-
string category_id = 1;
|
|
60
|
-
bool only_filterable = 2; // Только для фильтров
|
|
61
|
-
bool include_inherited = 3; // Включить наследуемые от родителей
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
message CreateCategoryRequest {
|
|
65
|
-
string name = 1;
|
|
66
|
-
string slug = 2;
|
|
67
|
-
optional string description = 3;
|
|
68
|
-
optional string icon_url = 4;
|
|
69
|
-
optional string banner_url = 5;
|
|
70
|
-
optional string parent_id = 6;
|
|
71
|
-
bool is_leaf = 7;
|
|
72
|
-
int32 sort_order = 8;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
message UpdateCategoryRequest {
|
|
76
|
-
string id = 1;
|
|
77
|
-
optional string name = 2;
|
|
78
|
-
optional string slug = 3;
|
|
79
|
-
optional string description = 4;
|
|
80
|
-
optional string icon_url = 5;
|
|
81
|
-
optional string banner_url = 6;
|
|
82
|
-
optional bool is_leaf = 7;
|
|
83
|
-
optional bool is_active = 8;
|
|
84
|
-
optional int32 sort_order = 9;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
message DeleteCategoryRequest {
|
|
88
|
-
string id = 1;
|
|
89
|
-
bool cascade = 2; // Удалить дочерние категории
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
message CreateAttributeRequest {
|
|
93
|
-
string category_id = 1; // Категория, к которой привязываем атрибут
|
|
94
|
-
string name = 2; // Название атрибута
|
|
95
|
-
string key = 3; // Глобальный ключ (если атрибут с таким key уже существует, он будет переиспользован)
|
|
96
|
-
AttributeType type = 4;
|
|
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 типов (создаются только если атрибут новый)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
message UpdateAttributeRequest {
|
|
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 глобального атрибута
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
message DeleteAttributeRequest {
|
|
116
|
-
string id = 1; // ID CategoryAttribute (связи) - удаляется только связь, глобальный Attribute остается
|
|
117
|
-
}
|
|
118
|
-
|
|
119
20
|
// Ответы
|
|
120
|
-
|
|
121
21
|
message GetAllCategoriesResponse {
|
|
122
22
|
repeated Category categories = 1;
|
|
123
23
|
}
|
|
@@ -126,34 +26,6 @@ message GetCategoryResponse {
|
|
|
126
26
|
Category category = 1;
|
|
127
27
|
}
|
|
128
28
|
|
|
129
|
-
message GetAttributesResponse {
|
|
130
|
-
repeated CategoryAttribute attributes = 1;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
message CreateCategoryResponse {
|
|
134
|
-
Category category = 1;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
message UpdateCategoryResponse {
|
|
138
|
-
Category category = 1;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
message DeleteCategoryResponse {
|
|
142
|
-
bool ok = 1;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
message CreateAttributeResponse {
|
|
146
|
-
CategoryAttribute attribute = 1;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
message UpdateAttributeResponse {
|
|
150
|
-
CategoryAttribute attribute = 1;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
message DeleteAttributeResponse {
|
|
154
|
-
bool ok = 1;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
29
|
// Модели
|
|
158
30
|
|
|
159
31
|
message Category {
|