@gigapay-dev/contracts 3.13.0 → 3.13.1

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.
@@ -4,8 +4,8 @@ import { z } from "zod";
4
4
  * покупок (`popularityScore`), с тайбрейком по всем продажам и новизне.
5
5
  */
6
6
  export declare const ProductSortSchema: z.ZodEnum<{
7
- popular: "popular";
8
7
  newest: "newest";
8
+ popular: "popular";
9
9
  price_asc: "price_asc";
10
10
  price_desc: "price_desc";
11
11
  }>;
@@ -28,8 +28,8 @@ export declare const ListProductsQuerySchema: z.ZodObject<{
28
28
  }>>;
29
29
  search: z.ZodOptional<z.ZodString>;
30
30
  sort: z.ZodDefault<z.ZodEnum<{
31
- popular: "popular";
32
31
  newest: "newest";
32
+ popular: "popular";
33
33
  price_asc: "price_asc";
34
34
  price_desc: "price_desc";
35
35
  }>>;
@@ -61,8 +61,8 @@ export declare const ListProductsEndpoint: {
61
61
  }>>;
62
62
  search: z.ZodOptional<z.ZodString>;
63
63
  sort: z.ZodDefault<z.ZodEnum<{
64
- popular: "popular";
65
64
  newest: "newest";
65
+ popular: "popular";
66
66
  price_asc: "price_asc";
67
67
  price_desc: "price_desc";
68
68
  }>>;
@@ -104,6 +104,19 @@ export declare const ListProductsEndpoint: {
104
104
  kzt: z.ZodString;
105
105
  }, z.core.$strip>;
106
106
  popularityScore: z.ZodNumber;
107
+ rating: z.ZodObject<{
108
+ average: z.ZodNumber;
109
+ count: z.ZodNumber;
110
+ distribution: z.ZodObject<{
111
+ 1: z.ZodNumber;
112
+ 2: z.ZodNumber;
113
+ 3: z.ZodNumber;
114
+ 4: z.ZodNumber;
115
+ 5: z.ZodNumber;
116
+ }, z.core.$strip>;
117
+ userRating: z.ZodNullable<z.ZodNumber>;
118
+ canRate: z.ZodBoolean;
119
+ }, z.core.$strip>;
107
120
  seo: z.ZodObject<{
108
121
  metaTitle: z.ZodString;
109
122
  metaDescription: z.ZodString;
@@ -208,6 +221,19 @@ export declare const GetProductBySlugEndpoint: {
208
221
  kzt: z.ZodString;
209
222
  }, z.core.$strip>;
210
223
  popularityScore: z.ZodNumber;
224
+ rating: z.ZodObject<{
225
+ average: z.ZodNumber;
226
+ count: z.ZodNumber;
227
+ distribution: z.ZodObject<{
228
+ 1: z.ZodNumber;
229
+ 2: z.ZodNumber;
230
+ 3: z.ZodNumber;
231
+ 4: z.ZodNumber;
232
+ 5: z.ZodNumber;
233
+ }, z.core.$strip>;
234
+ userRating: z.ZodNullable<z.ZodNumber>;
235
+ canRate: z.ZodBoolean;
236
+ }, z.core.$strip>;
211
237
  seo: z.ZodObject<{
212
238
  metaTitle: z.ZodString;
213
239
  metaDescription: z.ZodString;
@@ -290,8 +316,8 @@ export declare const ListAdminProductsEndpoint: {
290
316
  }>>;
291
317
  search: z.ZodOptional<z.ZodString>;
292
318
  sort: z.ZodDefault<z.ZodEnum<{
293
- popular: "popular";
294
319
  newest: "newest";
320
+ popular: "popular";
295
321
  price_asc: "price_asc";
296
322
  price_desc: "price_desc";
297
323
  }>>;
@@ -333,6 +359,19 @@ export declare const ListAdminProductsEndpoint: {
333
359
  kzt: z.ZodString;
334
360
  }, z.core.$strip>;
335
361
  popularityScore: z.ZodNumber;
362
+ rating: z.ZodObject<{
363
+ average: z.ZodNumber;
364
+ count: z.ZodNumber;
365
+ distribution: z.ZodObject<{
366
+ 1: z.ZodNumber;
367
+ 2: z.ZodNumber;
368
+ 3: z.ZodNumber;
369
+ 4: z.ZodNumber;
370
+ 5: z.ZodNumber;
371
+ }, z.core.$strip>;
372
+ userRating: z.ZodNullable<z.ZodNumber>;
373
+ canRate: z.ZodBoolean;
374
+ }, z.core.$strip>;
336
375
  seo: z.ZodObject<{
337
376
  metaTitle: z.ZodString;
338
377
  metaDescription: z.ZodString;
@@ -474,6 +513,19 @@ export declare const GetAdminProductBySlugEndpoint: {
474
513
  kzt: z.ZodString;
475
514
  }, z.core.$strip>;
476
515
  popularityScore: z.ZodNumber;
516
+ rating: z.ZodObject<{
517
+ average: z.ZodNumber;
518
+ count: z.ZodNumber;
519
+ distribution: z.ZodObject<{
520
+ 1: z.ZodNumber;
521
+ 2: z.ZodNumber;
522
+ 3: z.ZodNumber;
523
+ 4: z.ZodNumber;
524
+ 5: z.ZodNumber;
525
+ }, z.core.$strip>;
526
+ userRating: z.ZodNullable<z.ZodNumber>;
527
+ canRate: z.ZodBoolean;
528
+ }, z.core.$strip>;
477
529
  seo: z.ZodObject<{
478
530
  metaTitle: z.ZodString;
479
531
  metaDescription: z.ZodString;
@@ -589,8 +641,8 @@ export declare const ProductQueries: {
589
641
  }>>;
590
642
  search: z.ZodOptional<z.ZodString>;
591
643
  sort: z.ZodDefault<z.ZodEnum<{
592
- popular: "popular";
593
644
  newest: "newest";
645
+ popular: "popular";
594
646
  price_asc: "price_asc";
595
647
  price_desc: "price_desc";
596
648
  }>>;
@@ -632,6 +684,19 @@ export declare const ProductQueries: {
632
684
  kzt: z.ZodString;
633
685
  }, z.core.$strip>;
634
686
  popularityScore: z.ZodNumber;
687
+ rating: z.ZodObject<{
688
+ average: z.ZodNumber;
689
+ count: z.ZodNumber;
690
+ distribution: z.ZodObject<{
691
+ 1: z.ZodNumber;
692
+ 2: z.ZodNumber;
693
+ 3: z.ZodNumber;
694
+ 4: z.ZodNumber;
695
+ 5: z.ZodNumber;
696
+ }, z.core.$strip>;
697
+ userRating: z.ZodNullable<z.ZodNumber>;
698
+ canRate: z.ZodBoolean;
699
+ }, z.core.$strip>;
635
700
  seo: z.ZodObject<{
636
701
  metaTitle: z.ZodString;
637
702
  metaDescription: z.ZodString;
@@ -728,6 +793,19 @@ export declare const ProductQueries: {
728
793
  kzt: z.ZodString;
729
794
  }, z.core.$strip>;
730
795
  popularityScore: z.ZodNumber;
796
+ rating: z.ZodObject<{
797
+ average: z.ZodNumber;
798
+ count: z.ZodNumber;
799
+ distribution: z.ZodObject<{
800
+ 1: z.ZodNumber;
801
+ 2: z.ZodNumber;
802
+ 3: z.ZodNumber;
803
+ 4: z.ZodNumber;
804
+ 5: z.ZodNumber;
805
+ }, z.core.$strip>;
806
+ userRating: z.ZodNullable<z.ZodNumber>;
807
+ canRate: z.ZodBoolean;
808
+ }, z.core.$strip>;
731
809
  seo: z.ZodObject<{
732
810
  metaTitle: z.ZodString;
733
811
  metaDescription: z.ZodString;
@@ -810,8 +888,8 @@ export declare const ProductQueries: {
810
888
  }>>;
811
889
  search: z.ZodOptional<z.ZodString>;
812
890
  sort: z.ZodDefault<z.ZodEnum<{
813
- popular: "popular";
814
891
  newest: "newest";
892
+ popular: "popular";
815
893
  price_asc: "price_asc";
816
894
  price_desc: "price_desc";
817
895
  }>>;
@@ -853,6 +931,19 @@ export declare const ProductQueries: {
853
931
  kzt: z.ZodString;
854
932
  }, z.core.$strip>;
855
933
  popularityScore: z.ZodNumber;
934
+ rating: z.ZodObject<{
935
+ average: z.ZodNumber;
936
+ count: z.ZodNumber;
937
+ distribution: z.ZodObject<{
938
+ 1: z.ZodNumber;
939
+ 2: z.ZodNumber;
940
+ 3: z.ZodNumber;
941
+ 4: z.ZodNumber;
942
+ 5: z.ZodNumber;
943
+ }, z.core.$strip>;
944
+ userRating: z.ZodNullable<z.ZodNumber>;
945
+ canRate: z.ZodBoolean;
946
+ }, z.core.$strip>;
856
947
  seo: z.ZodObject<{
857
948
  metaTitle: z.ZodString;
858
949
  metaDescription: z.ZodString;
@@ -994,6 +1085,19 @@ export declare const ProductQueries: {
994
1085
  kzt: z.ZodString;
995
1086
  }, z.core.$strip>;
996
1087
  popularityScore: z.ZodNumber;
1088
+ rating: z.ZodObject<{
1089
+ average: z.ZodNumber;
1090
+ count: z.ZodNumber;
1091
+ distribution: z.ZodObject<{
1092
+ 1: z.ZodNumber;
1093
+ 2: z.ZodNumber;
1094
+ 3: z.ZodNumber;
1095
+ 4: z.ZodNumber;
1096
+ 5: z.ZodNumber;
1097
+ }, z.core.$strip>;
1098
+ userRating: z.ZodNullable<z.ZodNumber>;
1099
+ canRate: z.ZodBoolean;
1100
+ }, z.core.$strip>;
997
1101
  seo: z.ZodObject<{
998
1102
  metaTitle: z.ZodString;
999
1103
  metaDescription: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/domains/products/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;EAA2D,CAAC;AAC1F,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQlC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKI,CAAC;AAEtC,eAAO,MAAM,2BAA2B;;;;;;;iBAAwD,CAAC;AACjG,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMA,CAAC;AAEtC,eAAO,MAAM,uBAAuB;;;;;;;;;;;;CAKC,CAAC;AAEtC,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOD,CAAC;AAEtC,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMjB,CAAC"}
@@ -0,0 +1,286 @@
1
+ import { z } from "zod";
2
+ export declare const ProductRatingValueSchema: z.ZodNumber;
3
+ export type ProductRatingValue = z.infer<typeof ProductRatingValueSchema>;
4
+ export declare const ProductRatingDistributionSchema: z.ZodObject<{
5
+ 1: z.ZodNumber;
6
+ 2: z.ZodNumber;
7
+ 3: z.ZodNumber;
8
+ 4: z.ZodNumber;
9
+ 5: z.ZodNumber;
10
+ }, z.core.$strip>;
11
+ export type ProductRatingDistribution = z.infer<typeof ProductRatingDistributionSchema>;
12
+ export declare const ProductRatingSummarySchema: z.ZodObject<{
13
+ average: z.ZodNumber;
14
+ count: z.ZodNumber;
15
+ distribution: z.ZodObject<{
16
+ 1: z.ZodNumber;
17
+ 2: z.ZodNumber;
18
+ 3: z.ZodNumber;
19
+ 4: z.ZodNumber;
20
+ 5: z.ZodNumber;
21
+ }, z.core.$strip>;
22
+ userRating: z.ZodNullable<z.ZodNumber>;
23
+ canRate: z.ZodBoolean;
24
+ }, z.core.$strip>;
25
+ export type ProductRatingSummary = z.infer<typeof ProductRatingSummarySchema>;
26
+ export declare const ProductReviewAuthorSchema: z.ZodObject<{
27
+ displayName: z.ZodString;
28
+ }, z.core.$strip>;
29
+ export type ProductReviewAuthor = z.infer<typeof ProductReviewAuthorSchema>;
30
+ export declare const ProductReviewSchema: z.ZodObject<{
31
+ id: z.ZodNumber;
32
+ author: z.ZodObject<{
33
+ displayName: z.ZodString;
34
+ }, z.core.$strip>;
35
+ rating: z.ZodNumber;
36
+ text: z.ZodNullable<z.ZodString>;
37
+ verifiedPurchase: z.ZodLiteral<true>;
38
+ isMine: z.ZodBoolean;
39
+ createdAt: z.ZodString;
40
+ updatedAt: z.ZodString;
41
+ }, z.core.$strip>;
42
+ export type ProductReview = z.infer<typeof ProductReviewSchema>;
43
+ export declare const ListProductReviewsQuerySchema: z.ZodObject<{
44
+ skip: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
45
+ take: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
46
+ rating: z.ZodOptional<z.ZodNumber>;
47
+ sort: z.ZodDefault<z.ZodEnum<{
48
+ newest: "newest";
49
+ highest: "highest";
50
+ lowest: "lowest";
51
+ }>>;
52
+ }, z.core.$strip>;
53
+ export type ListProductReviewsQuery = z.infer<typeof ListProductReviewsQuerySchema>;
54
+ export declare const CreateProductReviewRequestSchema: z.ZodObject<{
55
+ rating: z.ZodNumber;
56
+ text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
57
+ }, z.core.$strip>;
58
+ export type CreateProductReviewRequest = z.infer<typeof CreateProductReviewRequestSchema>;
59
+ export declare const UpdateProductReviewRequestSchema: z.ZodObject<{
60
+ rating: z.ZodNumber;
61
+ text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
62
+ }, z.core.$strip>;
63
+ export type UpdateProductReviewRequest = z.infer<typeof UpdateProductReviewRequestSchema>;
64
+ export declare const GetProductRatingEndpoint: {
65
+ readonly method: "GET";
66
+ readonly path: "/api/products/:slug/rating";
67
+ readonly params: z.ZodObject<{
68
+ slug: z.ZodString;
69
+ }, z.core.$strip>;
70
+ readonly response: z.ZodObject<{
71
+ average: z.ZodNumber;
72
+ count: z.ZodNumber;
73
+ distribution: z.ZodObject<{
74
+ 1: z.ZodNumber;
75
+ 2: z.ZodNumber;
76
+ 3: z.ZodNumber;
77
+ 4: z.ZodNumber;
78
+ 5: z.ZodNumber;
79
+ }, z.core.$strip>;
80
+ userRating: z.ZodNullable<z.ZodNumber>;
81
+ canRate: z.ZodBoolean;
82
+ }, z.core.$strip>;
83
+ };
84
+ export declare const ListProductReviewsEndpoint: {
85
+ readonly method: "GET";
86
+ readonly path: "/api/products/:slug/reviews";
87
+ readonly params: z.ZodObject<{
88
+ slug: z.ZodString;
89
+ }, z.core.$strip>;
90
+ readonly query: z.ZodObject<{
91
+ skip: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
92
+ take: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
93
+ rating: z.ZodOptional<z.ZodNumber>;
94
+ sort: z.ZodDefault<z.ZodEnum<{
95
+ newest: "newest";
96
+ highest: "highest";
97
+ lowest: "lowest";
98
+ }>>;
99
+ }, z.core.$strip>;
100
+ readonly response: z.ZodObject<{
101
+ items: z.ZodArray<z.ZodObject<{
102
+ id: z.ZodNumber;
103
+ author: z.ZodObject<{
104
+ displayName: z.ZodString;
105
+ }, z.core.$strip>;
106
+ rating: z.ZodNumber;
107
+ text: z.ZodNullable<z.ZodString>;
108
+ verifiedPurchase: z.ZodLiteral<true>;
109
+ isMine: z.ZodBoolean;
110
+ createdAt: z.ZodString;
111
+ updatedAt: z.ZodString;
112
+ }, z.core.$strip>>;
113
+ total: z.ZodNumber;
114
+ skip: z.ZodNumber;
115
+ take: z.ZodNumber;
116
+ }, z.core.$strip>;
117
+ };
118
+ export declare const CreateProductReviewEndpoint: {
119
+ readonly method: "POST";
120
+ readonly path: "/api/products/:slug/review";
121
+ readonly params: z.ZodObject<{
122
+ slug: z.ZodString;
123
+ }, z.core.$strip>;
124
+ readonly request: z.ZodObject<{
125
+ rating: z.ZodNumber;
126
+ text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
127
+ }, z.core.$strip>;
128
+ readonly response: z.ZodObject<{
129
+ id: z.ZodNumber;
130
+ author: z.ZodObject<{
131
+ displayName: z.ZodString;
132
+ }, z.core.$strip>;
133
+ rating: z.ZodNumber;
134
+ text: z.ZodNullable<z.ZodString>;
135
+ verifiedPurchase: z.ZodLiteral<true>;
136
+ isMine: z.ZodBoolean;
137
+ createdAt: z.ZodString;
138
+ updatedAt: z.ZodString;
139
+ }, z.core.$strip>;
140
+ readonly requiresAuth: true;
141
+ readonly rateLimit: {
142
+ readonly limit: 5;
143
+ readonly ttlSec: 60;
144
+ };
145
+ };
146
+ export declare const UpdateProductReviewEndpoint: {
147
+ readonly method: "PUT";
148
+ readonly path: "/api/products/:slug/review";
149
+ readonly params: z.ZodObject<{
150
+ slug: z.ZodString;
151
+ }, z.core.$strip>;
152
+ readonly request: z.ZodObject<{
153
+ rating: z.ZodNumber;
154
+ text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
155
+ }, z.core.$strip>;
156
+ readonly response: z.ZodObject<{
157
+ id: z.ZodNumber;
158
+ author: z.ZodObject<{
159
+ displayName: z.ZodString;
160
+ }, z.core.$strip>;
161
+ rating: z.ZodNumber;
162
+ text: z.ZodNullable<z.ZodString>;
163
+ verifiedPurchase: z.ZodLiteral<true>;
164
+ isMine: z.ZodBoolean;
165
+ createdAt: z.ZodString;
166
+ updatedAt: z.ZodString;
167
+ }, z.core.$strip>;
168
+ readonly requiresAuth: true;
169
+ readonly rateLimit: {
170
+ readonly limit: 5;
171
+ readonly ttlSec: 60;
172
+ };
173
+ };
174
+ export declare const ProductReviewEndpoints: {
175
+ readonly rating: {
176
+ readonly method: "GET";
177
+ readonly path: "/api/products/:slug/rating";
178
+ readonly params: z.ZodObject<{
179
+ slug: z.ZodString;
180
+ }, z.core.$strip>;
181
+ readonly response: z.ZodObject<{
182
+ average: z.ZodNumber;
183
+ count: z.ZodNumber;
184
+ distribution: z.ZodObject<{
185
+ 1: z.ZodNumber;
186
+ 2: z.ZodNumber;
187
+ 3: z.ZodNumber;
188
+ 4: z.ZodNumber;
189
+ 5: z.ZodNumber;
190
+ }, z.core.$strip>;
191
+ userRating: z.ZodNullable<z.ZodNumber>;
192
+ canRate: z.ZodBoolean;
193
+ }, z.core.$strip>;
194
+ };
195
+ readonly list: {
196
+ readonly method: "GET";
197
+ readonly path: "/api/products/:slug/reviews";
198
+ readonly params: z.ZodObject<{
199
+ slug: z.ZodString;
200
+ }, z.core.$strip>;
201
+ readonly query: z.ZodObject<{
202
+ skip: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
203
+ take: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
204
+ rating: z.ZodOptional<z.ZodNumber>;
205
+ sort: z.ZodDefault<z.ZodEnum<{
206
+ newest: "newest";
207
+ highest: "highest";
208
+ lowest: "lowest";
209
+ }>>;
210
+ }, z.core.$strip>;
211
+ readonly response: z.ZodObject<{
212
+ items: z.ZodArray<z.ZodObject<{
213
+ id: z.ZodNumber;
214
+ author: z.ZodObject<{
215
+ displayName: z.ZodString;
216
+ }, z.core.$strip>;
217
+ rating: z.ZodNumber;
218
+ text: z.ZodNullable<z.ZodString>;
219
+ verifiedPurchase: z.ZodLiteral<true>;
220
+ isMine: z.ZodBoolean;
221
+ createdAt: z.ZodString;
222
+ updatedAt: z.ZodString;
223
+ }, z.core.$strip>>;
224
+ total: z.ZodNumber;
225
+ skip: z.ZodNumber;
226
+ take: z.ZodNumber;
227
+ }, z.core.$strip>;
228
+ };
229
+ readonly create: {
230
+ readonly method: "POST";
231
+ readonly path: "/api/products/:slug/review";
232
+ readonly params: z.ZodObject<{
233
+ slug: z.ZodString;
234
+ }, z.core.$strip>;
235
+ readonly request: z.ZodObject<{
236
+ rating: z.ZodNumber;
237
+ text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
238
+ }, z.core.$strip>;
239
+ readonly response: z.ZodObject<{
240
+ id: z.ZodNumber;
241
+ author: z.ZodObject<{
242
+ displayName: z.ZodString;
243
+ }, z.core.$strip>;
244
+ rating: z.ZodNumber;
245
+ text: z.ZodNullable<z.ZodString>;
246
+ verifiedPurchase: z.ZodLiteral<true>;
247
+ isMine: z.ZodBoolean;
248
+ createdAt: z.ZodString;
249
+ updatedAt: z.ZodString;
250
+ }, z.core.$strip>;
251
+ readonly requiresAuth: true;
252
+ readonly rateLimit: {
253
+ readonly limit: 5;
254
+ readonly ttlSec: 60;
255
+ };
256
+ };
257
+ readonly update: {
258
+ readonly method: "PUT";
259
+ readonly path: "/api/products/:slug/review";
260
+ readonly params: z.ZodObject<{
261
+ slug: z.ZodString;
262
+ }, z.core.$strip>;
263
+ readonly request: z.ZodObject<{
264
+ rating: z.ZodNumber;
265
+ text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
266
+ }, z.core.$strip>;
267
+ readonly response: z.ZodObject<{
268
+ id: z.ZodNumber;
269
+ author: z.ZodObject<{
270
+ displayName: z.ZodString;
271
+ }, z.core.$strip>;
272
+ rating: z.ZodNumber;
273
+ text: z.ZodNullable<z.ZodString>;
274
+ verifiedPurchase: z.ZodLiteral<true>;
275
+ isMine: z.ZodBoolean;
276
+ createdAt: z.ZodString;
277
+ updatedAt: z.ZodString;
278
+ }, z.core.$strip>;
279
+ readonly requiresAuth: true;
280
+ readonly rateLimit: {
281
+ readonly limit: 5;
282
+ readonly ttlSec: 60;
283
+ };
284
+ };
285
+ };
286
+ //# sourceMappingURL=reviews.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reviews.d.ts","sourceRoot":"","sources":["../../../src/domains/products/reviews.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,wBAAwB,aAAiC,CAAC;AACvE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,+BAA+B;;;;;;iBAM1C,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;iBAMrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,yBAAyB;;iBAEpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,mBAAmB;;;;;;;;;;;iBAS9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,6BAA6B;;;;;;;;;iBAGxC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,eAAO,MAAM,gCAAgC;;;iBAG3C,CAAC;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAE1F,eAAO,MAAM,gCAAgC;;;iBAAmC,CAAC;AACjF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAE1F,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;CAKA,CAAC;AAEtC,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMF,CAAC;AAEtC,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQH,CAAC;AAEtC,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQH,CAAC;AAEtC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKzB,CAAC"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductReviewEndpoints = exports.UpdateProductReviewEndpoint = exports.CreateProductReviewEndpoint = exports.ListProductReviewsEndpoint = exports.GetProductRatingEndpoint = exports.UpdateProductReviewRequestSchema = exports.CreateProductReviewRequestSchema = exports.ListProductReviewsQuerySchema = exports.ProductReviewSchema = exports.ProductReviewAuthorSchema = exports.ProductRatingSummarySchema = exports.ProductRatingDistributionSchema = exports.ProductRatingValueSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const common_1 = require("../../shared/common");
6
+ const pagination_1 = require("../../shared/pagination");
7
+ exports.ProductRatingValueSchema = zod_1.z.number().int().min(1).max(5);
8
+ exports.ProductRatingDistributionSchema = zod_1.z.object({
9
+ 1: zod_1.z.number().int().nonnegative(),
10
+ 2: zod_1.z.number().int().nonnegative(),
11
+ 3: zod_1.z.number().int().nonnegative(),
12
+ 4: zod_1.z.number().int().nonnegative(),
13
+ 5: zod_1.z.number().int().nonnegative(),
14
+ });
15
+ exports.ProductRatingSummarySchema = zod_1.z.object({
16
+ average: zod_1.z.number().min(0).max(5),
17
+ count: zod_1.z.number().int().nonnegative(),
18
+ distribution: exports.ProductRatingDistributionSchema,
19
+ userRating: exports.ProductRatingValueSchema.nullable(),
20
+ canRate: zod_1.z.boolean(),
21
+ });
22
+ exports.ProductReviewAuthorSchema = zod_1.z.object({
23
+ displayName: zod_1.z.string().min(1).max(128),
24
+ });
25
+ exports.ProductReviewSchema = zod_1.z.object({
26
+ id: zod_1.z.number().int().positive(),
27
+ author: exports.ProductReviewAuthorSchema,
28
+ rating: exports.ProductRatingValueSchema,
29
+ text: zod_1.z.string().nullable(),
30
+ verifiedPurchase: zod_1.z.literal(true),
31
+ isMine: zod_1.z.boolean(),
32
+ createdAt: zod_1.z.string(),
33
+ updatedAt: zod_1.z.string(),
34
+ });
35
+ exports.ListProductReviewsQuerySchema = pagination_1.PaginationQuerySchema.extend({
36
+ rating: exports.ProductRatingValueSchema.optional(),
37
+ sort: zod_1.z.enum(["newest", "highest", "lowest"]).default("newest"),
38
+ });
39
+ exports.CreateProductReviewRequestSchema = zod_1.z.object({
40
+ rating: exports.ProductRatingValueSchema,
41
+ text: zod_1.z.string().max(2_000).nullable().optional(),
42
+ });
43
+ exports.UpdateProductReviewRequestSchema = exports.CreateProductReviewRequestSchema;
44
+ exports.GetProductRatingEndpoint = {
45
+ method: "GET",
46
+ path: "/api/products/:slug/rating",
47
+ params: common_1.SlugParamSchema,
48
+ response: exports.ProductRatingSummarySchema,
49
+ };
50
+ exports.ListProductReviewsEndpoint = {
51
+ method: "GET",
52
+ path: "/api/products/:slug/reviews",
53
+ params: common_1.SlugParamSchema,
54
+ query: exports.ListProductReviewsQuerySchema,
55
+ response: (0, pagination_1.PaginatedResponseSchema)(exports.ProductReviewSchema),
56
+ };
57
+ exports.CreateProductReviewEndpoint = {
58
+ method: "POST",
59
+ path: "/api/products/:slug/review",
60
+ params: common_1.SlugParamSchema,
61
+ request: exports.CreateProductReviewRequestSchema,
62
+ response: exports.ProductReviewSchema,
63
+ requiresAuth: true,
64
+ rateLimit: { limit: 5, ttlSec: 60 },
65
+ };
66
+ exports.UpdateProductReviewEndpoint = {
67
+ method: "PUT",
68
+ path: "/api/products/:slug/review",
69
+ params: common_1.SlugParamSchema,
70
+ request: exports.UpdateProductReviewRequestSchema,
71
+ response: exports.ProductReviewSchema,
72
+ requiresAuth: true,
73
+ rateLimit: { limit: 5, ttlSec: 60 },
74
+ };
75
+ exports.ProductReviewEndpoints = {
76
+ rating: exports.GetProductRatingEndpoint,
77
+ list: exports.ListProductReviewsEndpoint,
78
+ create: exports.CreateProductReviewEndpoint,
79
+ update: exports.UpdateProductReviewEndpoint,
80
+ };
81
+ //# sourceMappingURL=reviews.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reviews.js","sourceRoot":"","sources":["../../../src/domains/products/reviews.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,gDAAsD;AACtD,wDAAyF;AAE5E,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAG1D,QAAA,+BAA+B,GAAG,OAAC,C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