@mamindom/contracts 1.0.83 → 1.0.84

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.
@@ -24,6 +24,7 @@ export declare enum PromotionStatus {
24
24
  PROMOTION_STATUS_ACTIVE = 2,
25
25
  PROMOTION_STATUS_INACTIVE = 3,
26
26
  PROMOTION_STATUS_EXPIRED = 4,
27
+ PROMOTION_STATUS_SCHEDULED = 5,
27
28
  UNRECOGNIZED = -1
28
29
  }
29
30
  export declare enum ConditionLogic {
@@ -104,6 +105,13 @@ export interface PromotionResponse {
104
105
  updatedAt: string;
105
106
  conditions: PromotionConditionResponse[];
106
107
  exclusions: PromotionExclusionResponse[];
108
+ imageUrl?: string | undefined;
109
+ imageId?: string | undefined;
110
+ priority: number;
111
+ productCount: number;
112
+ categoryIds: string[];
113
+ brandIds: string[];
114
+ daysUntilExpiry?: number | undefined;
107
115
  }
108
116
  export interface PromotionResponse_NameEntry {
109
117
  key: string;
@@ -129,6 +137,10 @@ export interface GetPromotionsRequest {
129
137
  categoryId?: string | undefined;
130
138
  dateFrom?: string | undefined;
131
139
  dateTo?: string | undefined;
140
+ /** startDate | endDate | priority | discountValue */
141
+ sortBy?: string | undefined;
142
+ /** asc | desc */
143
+ sortDir?: string | undefined;
132
144
  }
133
145
  export interface GetPromotionsResponse {
134
146
  items: PromotionListItem[];
@@ -146,6 +158,12 @@ export interface PromotionListItem {
146
158
  usageCount: number;
147
159
  isActive: boolean;
148
160
  createdAt: string;
161
+ imageUrl?: string | undefined;
162
+ productCount: number;
163
+ daysUntilExpiry?: number | undefined;
164
+ priority: number;
165
+ discountValue: number;
166
+ discountType: DiscountType;
149
167
  }
150
168
  export interface PromotionListItem_NameEntry {
151
169
  key: string;
@@ -183,6 +201,9 @@ export interface CreatePromotionRequest {
183
201
  createdById: string;
184
202
  conditions: PromotionConditionPayload[];
185
203
  exclusions: PromotionExclusionPayload[];
204
+ imageUrl?: string | undefined;
205
+ imageId?: string | undefined;
206
+ priority?: number | undefined;
186
207
  }
187
208
  export interface CreatePromotionRequest_NameEntry {
188
209
  key: string;
@@ -229,6 +250,9 @@ export interface UpdatePromotionRequest {
229
250
  };
230
251
  conditions: PromotionConditionPayload[];
231
252
  exclusions: PromotionExclusionPayload[];
253
+ imageUrl?: string | undefined;
254
+ imageId?: string | undefined;
255
+ priority?: number | undefined;
232
256
  }
233
257
  export interface UpdatePromotionRequest_NameEntry {
234
258
  key: string;
@@ -249,6 +273,13 @@ export interface UpdatePromotionRequest_SeoDescriptionEntry {
249
273
  export interface DeletePromotionRequest {
250
274
  id: string;
251
275
  }
276
+ export interface ClonePromotionRequest {
277
+ id: string;
278
+ }
279
+ export interface UpdatePromotionStatusRequest {
280
+ id: string;
281
+ status: PromotionStatus;
282
+ }
252
283
  export interface BulkApplyToCategoriesRequest {
253
284
  promotionId: string;
254
285
  categoryIds: string[];
@@ -261,6 +292,55 @@ export interface GetActivePromotionsResponse {
261
292
  items: PromotionListItem[];
262
293
  meta: PaginationMeta | undefined;
263
294
  }
295
+ export interface PromotionProductItem {
296
+ id: string;
297
+ productId: string;
298
+ variantId?: string | undefined;
299
+ label: string;
300
+ labelColor: string;
301
+ }
302
+ export interface GetPromotionProductsRequest {
303
+ promotionId: string;
304
+ pagination: PaginationRequest | undefined;
305
+ }
306
+ export interface GetPromotionProductsResponse {
307
+ items: PromotionProductItem[];
308
+ total: number;
309
+ }
310
+ export interface PromotionProductPayload {
311
+ productId: string;
312
+ variantId?: string | undefined;
313
+ label?: string | undefined;
314
+ labelColor?: string | undefined;
315
+ }
316
+ export interface AddPromotionProductsRequest {
317
+ promotionId: string;
318
+ products: PromotionProductPayload[];
319
+ }
320
+ export interface RemovePromotionProductsRequest {
321
+ promotionId: string;
322
+ productIds: string[];
323
+ }
324
+ export interface GetPromotionCategoriesRequest {
325
+ promotionId: string;
326
+ }
327
+ export interface GetPromotionCategoriesResponse {
328
+ categoryIds: string[];
329
+ }
330
+ export interface SetPromotionCategoriesRequest {
331
+ promotionId: string;
332
+ categoryIds: string[];
333
+ }
334
+ export interface GetPromotionBrandsRequest {
335
+ promotionId: string;
336
+ }
337
+ export interface GetPromotionBrandsResponse {
338
+ brandIds: string[];
339
+ }
340
+ export interface SetPromotionBrandsRequest {
341
+ promotionId: string;
342
+ brandIds: string[];
343
+ }
264
344
  export declare const PROMO_V1_PACKAGE_NAME = "promo.v1";
265
345
  export interface PromotionServiceClient {
266
346
  getPromotions(request: GetPromotionsRequest): Observable<GetPromotionsResponse>;
@@ -268,8 +348,20 @@ export interface PromotionServiceClient {
268
348
  createPromotion(request: CreatePromotionRequest): Observable<PromotionResponse>;
269
349
  updatePromotion(request: UpdatePromotionRequest): Observable<PromotionResponse>;
270
350
  deletePromotion(request: DeletePromotionRequest): Observable<DeleteResponse>;
351
+ clonePromotion(request: ClonePromotionRequest): Observable<PromotionResponse>;
352
+ updatePromotionStatus(request: UpdatePromotionStatusRequest): Observable<PromotionResponse>;
271
353
  bulkApplyToCategories(request: BulkApplyToCategoriesRequest): Observable<SuccessResponse>;
272
354
  getActivePromotions(request: GetActivePromotionsRequest): Observable<GetActivePromotionsResponse>;
355
+ /** Products */
356
+ getPromotionProducts(request: GetPromotionProductsRequest): Observable<GetPromotionProductsResponse>;
357
+ addPromotionProducts(request: AddPromotionProductsRequest): Observable<SuccessResponse>;
358
+ removePromotionProducts(request: RemovePromotionProductsRequest): Observable<SuccessResponse>;
359
+ /** Categories */
360
+ getPromotionCategories(request: GetPromotionCategoriesRequest): Observable<GetPromotionCategoriesResponse>;
361
+ setPromotionCategories(request: SetPromotionCategoriesRequest): Observable<SuccessResponse>;
362
+ /** Brands */
363
+ getPromotionBrands(request: GetPromotionBrandsRequest): Observable<GetPromotionBrandsResponse>;
364
+ setPromotionBrands(request: SetPromotionBrandsRequest): Observable<SuccessResponse>;
273
365
  }
274
366
  export interface PromotionServiceController {
275
367
  getPromotions(request: GetPromotionsRequest): Promise<GetPromotionsResponse> | Observable<GetPromotionsResponse> | GetPromotionsResponse;
@@ -277,8 +369,20 @@ export interface PromotionServiceController {
277
369
  createPromotion(request: CreatePromotionRequest): Promise<PromotionResponse> | Observable<PromotionResponse> | PromotionResponse;
278
370
  updatePromotion(request: UpdatePromotionRequest): Promise<PromotionResponse> | Observable<PromotionResponse> | PromotionResponse;
279
371
  deletePromotion(request: DeletePromotionRequest): Promise<DeleteResponse> | Observable<DeleteResponse> | DeleteResponse;
372
+ clonePromotion(request: ClonePromotionRequest): Promise<PromotionResponse> | Observable<PromotionResponse> | PromotionResponse;
373
+ updatePromotionStatus(request: UpdatePromotionStatusRequest): Promise<PromotionResponse> | Observable<PromotionResponse> | PromotionResponse;
280
374
  bulkApplyToCategories(request: BulkApplyToCategoriesRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
281
375
  getActivePromotions(request: GetActivePromotionsRequest): Promise<GetActivePromotionsResponse> | Observable<GetActivePromotionsResponse> | GetActivePromotionsResponse;
376
+ /** Products */
377
+ getPromotionProducts(request: GetPromotionProductsRequest): Promise<GetPromotionProductsResponse> | Observable<GetPromotionProductsResponse> | GetPromotionProductsResponse;
378
+ addPromotionProducts(request: AddPromotionProductsRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
379
+ removePromotionProducts(request: RemovePromotionProductsRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
380
+ /** Categories */
381
+ getPromotionCategories(request: GetPromotionCategoriesRequest): Promise<GetPromotionCategoriesResponse> | Observable<GetPromotionCategoriesResponse> | GetPromotionCategoriesResponse;
382
+ setPromotionCategories(request: SetPromotionCategoriesRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
383
+ /** Brands */
384
+ getPromotionBrands(request: GetPromotionBrandsRequest): Promise<GetPromotionBrandsResponse> | Observable<GetPromotionBrandsResponse> | GetPromotionBrandsResponse;
385
+ setPromotionBrands(request: SetPromotionBrandsRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
282
386
  }
283
387
  export declare function PromotionServiceControllerMethods(): (constructor: Function) => void;
284
388
  export declare const PROMOTION_SERVICE_NAME = "PromotionService";
@@ -36,6 +36,7 @@ var PromotionStatus;
36
36
  PromotionStatus[PromotionStatus["PROMOTION_STATUS_ACTIVE"] = 2] = "PROMOTION_STATUS_ACTIVE";
37
37
  PromotionStatus[PromotionStatus["PROMOTION_STATUS_INACTIVE"] = 3] = "PROMOTION_STATUS_INACTIVE";
38
38
  PromotionStatus[PromotionStatus["PROMOTION_STATUS_EXPIRED"] = 4] = "PROMOTION_STATUS_EXPIRED";
39
+ PromotionStatus[PromotionStatus["PROMOTION_STATUS_SCHEDULED"] = 5] = "PROMOTION_STATUS_SCHEDULED";
39
40
  PromotionStatus[PromotionStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
40
41
  })(PromotionStatus || (exports.PromotionStatus = PromotionStatus = {}));
41
42
  var ConditionLogic;
@@ -74,8 +75,17 @@ function PromotionServiceControllerMethods() {
74
75
  "createPromotion",
75
76
  "updatePromotion",
76
77
  "deletePromotion",
78
+ "clonePromotion",
79
+ "updatePromotionStatus",
77
80
  "bulkApplyToCategories",
78
81
  "getActivePromotions",
82
+ "getPromotionProducts",
83
+ "addPromotionProducts",
84
+ "removePromotionProducts",
85
+ "getPromotionCategories",
86
+ "setPromotionCategories",
87
+ "getPromotionBrands",
88
+ "setPromotionBrands",
79
89
  ];
80
90
  for (const method of grpcMethods) {
81
91
  const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
@@ -6,36 +6,50 @@ import "common_promo.proto";
6
6
 
7
7
 
8
8
  service PromotionService {
9
-
10
- rpc GetPromotions (GetPromotionsRequest) returns (GetPromotionsResponse);
11
- rpc GetPromotion (GetPromotionRequest) returns (PromotionResponse);
12
- rpc CreatePromotion (CreatePromotionRequest) returns (PromotionResponse);
13
- rpc UpdatePromotion (UpdatePromotionRequest) returns (PromotionResponse);
14
- rpc DeletePromotion (DeletePromotionRequest) returns (DeleteResponse);
15
-
16
-
17
- rpc BulkApplyToCategories (BulkApplyToCategoriesRequest) returns (SuccessResponse);
18
-
19
-
20
- rpc GetActivePromotions (GetActivePromotionsRequest) returns (GetActivePromotionsResponse);
9
+ rpc GetPromotions (GetPromotionsRequest) returns (GetPromotionsResponse);
10
+ rpc GetPromotion (GetPromotionRequest) returns (PromotionResponse);
11
+ rpc CreatePromotion (CreatePromotionRequest) returns (PromotionResponse);
12
+ rpc UpdatePromotion (UpdatePromotionRequest) returns (PromotionResponse);
13
+ rpc DeletePromotion (DeletePromotionRequest) returns (DeleteResponse);
14
+ rpc ClonePromotion (ClonePromotionRequest) returns (PromotionResponse);
15
+ rpc UpdatePromotionStatus (UpdatePromotionStatusRequest) returns (PromotionResponse);
16
+
17
+ rpc BulkApplyToCategories (BulkApplyToCategoriesRequest) returns (SuccessResponse);
18
+
19
+ rpc GetActivePromotions (GetActivePromotionsRequest) returns (GetActivePromotionsResponse);
20
+
21
+ // Products
22
+ rpc GetPromotionProducts (GetPromotionProductsRequest) returns (GetPromotionProductsResponse);
23
+ rpc AddPromotionProducts (AddPromotionProductsRequest) returns (SuccessResponse);
24
+ rpc RemovePromotionProducts (RemovePromotionProductsRequest) returns (SuccessResponse);
25
+
26
+ // Categories
27
+ rpc GetPromotionCategories (GetPromotionCategoriesRequest) returns (GetPromotionCategoriesResponse);
28
+ rpc SetPromotionCategories (SetPromotionCategoriesRequest) returns (SuccessResponse);
29
+
30
+ // Brands
31
+ rpc GetPromotionBrands (GetPromotionBrandsRequest) returns (GetPromotionBrandsResponse);
32
+ rpc SetPromotionBrands (SetPromotionBrandsRequest) returns (SuccessResponse);
21
33
  }
22
34
 
23
35
 
36
+ // ─── Enums ────────────────────────────────────────────────────────────────────
37
+
24
38
  enum PromotionType {
25
39
  PROMOTION_TYPE_UNSPECIFIED = 0;
26
- PROMOTION_TYPE_FIXED = 1;
27
- PROMOTION_TYPE_PERCENTAGE = 2;
40
+ PROMOTION_TYPE_FIXED = 1;
41
+ PROMOTION_TYPE_PERCENTAGE = 2;
28
42
  PROMOTION_TYPE_COUPON = 3;
29
- PROMOTION_TYPE_BUY_N_GET_M = 4;
30
- PROMOTION_TYPE_FIRST_ORDER = 5;
43
+ PROMOTION_TYPE_BUY_N_GET_M = 4;
44
+ PROMOTION_TYPE_FIRST_ORDER = 5;
31
45
  PROMOTION_TYPE_LOYALTY = 6;
32
- PROMOTION_TYPE_PROMO_PERIOD = 7;
46
+ PROMOTION_TYPE_PROMO_PERIOD = 7;
33
47
  }
34
48
 
35
49
  enum DiscountType {
36
50
  DISCOUNT_TYPE_UNSPECIFIED = 0;
37
- DISCOUNT_TYPE_FIXED = 1;
38
- DISCOUNT_TYPE_PERCENTAGE = 2;
51
+ DISCOUNT_TYPE_FIXED = 1;
52
+ DISCOUNT_TYPE_PERCENTAGE = 2;
39
53
  }
40
54
 
41
55
  enum PromotionStatus {
@@ -44,6 +58,7 @@ enum PromotionStatus {
44
58
  PROMOTION_STATUS_ACTIVE = 2;
45
59
  PROMOTION_STATUS_INACTIVE = 3;
46
60
  PROMOTION_STATUS_EXPIRED = 4;
61
+ PROMOTION_STATUS_SCHEDULED = 5;
47
62
  }
48
63
 
49
64
  enum ConditionLogic {
@@ -71,10 +86,12 @@ enum ExclusionEntityType {
71
86
  }
72
87
 
73
88
 
89
+ // ─── Condition / Exclusion payloads ───────────────────────────────────────────
90
+
74
91
  message PromotionConditionPayload {
75
92
  ConditionLogic logic_type = 1;
76
93
  ConditionType condition_type = 2;
77
- string value = 3;
94
+ string value = 3;
78
95
  }
79
96
 
80
97
  message PromotionExclusionPayload {
@@ -96,10 +113,12 @@ message PromotionExclusionResponse {
96
113
  }
97
114
 
98
115
 
116
+ // ─── Main response ────────────────────────────────────────────────────────────
117
+
99
118
  message PromotionResponse {
100
- string id = 1;
101
- map<string, string> name = 2;
102
- map<string, string> description = 3;
119
+ string id = 1;
120
+ map<string, string> name = 2;
121
+ map<string, string> description = 3;
103
122
 
104
123
  PromotionType type = 4;
105
124
  DiscountType discount_type = 5;
@@ -107,7 +126,7 @@ message PromotionResponse {
107
126
 
108
127
  double discount_value = 7;
109
128
 
110
- optional string starts_at = 8;
129
+ optional string starts_at = 8;
111
130
  optional string ends_at = 9;
112
131
 
113
132
  optional double min_order_amount = 10;
@@ -118,11 +137,9 @@ message PromotionResponse {
118
137
  bool is_active = 14;
119
138
  bool is_exclusive = 15;
120
139
 
121
-
122
140
  optional int32 buy_quantity = 16;
123
141
  optional int32 get_quantity = 17;
124
142
 
125
-
126
143
  optional string seo_slug = 18;
127
144
  map<string, string> seo_title = 19;
128
145
  map<string, string> seo_description = 20;
@@ -133,18 +150,29 @@ message PromotionResponse {
133
150
 
134
151
  repeated PromotionConditionResponse conditions = 24;
135
152
  repeated PromotionExclusionResponse exclusions = 25;
153
+
154
+ optional string image_url = 26;
155
+ optional string image_id = 27;
156
+ int32 priority = 28;
157
+ int32 product_count = 29;
158
+ repeated string category_ids = 30;
159
+ repeated string brand_ids = 31;
160
+ optional int32 days_until_expiry = 32;
136
161
  }
137
162
 
138
163
 
139
- message GetPromotionsRequest {
140
- PaginationRequest pagination = 1;
164
+ // ─── List ─────────────────────────────────────────────────────────────────────
141
165
 
142
- optional PromotionType type = 2;
143
- optional PromotionStatus status = 3;
144
- optional string search = 4;
145
- optional string category_id = 5;
146
- optional string date_from = 6;
147
- optional string date_to = 7;
166
+ message GetPromotionsRequest {
167
+ PaginationRequest pagination = 1;
168
+ optional PromotionType type = 2;
169
+ optional PromotionStatus status = 3;
170
+ optional string search = 4;
171
+ optional string category_id = 5;
172
+ optional string date_from = 6;
173
+ optional string date_to = 7;
174
+ optional string sort_by = 8; // startDate | endDate | priority | discountValue
175
+ optional string sort_dir = 9; // asc | desc
148
176
  }
149
177
 
150
178
  message GetPromotionsResponse {
@@ -162,14 +190,21 @@ message PromotionListItem {
162
190
  int32 usage_count = 7;
163
191
  bool is_active = 8;
164
192
  string created_at = 9;
193
+ optional string image_url = 10;
194
+ int32 product_count = 11;
195
+ optional int32 days_until_expiry = 12;
196
+ int32 priority = 13;
197
+ double discount_value = 14;
198
+ DiscountType discount_type = 15;
165
199
  }
166
200
 
167
201
 
202
+ // ─── CRUD requests ───────────────────────────────────────────────────────────
203
+
168
204
  message GetPromotionRequest {
169
205
  string id = 1;
170
206
  }
171
207
 
172
-
173
208
  message CreatePromotionRequest {
174
209
  map<string, string> name = 1;
175
210
  map<string, string> description = 2;
@@ -199,8 +234,11 @@ message CreatePromotionRequest {
199
234
 
200
235
  repeated PromotionConditionPayload conditions = 19;
201
236
  repeated PromotionExclusionPayload exclusions = 20;
202
- }
203
237
 
238
+ optional string image_url = 21;
239
+ optional string image_id = 22;
240
+ optional int32 priority = 23;
241
+ }
204
242
 
205
243
  message UpdatePromotionRequest {
206
244
  string id = 1;
@@ -229,16 +267,29 @@ message UpdatePromotionRequest {
229
267
  map<string, string> seo_title = 17;
230
268
  map<string, string> seo_description = 18;
231
269
 
232
-
233
270
  repeated PromotionConditionPayload conditions = 19;
234
271
  repeated PromotionExclusionPayload exclusions = 20;
235
- }
236
272
 
273
+ optional string image_url = 21;
274
+ optional string image_id = 22;
275
+ optional int32 priority = 23;
276
+ }
237
277
 
238
278
  message DeletePromotionRequest {
239
279
  string id = 1;
240
280
  }
241
281
 
282
+ message ClonePromotionRequest {
283
+ string id = 1;
284
+ }
285
+
286
+ message UpdatePromotionStatusRequest {
287
+ string id = 1;
288
+ PromotionStatus status = 2;
289
+ }
290
+
291
+
292
+ // ─── Bulk apply ───────────────────────────────────────────────────────────────
242
293
 
243
294
  message BulkApplyToCategoriesRequest {
244
295
  string promotion_id = 1;
@@ -246,6 +297,8 @@ message BulkApplyToCategoriesRequest {
246
297
  }
247
298
 
248
299
 
300
+ // ─── Active promotions ────────────────────────────────────────────────────────
301
+
249
302
  message GetActivePromotionsRequest {
250
303
  PaginationRequest pagination = 1;
251
304
  optional string lang = 2;
@@ -255,3 +308,73 @@ message GetActivePromotionsResponse {
255
308
  repeated PromotionListItem items = 1;
256
309
  PaginationMeta meta = 2;
257
310
  }
311
+
312
+
313
+ // ─── Products ─────────────────────────────────────────────────────────────────
314
+
315
+ message PromotionProductItem {
316
+ string id = 1;
317
+ string product_id = 2;
318
+ optional string variant_id = 3;
319
+ string label = 4;
320
+ string label_color = 5;
321
+ }
322
+
323
+ message GetPromotionProductsRequest {
324
+ string promotion_id = 1;
325
+ PaginationRequest pagination = 2;
326
+ }
327
+
328
+ message GetPromotionProductsResponse {
329
+ repeated PromotionProductItem items = 1;
330
+ int32 total = 2;
331
+ }
332
+
333
+ message PromotionProductPayload {
334
+ string product_id = 1;
335
+ optional string variant_id = 2;
336
+ optional string label = 3;
337
+ optional string label_color = 4;
338
+ }
339
+
340
+ message AddPromotionProductsRequest {
341
+ string promotion_id = 1;
342
+ repeated PromotionProductPayload products = 2;
343
+ }
344
+
345
+ message RemovePromotionProductsRequest {
346
+ string promotion_id = 1;
347
+ repeated string product_ids = 2;
348
+ }
349
+
350
+
351
+ // ─── Categories ───────────────────────────────────────────────────────────────
352
+
353
+ message GetPromotionCategoriesRequest {
354
+ string promotion_id = 1;
355
+ }
356
+
357
+ message GetPromotionCategoriesResponse {
358
+ repeated string category_ids = 1;
359
+ }
360
+
361
+ message SetPromotionCategoriesRequest {
362
+ string promotion_id = 1;
363
+ repeated string category_ids = 2;
364
+ }
365
+
366
+
367
+ // ─── Brands ───────────────────────────────────────────────────────────────────
368
+
369
+ message GetPromotionBrandsRequest {
370
+ string promotion_id = 1;
371
+ }
372
+
373
+ message GetPromotionBrandsResponse {
374
+ repeated string brand_ids = 1;
375
+ }
376
+
377
+ message SetPromotionBrandsRequest {
378
+ string promotion_id = 1;
379
+ repeated string brand_ids = 2;
380
+ }
package/gen/promotion.ts CHANGED
@@ -36,6 +36,7 @@ export enum PromotionStatus {
36
36
  PROMOTION_STATUS_ACTIVE = 2,
37
37
  PROMOTION_STATUS_INACTIVE = 3,
38
38
  PROMOTION_STATUS_EXPIRED = 4,
39
+ PROMOTION_STATUS_SCHEDULED = 5,
39
40
  UNRECOGNIZED = -1,
40
41
  }
41
42
 
@@ -116,6 +117,13 @@ export interface PromotionResponse {
116
117
  updatedAt: string;
117
118
  conditions: PromotionConditionResponse[];
118
119
  exclusions: PromotionExclusionResponse[];
120
+ imageUrl?: string | undefined;
121
+ imageId?: string | undefined;
122
+ priority: number;
123
+ productCount: number;
124
+ categoryIds: string[];
125
+ brandIds: string[];
126
+ daysUntilExpiry?: number | undefined;
119
127
  }
120
128
 
121
129
  export interface PromotionResponse_NameEntry {
@@ -145,7 +153,15 @@ export interface GetPromotionsRequest {
145
153
  search?: string | undefined;
146
154
  categoryId?: string | undefined;
147
155
  dateFrom?: string | undefined;
148
- dateTo?: string | undefined;
156
+ dateTo?:
157
+ | string
158
+ | undefined;
159
+ /** startDate | endDate | priority | discountValue */
160
+ sortBy?:
161
+ | string
162
+ | undefined;
163
+ /** asc | desc */
164
+ sortDir?: string | undefined;
149
165
  }
150
166
 
151
167
  export interface GetPromotionsResponse {
@@ -163,6 +179,12 @@ export interface PromotionListItem {
163
179
  usageCount: number;
164
180
  isActive: boolean;
165
181
  createdAt: string;
182
+ imageUrl?: string | undefined;
183
+ productCount: number;
184
+ daysUntilExpiry?: number | undefined;
185
+ priority: number;
186
+ discountValue: number;
187
+ discountType: DiscountType;
166
188
  }
167
189
 
168
190
  export interface PromotionListItem_NameEntry {
@@ -195,6 +217,9 @@ export interface CreatePromotionRequest {
195
217
  createdById: string;
196
218
  conditions: PromotionConditionPayload[];
197
219
  exclusions: PromotionExclusionPayload[];
220
+ imageUrl?: string | undefined;
221
+ imageId?: string | undefined;
222
+ priority?: number | undefined;
198
223
  }
199
224
 
200
225
  export interface CreatePromotionRequest_NameEntry {
@@ -238,6 +263,9 @@ export interface UpdatePromotionRequest {
238
263
  seoDescription: { [key: string]: string };
239
264
  conditions: PromotionConditionPayload[];
240
265
  exclusions: PromotionExclusionPayload[];
266
+ imageUrl?: string | undefined;
267
+ imageId?: string | undefined;
268
+ priority?: number | undefined;
241
269
  }
242
270
 
243
271
  export interface UpdatePromotionRequest_NameEntry {
@@ -264,6 +292,15 @@ export interface DeletePromotionRequest {
264
292
  id: string;
265
293
  }
266
294
 
295
+ export interface ClonePromotionRequest {
296
+ id: string;
297
+ }
298
+
299
+ export interface UpdatePromotionStatusRequest {
300
+ id: string;
301
+ status: PromotionStatus;
302
+ }
303
+
267
304
  export interface BulkApplyToCategoriesRequest {
268
305
  promotionId: string;
269
306
  categoryIds: string[];
@@ -279,6 +316,67 @@ export interface GetActivePromotionsResponse {
279
316
  meta: PaginationMeta | undefined;
280
317
  }
281
318
 
319
+ export interface PromotionProductItem {
320
+ id: string;
321
+ productId: string;
322
+ variantId?: string | undefined;
323
+ label: string;
324
+ labelColor: string;
325
+ }
326
+
327
+ export interface GetPromotionProductsRequest {
328
+ promotionId: string;
329
+ pagination: PaginationRequest | undefined;
330
+ }
331
+
332
+ export interface GetPromotionProductsResponse {
333
+ items: PromotionProductItem[];
334
+ total: number;
335
+ }
336
+
337
+ export interface PromotionProductPayload {
338
+ productId: string;
339
+ variantId?: string | undefined;
340
+ label?: string | undefined;
341
+ labelColor?: string | undefined;
342
+ }
343
+
344
+ export interface AddPromotionProductsRequest {
345
+ promotionId: string;
346
+ products: PromotionProductPayload[];
347
+ }
348
+
349
+ export interface RemovePromotionProductsRequest {
350
+ promotionId: string;
351
+ productIds: string[];
352
+ }
353
+
354
+ export interface GetPromotionCategoriesRequest {
355
+ promotionId: string;
356
+ }
357
+
358
+ export interface GetPromotionCategoriesResponse {
359
+ categoryIds: string[];
360
+ }
361
+
362
+ export interface SetPromotionCategoriesRequest {
363
+ promotionId: string;
364
+ categoryIds: string[];
365
+ }
366
+
367
+ export interface GetPromotionBrandsRequest {
368
+ promotionId: string;
369
+ }
370
+
371
+ export interface GetPromotionBrandsResponse {
372
+ brandIds: string[];
373
+ }
374
+
375
+ export interface SetPromotionBrandsRequest {
376
+ promotionId: string;
377
+ brandIds: string[];
378
+ }
379
+
282
380
  export const PROMO_V1_PACKAGE_NAME = "promo.v1";
283
381
 
284
382
  export interface PromotionServiceClient {
@@ -292,9 +390,33 @@ export interface PromotionServiceClient {
292
390
 
293
391
  deletePromotion(request: DeletePromotionRequest): Observable<DeleteResponse>;
294
392
 
393
+ clonePromotion(request: ClonePromotionRequest): Observable<PromotionResponse>;
394
+
395
+ updatePromotionStatus(request: UpdatePromotionStatusRequest): Observable<PromotionResponse>;
396
+
295
397
  bulkApplyToCategories(request: BulkApplyToCategoriesRequest): Observable<SuccessResponse>;
296
398
 
297
399
  getActivePromotions(request: GetActivePromotionsRequest): Observable<GetActivePromotionsResponse>;
400
+
401
+ /** Products */
402
+
403
+ getPromotionProducts(request: GetPromotionProductsRequest): Observable<GetPromotionProductsResponse>;
404
+
405
+ addPromotionProducts(request: AddPromotionProductsRequest): Observable<SuccessResponse>;
406
+
407
+ removePromotionProducts(request: RemovePromotionProductsRequest): Observable<SuccessResponse>;
408
+
409
+ /** Categories */
410
+
411
+ getPromotionCategories(request: GetPromotionCategoriesRequest): Observable<GetPromotionCategoriesResponse>;
412
+
413
+ setPromotionCategories(request: SetPromotionCategoriesRequest): Observable<SuccessResponse>;
414
+
415
+ /** Brands */
416
+
417
+ getPromotionBrands(request: GetPromotionBrandsRequest): Observable<GetPromotionBrandsResponse>;
418
+
419
+ setPromotionBrands(request: SetPromotionBrandsRequest): Observable<SuccessResponse>;
298
420
  }
299
421
 
300
422
  export interface PromotionServiceController {
@@ -318,6 +440,14 @@ export interface PromotionServiceController {
318
440
  request: DeletePromotionRequest,
319
441
  ): Promise<DeleteResponse> | Observable<DeleteResponse> | DeleteResponse;
320
442
 
443
+ clonePromotion(
444
+ request: ClonePromotionRequest,
445
+ ): Promise<PromotionResponse> | Observable<PromotionResponse> | PromotionResponse;
446
+
447
+ updatePromotionStatus(
448
+ request: UpdatePromotionStatusRequest,
449
+ ): Promise<PromotionResponse> | Observable<PromotionResponse> | PromotionResponse;
450
+
321
451
  bulkApplyToCategories(
322
452
  request: BulkApplyToCategoriesRequest,
323
453
  ): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
@@ -325,6 +455,43 @@ export interface PromotionServiceController {
325
455
  getActivePromotions(
326
456
  request: GetActivePromotionsRequest,
327
457
  ): Promise<GetActivePromotionsResponse> | Observable<GetActivePromotionsResponse> | GetActivePromotionsResponse;
458
+
459
+ /** Products */
460
+
461
+ getPromotionProducts(
462
+ request: GetPromotionProductsRequest,
463
+ ): Promise<GetPromotionProductsResponse> | Observable<GetPromotionProductsResponse> | GetPromotionProductsResponse;
464
+
465
+ addPromotionProducts(
466
+ request: AddPromotionProductsRequest,
467
+ ): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
468
+
469
+ removePromotionProducts(
470
+ request: RemovePromotionProductsRequest,
471
+ ): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
472
+
473
+ /** Categories */
474
+
475
+ getPromotionCategories(
476
+ request: GetPromotionCategoriesRequest,
477
+ ):
478
+ | Promise<GetPromotionCategoriesResponse>
479
+ | Observable<GetPromotionCategoriesResponse>
480
+ | GetPromotionCategoriesResponse;
481
+
482
+ setPromotionCategories(
483
+ request: SetPromotionCategoriesRequest,
484
+ ): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
485
+
486
+ /** Brands */
487
+
488
+ getPromotionBrands(
489
+ request: GetPromotionBrandsRequest,
490
+ ): Promise<GetPromotionBrandsResponse> | Observable<GetPromotionBrandsResponse> | GetPromotionBrandsResponse;
491
+
492
+ setPromotionBrands(
493
+ request: SetPromotionBrandsRequest,
494
+ ): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
328
495
  }
329
496
 
330
497
  export function PromotionServiceControllerMethods() {
@@ -335,8 +502,17 @@ export function PromotionServiceControllerMethods() {
335
502
  "createPromotion",
336
503
  "updatePromotion",
337
504
  "deletePromotion",
505
+ "clonePromotion",
506
+ "updatePromotionStatus",
338
507
  "bulkApplyToCategories",
339
508
  "getActivePromotions",
509
+ "getPromotionProducts",
510
+ "addPromotionProducts",
511
+ "removePromotionProducts",
512
+ "getPromotionCategories",
513
+ "setPromotionCategories",
514
+ "getPromotionBrands",
515
+ "setPromotionBrands",
340
516
  ];
341
517
  for (const method of grpcMethods) {
342
518
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mamindom/contracts",
3
3
  "description": "proto",
4
- "version": "1.0.83",
4
+ "version": "1.0.84",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",
7
7
  "exports": {
@@ -6,36 +6,50 @@ import "common_promo.proto";
6
6
 
7
7
 
8
8
  service PromotionService {
9
-
10
- rpc GetPromotions (GetPromotionsRequest) returns (GetPromotionsResponse);
11
- rpc GetPromotion (GetPromotionRequest) returns (PromotionResponse);
12
- rpc CreatePromotion (CreatePromotionRequest) returns (PromotionResponse);
13
- rpc UpdatePromotion (UpdatePromotionRequest) returns (PromotionResponse);
14
- rpc DeletePromotion (DeletePromotionRequest) returns (DeleteResponse);
15
-
16
-
17
- rpc BulkApplyToCategories (BulkApplyToCategoriesRequest) returns (SuccessResponse);
18
-
19
-
20
- rpc GetActivePromotions (GetActivePromotionsRequest) returns (GetActivePromotionsResponse);
9
+ rpc GetPromotions (GetPromotionsRequest) returns (GetPromotionsResponse);
10
+ rpc GetPromotion (GetPromotionRequest) returns (PromotionResponse);
11
+ rpc CreatePromotion (CreatePromotionRequest) returns (PromotionResponse);
12
+ rpc UpdatePromotion (UpdatePromotionRequest) returns (PromotionResponse);
13
+ rpc DeletePromotion (DeletePromotionRequest) returns (DeleteResponse);
14
+ rpc ClonePromotion (ClonePromotionRequest) returns (PromotionResponse);
15
+ rpc UpdatePromotionStatus (UpdatePromotionStatusRequest) returns (PromotionResponse);
16
+
17
+ rpc BulkApplyToCategories (BulkApplyToCategoriesRequest) returns (SuccessResponse);
18
+
19
+ rpc GetActivePromotions (GetActivePromotionsRequest) returns (GetActivePromotionsResponse);
20
+
21
+ // Products
22
+ rpc GetPromotionProducts (GetPromotionProductsRequest) returns (GetPromotionProductsResponse);
23
+ rpc AddPromotionProducts (AddPromotionProductsRequest) returns (SuccessResponse);
24
+ rpc RemovePromotionProducts (RemovePromotionProductsRequest) returns (SuccessResponse);
25
+
26
+ // Categories
27
+ rpc GetPromotionCategories (GetPromotionCategoriesRequest) returns (GetPromotionCategoriesResponse);
28
+ rpc SetPromotionCategories (SetPromotionCategoriesRequest) returns (SuccessResponse);
29
+
30
+ // Brands
31
+ rpc GetPromotionBrands (GetPromotionBrandsRequest) returns (GetPromotionBrandsResponse);
32
+ rpc SetPromotionBrands (SetPromotionBrandsRequest) returns (SuccessResponse);
21
33
  }
22
34
 
23
35
 
36
+ // ─── Enums ────────────────────────────────────────────────────────────────────
37
+
24
38
  enum PromotionType {
25
39
  PROMOTION_TYPE_UNSPECIFIED = 0;
26
- PROMOTION_TYPE_FIXED = 1;
27
- PROMOTION_TYPE_PERCENTAGE = 2;
40
+ PROMOTION_TYPE_FIXED = 1;
41
+ PROMOTION_TYPE_PERCENTAGE = 2;
28
42
  PROMOTION_TYPE_COUPON = 3;
29
- PROMOTION_TYPE_BUY_N_GET_M = 4;
30
- PROMOTION_TYPE_FIRST_ORDER = 5;
43
+ PROMOTION_TYPE_BUY_N_GET_M = 4;
44
+ PROMOTION_TYPE_FIRST_ORDER = 5;
31
45
  PROMOTION_TYPE_LOYALTY = 6;
32
- PROMOTION_TYPE_PROMO_PERIOD = 7;
46
+ PROMOTION_TYPE_PROMO_PERIOD = 7;
33
47
  }
34
48
 
35
49
  enum DiscountType {
36
50
  DISCOUNT_TYPE_UNSPECIFIED = 0;
37
- DISCOUNT_TYPE_FIXED = 1;
38
- DISCOUNT_TYPE_PERCENTAGE = 2;
51
+ DISCOUNT_TYPE_FIXED = 1;
52
+ DISCOUNT_TYPE_PERCENTAGE = 2;
39
53
  }
40
54
 
41
55
  enum PromotionStatus {
@@ -44,6 +58,7 @@ enum PromotionStatus {
44
58
  PROMOTION_STATUS_ACTIVE = 2;
45
59
  PROMOTION_STATUS_INACTIVE = 3;
46
60
  PROMOTION_STATUS_EXPIRED = 4;
61
+ PROMOTION_STATUS_SCHEDULED = 5;
47
62
  }
48
63
 
49
64
  enum ConditionLogic {
@@ -71,10 +86,12 @@ enum ExclusionEntityType {
71
86
  }
72
87
 
73
88
 
89
+ // ─── Condition / Exclusion payloads ───────────────────────────────────────────
90
+
74
91
  message PromotionConditionPayload {
75
92
  ConditionLogic logic_type = 1;
76
93
  ConditionType condition_type = 2;
77
- string value = 3;
94
+ string value = 3;
78
95
  }
79
96
 
80
97
  message PromotionExclusionPayload {
@@ -96,10 +113,12 @@ message PromotionExclusionResponse {
96
113
  }
97
114
 
98
115
 
116
+ // ─── Main response ────────────────────────────────────────────────────────────
117
+
99
118
  message PromotionResponse {
100
- string id = 1;
101
- map<string, string> name = 2;
102
- map<string, string> description = 3;
119
+ string id = 1;
120
+ map<string, string> name = 2;
121
+ map<string, string> description = 3;
103
122
 
104
123
  PromotionType type = 4;
105
124
  DiscountType discount_type = 5;
@@ -107,7 +126,7 @@ message PromotionResponse {
107
126
 
108
127
  double discount_value = 7;
109
128
 
110
- optional string starts_at = 8;
129
+ optional string starts_at = 8;
111
130
  optional string ends_at = 9;
112
131
 
113
132
  optional double min_order_amount = 10;
@@ -118,11 +137,9 @@ message PromotionResponse {
118
137
  bool is_active = 14;
119
138
  bool is_exclusive = 15;
120
139
 
121
-
122
140
  optional int32 buy_quantity = 16;
123
141
  optional int32 get_quantity = 17;
124
142
 
125
-
126
143
  optional string seo_slug = 18;
127
144
  map<string, string> seo_title = 19;
128
145
  map<string, string> seo_description = 20;
@@ -133,18 +150,29 @@ message PromotionResponse {
133
150
 
134
151
  repeated PromotionConditionResponse conditions = 24;
135
152
  repeated PromotionExclusionResponse exclusions = 25;
153
+
154
+ optional string image_url = 26;
155
+ optional string image_id = 27;
156
+ int32 priority = 28;
157
+ int32 product_count = 29;
158
+ repeated string category_ids = 30;
159
+ repeated string brand_ids = 31;
160
+ optional int32 days_until_expiry = 32;
136
161
  }
137
162
 
138
163
 
139
- message GetPromotionsRequest {
140
- PaginationRequest pagination = 1;
164
+ // ─── List ─────────────────────────────────────────────────────────────────────
141
165
 
142
- optional PromotionType type = 2;
143
- optional PromotionStatus status = 3;
144
- optional string search = 4;
145
- optional string category_id = 5;
146
- optional string date_from = 6;
147
- optional string date_to = 7;
166
+ message GetPromotionsRequest {
167
+ PaginationRequest pagination = 1;
168
+ optional PromotionType type = 2;
169
+ optional PromotionStatus status = 3;
170
+ optional string search = 4;
171
+ optional string category_id = 5;
172
+ optional string date_from = 6;
173
+ optional string date_to = 7;
174
+ optional string sort_by = 8; // startDate | endDate | priority | discountValue
175
+ optional string sort_dir = 9; // asc | desc
148
176
  }
149
177
 
150
178
  message GetPromotionsResponse {
@@ -162,14 +190,21 @@ message PromotionListItem {
162
190
  int32 usage_count = 7;
163
191
  bool is_active = 8;
164
192
  string created_at = 9;
193
+ optional string image_url = 10;
194
+ int32 product_count = 11;
195
+ optional int32 days_until_expiry = 12;
196
+ int32 priority = 13;
197
+ double discount_value = 14;
198
+ DiscountType discount_type = 15;
165
199
  }
166
200
 
167
201
 
202
+ // ─── CRUD requests ───────────────────────────────────────────────────────────
203
+
168
204
  message GetPromotionRequest {
169
205
  string id = 1;
170
206
  }
171
207
 
172
-
173
208
  message CreatePromotionRequest {
174
209
  map<string, string> name = 1;
175
210
  map<string, string> description = 2;
@@ -199,8 +234,11 @@ message CreatePromotionRequest {
199
234
 
200
235
  repeated PromotionConditionPayload conditions = 19;
201
236
  repeated PromotionExclusionPayload exclusions = 20;
202
- }
203
237
 
238
+ optional string image_url = 21;
239
+ optional string image_id = 22;
240
+ optional int32 priority = 23;
241
+ }
204
242
 
205
243
  message UpdatePromotionRequest {
206
244
  string id = 1;
@@ -229,16 +267,29 @@ message UpdatePromotionRequest {
229
267
  map<string, string> seo_title = 17;
230
268
  map<string, string> seo_description = 18;
231
269
 
232
-
233
270
  repeated PromotionConditionPayload conditions = 19;
234
271
  repeated PromotionExclusionPayload exclusions = 20;
235
- }
236
272
 
273
+ optional string image_url = 21;
274
+ optional string image_id = 22;
275
+ optional int32 priority = 23;
276
+ }
237
277
 
238
278
  message DeletePromotionRequest {
239
279
  string id = 1;
240
280
  }
241
281
 
282
+ message ClonePromotionRequest {
283
+ string id = 1;
284
+ }
285
+
286
+ message UpdatePromotionStatusRequest {
287
+ string id = 1;
288
+ PromotionStatus status = 2;
289
+ }
290
+
291
+
292
+ // ─── Bulk apply ───────────────────────────────────────────────────────────────
242
293
 
243
294
  message BulkApplyToCategoriesRequest {
244
295
  string promotion_id = 1;
@@ -246,6 +297,8 @@ message BulkApplyToCategoriesRequest {
246
297
  }
247
298
 
248
299
 
300
+ // ─── Active promotions ────────────────────────────────────────────────────────
301
+
249
302
  message GetActivePromotionsRequest {
250
303
  PaginationRequest pagination = 1;
251
304
  optional string lang = 2;
@@ -255,3 +308,73 @@ message GetActivePromotionsResponse {
255
308
  repeated PromotionListItem items = 1;
256
309
  PaginationMeta meta = 2;
257
310
  }
311
+
312
+
313
+ // ─── Products ─────────────────────────────────────────────────────────────────
314
+
315
+ message PromotionProductItem {
316
+ string id = 1;
317
+ string product_id = 2;
318
+ optional string variant_id = 3;
319
+ string label = 4;
320
+ string label_color = 5;
321
+ }
322
+
323
+ message GetPromotionProductsRequest {
324
+ string promotion_id = 1;
325
+ PaginationRequest pagination = 2;
326
+ }
327
+
328
+ message GetPromotionProductsResponse {
329
+ repeated PromotionProductItem items = 1;
330
+ int32 total = 2;
331
+ }
332
+
333
+ message PromotionProductPayload {
334
+ string product_id = 1;
335
+ optional string variant_id = 2;
336
+ optional string label = 3;
337
+ optional string label_color = 4;
338
+ }
339
+
340
+ message AddPromotionProductsRequest {
341
+ string promotion_id = 1;
342
+ repeated PromotionProductPayload products = 2;
343
+ }
344
+
345
+ message RemovePromotionProductsRequest {
346
+ string promotion_id = 1;
347
+ repeated string product_ids = 2;
348
+ }
349
+
350
+
351
+ // ─── Categories ───────────────────────────────────────────────────────────────
352
+
353
+ message GetPromotionCategoriesRequest {
354
+ string promotion_id = 1;
355
+ }
356
+
357
+ message GetPromotionCategoriesResponse {
358
+ repeated string category_ids = 1;
359
+ }
360
+
361
+ message SetPromotionCategoriesRequest {
362
+ string promotion_id = 1;
363
+ repeated string category_ids = 2;
364
+ }
365
+
366
+
367
+ // ─── Brands ───────────────────────────────────────────────────────────────────
368
+
369
+ message GetPromotionBrandsRequest {
370
+ string promotion_id = 1;
371
+ }
372
+
373
+ message GetPromotionBrandsResponse {
374
+ repeated string brand_ids = 1;
375
+ }
376
+
377
+ message SetPromotionBrandsRequest {
378
+ string promotion_id = 1;
379
+ repeated string brand_ids = 2;
380
+ }