@barumetric/contracts 1.2.2 → 1.2.4

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.
@@ -32,6 +32,11 @@ export interface GetCategoryRequest {
32
32
  includeAttributes: boolean;
33
33
  }
34
34
 
35
+ export interface GetCategoryAttributesRequest {
36
+ /** ID категории */
37
+ categoryId: string;
38
+ }
39
+
35
40
  /** Ответы */
36
41
  export interface GetAllCategoriesResponse {
37
42
  categories: Category[];
@@ -41,6 +46,10 @@ export interface GetCategoryResponse {
41
46
  category: Category | undefined;
42
47
  }
43
48
 
49
+ export interface GetCategoryAttributesResponse {
50
+ attributes: CategoryAttribute[];
51
+ }
52
+
44
53
  export interface Category {
45
54
  id: string;
46
55
  name: string;
@@ -119,6 +128,10 @@ export interface CategoriesServiceClient {
119
128
  /** Получить категорию по ID */
120
129
 
121
130
  getCategory(request: GetCategoryRequest): Observable<GetCategoryResponse>;
131
+
132
+ /** Получить атрибуты категории (для фильтрации) */
133
+
134
+ getCategoryAttributes(request: GetCategoryAttributesRequest): Observable<GetCategoryAttributesResponse>;
122
135
  }
123
136
 
124
137
  export interface CategoriesServiceController {
@@ -133,11 +146,17 @@ export interface CategoriesServiceController {
133
146
  getCategory(
134
147
  request: GetCategoryRequest,
135
148
  ): Promise<GetCategoryResponse> | Observable<GetCategoryResponse> | GetCategoryResponse;
149
+
150
+ /** Получить атрибуты категории (для фильтрации) */
151
+
152
+ getCategoryAttributes(
153
+ request: GetCategoryAttributesRequest,
154
+ ): Promise<GetCategoryAttributesResponse> | Observable<GetCategoryAttributesResponse> | GetCategoryAttributesResponse;
136
155
  }
137
156
 
138
157
  export function CategoriesServiceControllerMethods() {
139
158
  return function (constructor: Function) {
140
- const grpcMethods: string[] = ["getAllCategories", "getCategory"];
159
+ const grpcMethods: string[] = ["getAllCategories", "getCategory", "getCategoryAttributes"];
141
160
  for (const method of grpcMethods) {
142
161
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
143
162
  GrpcMethod("CategoriesService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barumetric/contracts",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
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"
@@ -10,6 +10,9 @@ service CategoriesService {
10
10
 
11
11
  // Получить категорию по ID
12
12
  rpc GetCategory (GetCategoryRequest) returns (GetCategoryResponse);
13
+
14
+ // Получить атрибуты категории (для фильтрации)
15
+ rpc GetCategoryAttributes (GetCategoryAttributesRequest) returns (GetCategoryAttributesResponse);
13
16
  }
14
17
 
15
18
  message GetCategoryRequest {
@@ -17,6 +20,10 @@ message GetCategoryRequest {
17
20
  bool include_attributes = 2; // Включить атрибуты
18
21
  }
19
22
 
23
+ message GetCategoryAttributesRequest {
24
+ string category_id = 1; // ID категории
25
+ }
26
+
20
27
  // Ответы
21
28
  message GetAllCategoriesResponse {
22
29
  repeated Category categories = 1;
@@ -26,6 +33,10 @@ message GetCategoryResponse {
26
33
  Category category = 1;
27
34
  }
28
35
 
36
+ message GetCategoryAttributesResponse {
37
+ repeated CategoryAttribute attributes = 1;
38
+ }
39
+
29
40
  // Модели
30
41
 
31
42
  message Category {