@mamindom/contracts 1.0.48 → 1.0.50

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.
@@ -0,0 +1,238 @@
1
+ syntax = "proto3";
2
+
3
+ package promo.v1;
4
+
5
+
6
+ import "common_promo.proto";
7
+
8
+ service PublicPromoService {
9
+
10
+ rpc GetProductsDiscounts (GetProductsDiscountsRequest) returns (GetProductsDiscountsResponse);
11
+
12
+
13
+ rpc ValidateAndCalculate (ValidateAndCalculateRequest) returns (ValidateAndCalculateResponse);
14
+ }
15
+
16
+ service AdminPromoService {
17
+
18
+ rpc GetPromotions (GetPromotionsRequest) returns (GetPromotionsResponse);
19
+ rpc GetPromotion (GetPromotionRequest) returns (PromotionResponse);
20
+ rpc CreatePromotion (CreatePromotionRequest) returns (PromotionResponse);
21
+ rpc UpdatePromotion (UpdatePromotionRequest) returns (PromotionResponse);
22
+ rpc DeletePromotion (DeletePromotionRequest) returns (DeleteResponse);
23
+
24
+
25
+ rpc GenerateCouponsBatch (GenerateCouponsBatchRequest) returns (GenerateCouponsBatchResponse);
26
+ rpc ExportCouponsCSV (ExportCouponsCSVRequest) returns (ExportCouponsCSVResponse);
27
+
28
+
29
+ rpc GetPromotionAnalytics (GetPromotionAnalyticsRequest) returns (PromotionAnalyticsResponse);
30
+ }
31
+
32
+
33
+ message ProductContextItem {
34
+ string product_id = 1;
35
+ string category_id = 2;
36
+ string brand_id = 3;
37
+ double base_price = 4;
38
+ }
39
+
40
+ message GetProductsDiscountsRequest {
41
+ repeated ProductContextItem items = 1;
42
+ }
43
+
44
+ message DiscountedProductItem {
45
+ string product_id = 1;
46
+ double original_price = 2;
47
+ double discounted_price = 3;
48
+ string applied_promotion_id = 4;
49
+ }
50
+
51
+ message GetProductsDiscountsResponse {
52
+ repeated DiscountedProductItem items = 1;
53
+ }
54
+
55
+
56
+ message CartItem {
57
+ string product_id = 1;
58
+ string category_id = 2;
59
+ string brand_id = 3;
60
+ double price = 4;
61
+ int32 quantity = 5;
62
+ }
63
+
64
+ message ValidateAndCalculateRequest {
65
+ string user_id = 1;
66
+ repeated CartItem items = 2;
67
+ optional string promo_code = 3;
68
+ bool is_first_purchase = 4;
69
+ }
70
+
71
+ message AppliedDiscount {
72
+ string promotion_id = 1;
73
+ string title = 2;
74
+ double discount_amount = 3;
75
+ }
76
+
77
+ message ValidateAndCalculateResponse {
78
+ double original_total = 1;
79
+ double final_total = 2;
80
+ double total_discount = 3;
81
+ repeated AppliedDiscount applied_discounts = 4;
82
+ bool is_coupon_valid = 5;
83
+ optional string coupon_error_message = 6;
84
+ }
85
+
86
+
87
+ message PromotionResponse {
88
+ string id = 1;
89
+ PromotionType type = 2;
90
+ PromotionStatus status = 3;
91
+
92
+ map<string, string> title = 4;
93
+ map<string, string> description = 5;
94
+ map<string, string> meta_title = 6;
95
+ map<string, string> meta_description = 7;
96
+ map<string, string> meta_keywords = 8;
97
+
98
+ optional string image = 9;
99
+ optional string image_id = 10;
100
+
101
+ optional double discount_value = 11;
102
+ optional string start_date = 12;
103
+ optional string end_date = 13;
104
+ double min_order_amount = 14;
105
+
106
+ bool is_combinable = 15;
107
+ bool is_active = 16;
108
+
109
+ string conditions = 17;
110
+
111
+ string created_at = 18;
112
+ string updated_at = 19;
113
+ }
114
+
115
+
116
+ message GetPromotionsRequest {
117
+ PaginationRequest pagination = 1;
118
+ optional PromotionType type = 2;
119
+ optional PromotionStatus status = 3;
120
+ optional string search = 4;
121
+ }
122
+
123
+ message GetPromotionsResponse {
124
+ repeated PromotionResponse items = 1;
125
+ PaginationMeta meta = 2;
126
+ }
127
+
128
+ message GetPromotionRequest {
129
+ string id = 1;
130
+ }
131
+
132
+ message CreatePromotionRequest {
133
+ PromotionType type = 1;
134
+ PromotionStatus status = 2;
135
+
136
+ map<string, string> title = 3;
137
+ map<string, string> description = 4;
138
+ map<string, string> meta_title = 5;
139
+ map<string, string> meta_description = 6;
140
+ map<string, string> meta_keywords = 7;
141
+
142
+ optional string image = 8;
143
+ optional string image_id = 9;
144
+
145
+ optional double discount_value = 10;
146
+ optional string start_date = 11;
147
+ optional string end_date = 12;
148
+ optional double min_order_amount = 13;
149
+
150
+ bool is_combinable = 14;
151
+ bool is_active = 15;
152
+ string conditions = 16;
153
+ }
154
+
155
+ message UpdatePromotionRequest {
156
+ string id = 1;
157
+ optional PromotionType type = 2;
158
+ optional PromotionStatus status = 3;
159
+
160
+ map<string, string> title = 4;
161
+ map<string, string> description = 5;
162
+ map<string, string> meta_title = 6;
163
+ map<string, string> meta_description = 7;
164
+ map<string, string> meta_keywords = 8;
165
+
166
+ optional string image = 9;
167
+ optional string image_id = 10;
168
+
169
+ optional double discount_value = 11;
170
+ optional string start_date = 12;
171
+ optional string end_date = 13;
172
+ optional double min_order_amount = 14;
173
+
174
+ optional bool is_combinable = 15;
175
+ optional bool is_active = 16;
176
+ optional string conditions = 17;
177
+ }
178
+
179
+ message DeletePromotionRequest {
180
+ string id = 1;
181
+ }
182
+
183
+
184
+ message GenerateCouponsBatchRequest {
185
+ string promotion_id = 1;
186
+ string batch_name = 2;
187
+ int32 count = 3;
188
+ optional string prefix = 4;
189
+ optional int32 global_usage_limit = 5;
190
+ optional int32 per_user_usage_limit = 6;
191
+ }
192
+
193
+ message GenerateCouponsBatchResponse {
194
+ string batch_id = 1;
195
+ int32 generated_count = 2;
196
+ bool success = 3;
197
+ }
198
+
199
+ message ExportCouponsCSVRequest {
200
+ optional string promotion_id = 1;
201
+ optional string batch_id = 2;
202
+ }
203
+
204
+ message ExportCouponsCSVResponse {
205
+ string download_url = 1;
206
+ }
207
+
208
+
209
+ message GetPromotionAnalyticsRequest {
210
+ string promotion_id = 1;
211
+ }
212
+
213
+ message PromotionAnalyticsResponse {
214
+ string promotion_id = 1;
215
+ int32 total_uses = 2;
216
+ double total_discount_given = 3;
217
+ double total_revenue = 4;
218
+ double average_discount = 5;
219
+ double conversion_rate = 6;
220
+ }
221
+
222
+ enum PromotionType {
223
+ PROMOTION_TYPE_UNSPECIFIED = 0;
224
+ PROMOTION_TYPE_FIXED = 1;
225
+ PROMOTION_TYPE_PERCENTAGE = 2;
226
+ PROMOTION_TYPE_COUPON = 3;
227
+ PROMOTION_TYPE_N_PLUS_M = 4;
228
+ PROMOTION_TYPE_FIRST_PURCHASE = 5;
229
+ PROMOTION_TYPE_PROMO_PERIOD = 6;
230
+ }
231
+
232
+ enum PromotionStatus {
233
+ PROMOTION_STATUS_UNSPECIFIED = 0;
234
+ PROMOTION_STATUS_ACTIVE = 1;
235
+ PROMOTION_STATUS_INACTIVE = 2;
236
+ PROMOTION_STATUS_SCHEDULED = 3;
237
+ PROMOTION_STATUS_ARCHIVED = 4;
238
+ }
@@ -10,4 +10,6 @@ export declare const PROTO_PATHS: {
10
10
  readonly MEDIA: string;
11
11
  readonly SIZE_CHART: string;
12
12
  readonly STICKER: string;
13
+ readonly COMMON_PROMO: string;
14
+ readonly PROMO: string;
13
15
  };
@@ -13,5 +13,7 @@ exports.PROTO_PATHS = {
13
13
  PRODUCT: (0, node_path_1.join)(__dirname, '../../proto/product.proto'),
14
14
  MEDIA: (0, node_path_1.join)(__dirname, '../../proto/media.proto'),
15
15
  SIZE_CHART: (0, node_path_1.join)(__dirname, '../../proto/size_chart.proto'),
16
- STICKER: (0, node_path_1.join)(__dirname, '../../proto/sticker.proto')
16
+ STICKER: (0, node_path_1.join)(__dirname, '../../proto/sticker.proto'),
17
+ COMMON_PROMO: (0, node_path_1.join)(__dirname, '../../proto/common_promo.proto'),
18
+ PROMO: (0, node_path_1.join)(__dirname, '../../proto/promo.proto')
17
19
  };
package/gen/account.ts CHANGED
@@ -111,29 +111,18 @@ export interface AdminCreateAccountResponse {
111
111
  id: string;
112
112
  }
113
113
 
114
- export interface AdminGetAllAccountsRequest {
115
- page: number;
116
- limit: number;
114
+ export interface AdminGetAccountsRequest {
115
+ page?: number | undefined;
116
+ limit?: number | undefined;
117
117
  search?: string | undefined;
118
118
  role?: Role | undefined;
119
+ isBlocked?: boolean | undefined;
120
+ sortBy?: string | undefined;
119
121
  }
120
122
 
121
- export interface AdminAccountItem {
122
- id: string;
123
- phone: string;
124
- email: string;
125
- firstName: string;
126
- lastName: string;
127
- role: Role;
128
- isBlocked: boolean;
129
- createdAt: string;
130
- }
131
-
132
- export interface AdminGetAllAccountsResponse {
133
- items: AdminAccountItem[];
123
+ export interface AdminGetAccountsResponse {
124
+ items: AdminGetAccountResponse[];
134
125
  total: number;
135
- page: number;
136
- limit: number;
137
126
  }
138
127
 
139
128
  export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
@@ -155,7 +144,7 @@ export interface AccountServiceClient {
155
144
 
156
145
  adminCreateAccount(request: AdminCreateAccountRequest): Observable<AdminCreateAccountResponse>;
157
146
 
158
- adminGetAllAccounts(request: AdminGetAllAccountsRequest): Observable<AdminGetAllAccountsResponse>;
147
+ adminGetAccounts(request: AdminGetAccountsRequest): Observable<AdminGetAccountsResponse>;
159
148
  }
160
149
 
161
150
  export interface AccountServiceController {
@@ -191,9 +180,9 @@ export interface AccountServiceController {
191
180
  request: AdminCreateAccountRequest,
192
181
  ): Promise<AdminCreateAccountResponse> | Observable<AdminCreateAccountResponse> | AdminCreateAccountResponse;
193
182
 
194
- adminGetAllAccounts(
195
- request: AdminGetAllAccountsRequest,
196
- ): Promise<AdminGetAllAccountsResponse> | Observable<AdminGetAllAccountsResponse> | AdminGetAllAccountsResponse;
183
+ adminGetAccounts(
184
+ request: AdminGetAccountsRequest,
185
+ ): Promise<AdminGetAccountsResponse> | Observable<AdminGetAccountsResponse> | AdminGetAccountsResponse;
197
186
  }
198
187
 
199
188
  export function AccountServiceControllerMethods() {
@@ -207,7 +196,7 @@ export function AccountServiceControllerMethods() {
207
196
  "adminGetAccount",
208
197
  "adminBlockAccount",
209
198
  "adminCreateAccount",
210
- "adminGetAllAccounts",
199
+ "adminGetAccounts",
211
200
  ];
212
201
  for (const method of grpcMethods) {
213
202
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
@@ -0,0 +1,31 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.4
4
+ // protoc v3.21.12
5
+ // source: common_promo.proto
6
+
7
+ /* eslint-disable */
8
+
9
+ export const protobufPackage = "promo.v1";
10
+
11
+ export interface SuccessResponse {
12
+ success: boolean;
13
+ }
14
+
15
+ export interface DeleteResponse {
16
+ success: boolean;
17
+ }
18
+
19
+ export interface PaginationRequest {
20
+ page: number;
21
+ limit: number;
22
+ }
23
+
24
+ export interface PaginationMeta {
25
+ totalItems: number;
26
+ totalPages: number;
27
+ currentPage: number;
28
+ perPage: number;
29
+ }
30
+
31
+ export const PROMO_V1_PACKAGE_NAME = "promo.v1";