@aepstore-dev/contracts 1.63.0 → 1.65.0

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.
@@ -1,173 +1,173 @@
1
- syntax = "proto3";
2
-
3
- package products.v1;
4
-
5
- service ProductsService {
6
- rpc Create(CreateProductRequest) returns (ProductResponse);
7
- rpc FindAll(QueryProductsRequest) returns (ProductsListResponse);
8
- rpc FindAllApproved(QueryProductsRequest) returns (ProductsListResponse);
9
- rpc FindMy(FindMyRequest) returns (ProductsListResponse);
10
- rpc FindOne(FindOneRequest) returns (ProductResponse);
11
- rpc Update(UpdateProductRequest) returns (ProductResponse);
12
- rpc Remove(RemoveProductRequest) returns (Ok);
13
- rpc Restore(RestoreProductRequest) returns (ProductResponse);
14
- rpc SubmitForModeration(SubmitForModerationRequest) returns (ProductResponse);
15
- rpc GetPriceRange(Empty) returns (PriceRangeResponse);
16
-
17
- rpc AddToFavorites(FavoriteRequest) returns (Ok);
18
- rpc RemoveFromFavorites(FavoriteRequest) returns (Ok);
19
-
20
- rpc SaveMediaMetadata(SaveMediaMetadataRequest) returns (ProductResponse);
21
- rpc SaveAttachmentMetadata(SaveAttachmentMetadataRequest) returns (ProductResponse);
22
- rpc RemoveMedia(RemoveMediaRequest) returns (ProductResponse);
23
- rpc RemoveAttachment(RemoveAttachmentRequest) returns (ProductResponse);
24
-
25
- rpc GetProductsForModeration(ProductModerationQueryRequest) returns (ProductsListResponse);
26
- rpc ModerateProduct(ModerateProductRequest) returns (ModerationResponse);
27
- rpc ResubmitProduct(ResubmitProductRequest) returns (ProductResponse);
28
-
29
- rpc GetSecureDownloadLinks(GetSecureDownloadLinksRequest) returns (SecureDownloadLinksResponse);
30
- rpc GetAttachmentDownloadInfo(GetAttachmentDownloadInfoRequest) returns (AttachmentDownloadInfoResponse);
31
- // Single presigned GET URL for one attachment (after purchase/access check).
32
- // Bytes never traverse the backend — see upload-service.
33
- rpc GetAttachmentDownloadUrl(GetAttachmentDownloadUrlRequest) returns (AttachmentDownloadUrlResponse);
34
-
35
- rpc GetTopProduct(TopProductRequest) returns (ProductResponse);
36
- rpc GetPopularProducts(QueryProductsRequest) returns (ProductsListResponse);
37
- }
38
-
39
- // =================================================================
40
- // Enums
41
- // =================================================================
42
-
43
- // Member names match the DB enum string values exactly (enums: String on the
44
- // wire) so values pass straight through with no mapping. UNSPECIFIED=0 covers
45
- // null/optional (e.g. nullable moderation_status, missing list filters).
46
- enum ProductStatus {
47
- PRODUCT_STATUS_UNSPECIFIED = 0;
48
- ACTIVE = 1;
49
- DRAFT = 2;
50
- }
51
-
52
- enum ModerationStatus {
53
- MODERATION_STATUS_UNSPECIFIED = 0;
54
- PENDING = 1;
55
- APPROVED = 2;
56
- REJECTED = 3;
57
- }
58
-
59
- enum MediaType {
60
- MEDIA_TYPE_UNSPECIFIED = 0;
61
- IMAGE = 1;
62
- VIDEO = 2;
63
- }
64
-
65
- // =================================================================
66
- // Nested entities
67
- // =================================================================
68
-
69
- message Category {
70
- string id = 1;
71
- string name = 2;
72
- }
73
-
74
- message Application {
75
- string id = 1;
76
- string name = 2;
77
- }
78
-
79
- message Tag {
80
- string id = 1;
81
- string name = 2;
82
- }
83
-
84
- message ProductMedia {
85
- string id = 1;
86
- string url = 2;
87
- MediaType type = 3;
88
- }
89
-
90
- message Attachment {
91
- string id = 1;
92
- string url = 2;
93
- string file_key = 3;
94
- string file_name = 4;
95
- double file_size = 5;
96
- string created_at = 6;
97
- }
98
-
99
- message ProductUser {
100
- string id = 1;
101
- string username = 2;
102
- string avatar_url = 3;
103
- }
104
-
105
- // Moderation block — null on the product while it's a DRAFT / never submitted.
106
- // status is one of PENDING | APPROVED | REJECTED (never UNSPECIFIED here).
107
- message ProductModeration {
108
- ModerationStatus status = 1;
109
- string comment = 2; // moderator note (mainly on REJECTED)
110
- string moderated_by = 3; // moderator user id
111
- string moderated_at = 4; // ISO 8601
112
- }
113
-
114
- message Product {
115
- reserved 9, 10, 11, 12; // retired flat moderation fields → see `moderation`
116
- string id = 1;
117
- string name = 2;
118
- string description = 3;
119
- string price = 4; // Decimal as string (D7), in `currency`
120
- string discount_percent = 5; // Decimal as string
1
+ syntax = "proto3";
2
+
3
+ package products.v1;
4
+
5
+ service ProductsService {
6
+ rpc Create(CreateProductRequest) returns (ProductResponse);
7
+ rpc FindAll(QueryProductsRequest) returns (ProductsListResponse);
8
+ rpc FindAllApproved(QueryProductsRequest) returns (ProductsListResponse);
9
+ rpc FindMy(FindMyRequest) returns (ProductsListResponse);
10
+ rpc FindOne(FindOneRequest) returns (ProductResponse);
11
+ rpc Update(UpdateProductRequest) returns (ProductResponse);
12
+ rpc Remove(RemoveProductRequest) returns (Ok);
13
+ rpc Restore(RestoreProductRequest) returns (ProductResponse);
14
+ rpc SubmitForModeration(SubmitForModerationRequest) returns (ProductResponse);
15
+ rpc GetPriceRange(Empty) returns (PriceRangeResponse);
16
+
17
+ rpc AddToFavorites(FavoriteRequest) returns (Ok);
18
+ rpc RemoveFromFavorites(FavoriteRequest) returns (Ok);
19
+
20
+ rpc SaveMediaMetadata(SaveMediaMetadataRequest) returns (ProductResponse);
21
+ rpc SaveAttachmentMetadata(SaveAttachmentMetadataRequest) returns (ProductResponse);
22
+ rpc RemoveMedia(RemoveMediaRequest) returns (ProductResponse);
23
+ rpc RemoveAttachment(RemoveAttachmentRequest) returns (ProductResponse);
24
+
25
+ rpc GetProductsForModeration(ProductModerationQueryRequest) returns (ProductsListResponse);
26
+ rpc ModerateProduct(ModerateProductRequest) returns (ModerationResponse);
27
+ rpc ResubmitProduct(ResubmitProductRequest) returns (ProductResponse);
28
+
29
+ rpc GetSecureDownloadLinks(GetSecureDownloadLinksRequest) returns (SecureDownloadLinksResponse);
30
+ rpc GetAttachmentDownloadInfo(GetAttachmentDownloadInfoRequest) returns (AttachmentDownloadInfoResponse);
31
+ // Single presigned GET URL for one attachment (after purchase/access check).
32
+ // Bytes never traverse the backend — see upload-service.
33
+ rpc GetAttachmentDownloadUrl(GetAttachmentDownloadUrlRequest) returns (AttachmentDownloadUrlResponse);
34
+
35
+ rpc GetTopProduct(TopProductRequest) returns (ProductResponse);
36
+ rpc GetPopularProducts(QueryProductsRequest) returns (ProductsListResponse);
37
+ }
38
+
39
+ // =================================================================
40
+ // Enums
41
+ // =================================================================
42
+
43
+ // Member names match the DB enum string values exactly (enums: String on the
44
+ // wire) so values pass straight through with no mapping. UNSPECIFIED=0 covers
45
+ // null/optional (e.g. nullable moderation_status, missing list filters).
46
+ enum ProductStatus {
47
+ PRODUCT_STATUS_UNSPECIFIED = 0;
48
+ ACTIVE = 1;
49
+ DRAFT = 2;
50
+ }
51
+
52
+ enum ModerationStatus {
53
+ MODERATION_STATUS_UNSPECIFIED = 0;
54
+ PENDING = 1;
55
+ APPROVED = 2;
56
+ REJECTED = 3;
57
+ }
58
+
59
+ enum MediaType {
60
+ MEDIA_TYPE_UNSPECIFIED = 0;
61
+ IMAGE = 1;
62
+ VIDEO = 2;
63
+ }
64
+
65
+ // =================================================================
66
+ // Nested entities
67
+ // =================================================================
68
+
69
+ message Category {
70
+ string id = 1;
71
+ string name = 2;
72
+ }
73
+
74
+ message Application {
75
+ string id = 1;
76
+ string name = 2;
77
+ }
78
+
79
+ message Tag {
80
+ string id = 1;
81
+ string name = 2;
82
+ }
83
+
84
+ message ProductMedia {
85
+ string id = 1;
86
+ string url = 2;
87
+ MediaType type = 3;
88
+ }
89
+
90
+ message Attachment {
91
+ string id = 1;
92
+ string url = 2;
93
+ string file_key = 3;
94
+ string file_name = 4;
95
+ double file_size = 5;
96
+ string created_at = 6;
97
+ }
98
+
99
+ message ProductUser {
100
+ string id = 1;
101
+ string username = 2;
102
+ string avatar_url = 3;
103
+ }
104
+
105
+ // Moderation block — null on the product while it's a DRAFT / never submitted.
106
+ // status is one of PENDING | APPROVED | REJECTED (never UNSPECIFIED here).
107
+ message ProductModeration {
108
+ ModerationStatus status = 1;
109
+ string comment = 2; // moderator note (mainly on REJECTED)
110
+ string moderated_by = 3; // moderator user id
111
+ string moderated_at = 4; // ISO 8601
112
+ }
113
+
114
+ message Product {
115
+ reserved 9, 10, 11, 12; // retired flat moderation fields → see `moderation`
116
+ string id = 1;
117
+ string name = 2;
118
+ string description = 3;
119
+ string price = 4; // Decimal as string (D7), in `currency`
120
+ string discount_percent = 5; // Decimal as string
121
121
  string final_price = 6; // Decimal as string, in `currency`
122
122
  // Converted final_price display amounts by currency (RUB/USD/EUR).
123
123
  // Not persisted; computed from the cached payments-service FX rates.
124
124
  map<string, string> prices = 36;
125
125
  string average_rating = 7; // double as string for consistency
126
- ProductStatus status = 8;
127
- // Listing currency the seller priced in: RUB | USD | EUR (default RUB).
128
- // Settlement/ledger is always RUB — conversion is snapshotted at checkout.
129
- string currency = 35;
130
- ProductModeration moderation = 32; // null while DRAFT / not yet submitted
131
- string created_at = 13;
132
- string updated_at = 14;
133
- string deleted_at = 34; // ISO 8601 when soft-deleted, empty/null otherwise
134
- string preview = 15;
135
- string video = 16;
136
- ProductUser user = 17;
137
- repeated ProductMedia media = 18;
138
- repeated Category categories = 19;
139
- repeated Application applications = 20;
140
- repeated Tag tags = 21;
141
-
142
- // Aggregate counts (populated where the query includes _count).
143
- int32 favorites_count = 22;
144
- int32 views_count = 23;
145
- int32 reviews_count = 24;
146
-
147
- // Viewer-contextual flags (populated by FindOne when a viewer is known).
148
- bool owner = 25;
149
- bool is_favorite = 26;
150
- bool is_viewed = 27;
151
- string revenue = 28; // owner-only, current-month revenue (Decimal as string)
152
- bool is_buyed = 30; // viewer has a COMPLETED purchase of this product
153
- bool is_reviewed = 31; // viewer has already left a review on this product
154
-
155
- // Popularity (populated by GetTopProduct / GetPopularProducts).
156
- string popularity_score = 29; // double as string
157
-
158
- // OWNER-ONLY: the product's deliverable files. Populated by FindOne only
159
- // when the viewer is the product owner; empty for everyone else (never
160
- // exposes private attachment metadata to non-owners).
161
- repeated ProductAttachment attachments = 33;
162
- }
163
-
164
- message ProductAttachment {
165
- string id = 1;
166
- string file_name = 2;
167
- double file_size = 3;
168
- }
169
-
170
- // Compact product shape for "related products" — only the fields a card needs.
126
+ ProductStatus status = 8;
127
+ // Listing currency the seller priced in: RUB | USD | EUR (default RUB).
128
+ // Settlement/ledger is always RUB — conversion is snapshotted at checkout.
129
+ string currency = 35;
130
+ ProductModeration moderation = 32; // null while DRAFT / not yet submitted
131
+ string created_at = 13;
132
+ string updated_at = 14;
133
+ string deleted_at = 34; // ISO 8601 when soft-deleted, empty/null otherwise
134
+ string preview = 15;
135
+ string video = 16;
136
+ ProductUser user = 17;
137
+ repeated ProductMedia media = 18;
138
+ repeated Category categories = 19;
139
+ repeated Application applications = 20;
140
+ repeated Tag tags = 21;
141
+
142
+ // Aggregate counts (populated where the query includes _count).
143
+ int32 favorites_count = 22;
144
+ int32 views_count = 23;
145
+ int32 reviews_count = 24;
146
+
147
+ // Viewer-contextual flags (populated by FindOne when a viewer is known).
148
+ bool owner = 25;
149
+ bool is_favorite = 26;
150
+ bool is_viewed = 27;
151
+ string revenue = 28; // owner-only, current-month revenue (Decimal as string)
152
+ bool is_buyed = 30; // viewer has a COMPLETED purchase of this product
153
+ bool is_reviewed = 31; // viewer has already left a review on this product
154
+
155
+ // Popularity (populated by GetTopProduct / GetPopularProducts).
156
+ string popularity_score = 29; // double as string
157
+
158
+ // OWNER-ONLY: the product's deliverable files. Populated by FindOne only
159
+ // when the viewer is the product owner; empty for everyone else (never
160
+ // exposes private attachment metadata to non-owners).
161
+ repeated ProductAttachment attachments = 33;
162
+ }
163
+
164
+ message ProductAttachment {
165
+ string id = 1;
166
+ string file_name = 2;
167
+ double file_size = 3;
168
+ }
169
+
170
+ // Compact product shape for "related products" — only the fields a card needs.
171
171
  message RelatedProduct {
172
172
  string id = 1;
173
173
  string name = 2;
@@ -180,243 +180,243 @@ message RelatedProduct {
180
180
  string currency = 9; // RUB | USD | EUR
181
181
  map<string, string> prices = 10; // Converted final_price display amounts.
182
182
  }
183
-
184
- message ProductResponse {
185
- Product product = 1;
186
- // Populated only by FindOne: up to 2 other approved products by the same author.
187
- repeated RelatedProduct related_products = 2;
188
- }
189
-
190
- message TopProductRequest {
191
- // Optional. If set, the top product is searched only among this seller's products.
192
- string user_id = 1;
193
- }
194
-
195
- message ProductsListResponse {
196
- repeated Product items = 1;
197
- int32 total = 2;
198
- int32 page = 3;
199
- int32 limit = 4;
200
- }
201
-
202
- message Ok {
203
- bool ok = 1;
204
- }
205
-
206
- message Empty {}
207
-
208
- // =================================================================
209
- // Create / Update / Query
210
- // =================================================================
211
-
212
- message CreateProductRequest {
213
- string user_id = 1;
214
- string name = 2;
215
- string price = 3; // Decimal as string
216
- repeated string category_ids = 4;
217
- repeated string application_ids = 5;
218
- repeated string tags = 6;
219
- string discount_percent = 7; // optional
220
- string final_price = 8; // optional
221
- string video = 9;
222
- string description = 10;
223
- ProductStatus status = 11;
224
- string currency = 12; // RUB | USD | EUR; empty → RUB
225
- }
226
-
227
- message UpdateProductRequest {
228
- string user_id = 1;
229
- string id = 2;
230
- string name = 3;
231
- string description = 4;
232
- string price = 5;
233
- string discount_percent = 6;
234
- string final_price = 7;
235
- repeated string tags = 8;
236
- repeated string category_ids = 9;
237
- repeated string application_ids = 10;
238
- string currency = 11; // RUB | USD | EUR; empty → no change
239
- }
240
-
241
- message QueryProductsRequest {
242
- string search = 1;
243
- repeated string category_ids = 2;
244
- repeated string application_ids = 3;
245
- repeated string tags = 4;
246
- string min_price = 5;
247
- string max_price = 6;
248
- int32 page = 7;
249
- int32 limit = 8;
250
- string sort_by = 9; // createdAt | price | name | updatedAt | finalPrice
251
- string sort_order = 10; // asc | desc
252
- ProductStatus status = 11;
253
- ModerationStatus moderation_status = 12;
254
- bool deleted_only = 13; // owner-only list filter; used by /products/my?status=deleted
255
- }
256
-
257
- message FindMyRequest {
258
- string user_id = 1;
259
- QueryProductsRequest query = 2;
260
- }
261
-
262
- message FindOneRequest {
263
- string id = 1;
264
- string viewer_user_id = 2; // optional — to compute is_favorited etc.
265
- string viewer_key = 3; // dedup key for view counting (userId or hashed ip+ua)
266
- }
267
-
268
- message RemoveProductRequest {
269
- string id = 1;
270
- string user_id = 2;
271
- }
272
-
273
- message RestoreProductRequest {
274
- string id = 1;
275
- string user_id = 2;
276
- }
277
-
278
- message SubmitForModerationRequest {
279
- string id = 1;
280
- string user_id = 2;
281
- }
282
-
283
- message PriceRangeResponse {
284
- string min = 1; // Decimal as string
285
- string max = 2;
286
- }
287
-
288
- // =================================================================
289
- // Favorites
290
- // =================================================================
291
-
292
- message FavoriteRequest {
293
- string user_id = 1;
294
- string product_id = 2;
295
- }
296
-
297
- // =================================================================
298
- // Media / Attachments metadata
299
- // =================================================================
300
-
301
- message MediaFile {
302
- string url = 1;
303
- MediaType type = 2;
304
- }
305
-
306
- message SaveMediaMetadataRequest {
307
- string id = 1;
308
- string user_id = 2;
309
- repeated MediaFile files = 3;
310
- string upload_id = 4;
311
- }
312
-
313
- message AttachmentMeta {
314
- string url = 1;
315
- string file_key = 2;
316
- string file_name = 3;
317
- double file_size = 4;
318
- }
319
-
320
- message SaveAttachmentMetadataRequest {
321
- string id = 1;
322
- string user_id = 2;
323
- AttachmentMeta attachment = 3;
324
- string upload_id = 4;
325
- }
326
-
327
- message RemoveMediaRequest {
328
- string id = 1; // product id
329
- string user_id = 2;
330
- string media_id = 3;
331
- }
332
-
333
- message RemoveAttachmentRequest {
334
- string id = 1; // product id
335
- string user_id = 2;
336
- string attachment_id = 3;
337
- }
338
-
339
- // =================================================================
340
- // Moderation
341
- // =================================================================
342
-
343
- message ProductModerationQueryRequest {
344
- ModerationStatus status = 1;
345
- int32 page = 2;
346
- int32 limit = 3;
347
- string sort_by = 4;
348
- string sort_order = 5;
349
- }
350
-
351
- message ModerateProductRequest {
352
- string product_id = 1;
353
- string moderator_id = 2;
354
- string action = 3; // 'approve' | 'reject'
355
- string comment = 4;
356
- }
357
-
358
- message ModerationResponse {
359
- bool success = 1;
360
- string message = 2;
361
- Product product = 3;
362
- ModerationStatus moderation_status = 4;
363
- string moderation_comment = 5;
364
- string moderated_by = 6;
365
- string moderated_at = 7;
366
- }
367
-
368
- message ResubmitProductRequest {
369
- string product_id = 1;
370
- string user_id = 2;
371
- string comment = 3;
372
- // Free-form payload of changes — serialized as JSON string to keep the
373
- // legacy `any` shape without forcing a strict schema on a free-form patch.
374
- string changes_json = 4;
375
- }
376
-
377
- // =================================================================
378
- // Secure downloads
379
- // =================================================================
380
-
381
- message GetSecureDownloadLinksRequest {
382
- string product_id = 1;
383
- string user_id = 2;
384
- int32 expires_in = 3;
385
- }
386
-
387
- message SecureDownloadLink {
388
- string download_url = 1;
389
- int32 expires_in = 2;
390
- string file_name = 3;
391
- double file_size = 4;
392
- string attachment_id = 5;
393
- }
394
-
395
- message SecureDownloadLinksResponse {
396
- repeated SecureDownloadLink links = 1;
397
- }
398
-
399
- message GetAttachmentDownloadInfoRequest {
400
- string product_id = 1;
401
- string attachment_id = 2;
402
- string user_id = 3;
403
- }
404
-
405
- message AttachmentDownloadInfoResponse {
406
- string file_name = 1;
407
- double file_size = 2;
408
- string content_type = 3;
409
- }
410
-
411
- message GetAttachmentDownloadUrlRequest {
412
- string product_id = 1;
413
- string attachment_id = 2;
414
- string user_id = 3;
415
- }
416
-
417
- message AttachmentDownloadUrlResponse {
418
- string download_url = 1;
419
- int32 expires_in = 2;
420
- string file_name = 3;
421
- double file_size = 4;
422
- }
183
+
184
+ message ProductResponse {
185
+ Product product = 1;
186
+ // Populated only by FindOne: up to 2 other approved products by the same author.
187
+ repeated RelatedProduct related_products = 2;
188
+ }
189
+
190
+ message TopProductRequest {
191
+ // Optional. If set, the top product is searched only among this seller's products.
192
+ string user_id = 1;
193
+ }
194
+
195
+ message ProductsListResponse {
196
+ repeated Product items = 1;
197
+ int32 total = 2;
198
+ int32 page = 3;
199
+ int32 limit = 4;
200
+ }
201
+
202
+ message Ok {
203
+ bool ok = 1;
204
+ }
205
+
206
+ message Empty {}
207
+
208
+ // =================================================================
209
+ // Create / Update / Query
210
+ // =================================================================
211
+
212
+ message CreateProductRequest {
213
+ string user_id = 1;
214
+ string name = 2;
215
+ string price = 3; // Decimal as string
216
+ repeated string category_ids = 4;
217
+ repeated string application_ids = 5;
218
+ repeated string tags = 6;
219
+ string discount_percent = 7; // optional
220
+ string final_price = 8; // optional
221
+ string video = 9;
222
+ string description = 10;
223
+ ProductStatus status = 11;
224
+ string currency = 12; // RUB | USD | EUR; empty → RUB
225
+ }
226
+
227
+ message UpdateProductRequest {
228
+ string user_id = 1;
229
+ string id = 2;
230
+ string name = 3;
231
+ string description = 4;
232
+ string price = 5;
233
+ string discount_percent = 6;
234
+ string final_price = 7;
235
+ repeated string tags = 8;
236
+ repeated string category_ids = 9;
237
+ repeated string application_ids = 10;
238
+ string currency = 11; // RUB | USD | EUR; empty → no change
239
+ }
240
+
241
+ message QueryProductsRequest {
242
+ string search = 1;
243
+ repeated string category_ids = 2;
244
+ repeated string application_ids = 3;
245
+ repeated string tags = 4;
246
+ string min_price = 5;
247
+ string max_price = 6;
248
+ int32 page = 7;
249
+ int32 limit = 8;
250
+ string sort_by = 9; // createdAt | price | name | updatedAt | finalPrice
251
+ string sort_order = 10; // asc | desc
252
+ ProductStatus status = 11;
253
+ ModerationStatus moderation_status = 12;
254
+ bool deleted_only = 13; // owner-only list filter; used by /products/my?status=deleted
255
+ }
256
+
257
+ message FindMyRequest {
258
+ string user_id = 1;
259
+ QueryProductsRequest query = 2;
260
+ }
261
+
262
+ message FindOneRequest {
263
+ string id = 1;
264
+ string viewer_user_id = 2; // optional — to compute is_favorited etc.
265
+ string viewer_key = 3; // dedup key for view counting (userId or hashed ip+ua)
266
+ }
267
+
268
+ message RemoveProductRequest {
269
+ string id = 1;
270
+ string user_id = 2;
271
+ }
272
+
273
+ message RestoreProductRequest {
274
+ string id = 1;
275
+ string user_id = 2;
276
+ }
277
+
278
+ message SubmitForModerationRequest {
279
+ string id = 1;
280
+ string user_id = 2;
281
+ }
282
+
283
+ message PriceRangeResponse {
284
+ string min = 1; // Decimal as string
285
+ string max = 2;
286
+ }
287
+
288
+ // =================================================================
289
+ // Favorites
290
+ // =================================================================
291
+
292
+ message FavoriteRequest {
293
+ string user_id = 1;
294
+ string product_id = 2;
295
+ }
296
+
297
+ // =================================================================
298
+ // Media / Attachments metadata
299
+ // =================================================================
300
+
301
+ message MediaFile {
302
+ string url = 1;
303
+ MediaType type = 2;
304
+ }
305
+
306
+ message SaveMediaMetadataRequest {
307
+ string id = 1;
308
+ string user_id = 2;
309
+ repeated MediaFile files = 3;
310
+ string upload_id = 4;
311
+ }
312
+
313
+ message AttachmentMeta {
314
+ string url = 1;
315
+ string file_key = 2;
316
+ string file_name = 3;
317
+ double file_size = 4;
318
+ }
319
+
320
+ message SaveAttachmentMetadataRequest {
321
+ string id = 1;
322
+ string user_id = 2;
323
+ AttachmentMeta attachment = 3;
324
+ string upload_id = 4;
325
+ }
326
+
327
+ message RemoveMediaRequest {
328
+ string id = 1; // product id
329
+ string user_id = 2;
330
+ string media_id = 3;
331
+ }
332
+
333
+ message RemoveAttachmentRequest {
334
+ string id = 1; // product id
335
+ string user_id = 2;
336
+ string attachment_id = 3;
337
+ }
338
+
339
+ // =================================================================
340
+ // Moderation
341
+ // =================================================================
342
+
343
+ message ProductModerationQueryRequest {
344
+ ModerationStatus status = 1;
345
+ int32 page = 2;
346
+ int32 limit = 3;
347
+ string sort_by = 4;
348
+ string sort_order = 5;
349
+ }
350
+
351
+ message ModerateProductRequest {
352
+ string product_id = 1;
353
+ string moderator_id = 2;
354
+ string action = 3; // 'approve' | 'reject'
355
+ string comment = 4;
356
+ }
357
+
358
+ message ModerationResponse {
359
+ bool success = 1;
360
+ string message = 2;
361
+ Product product = 3;
362
+ ModerationStatus moderation_status = 4;
363
+ string moderation_comment = 5;
364
+ string moderated_by = 6;
365
+ string moderated_at = 7;
366
+ }
367
+
368
+ message ResubmitProductRequest {
369
+ string product_id = 1;
370
+ string user_id = 2;
371
+ string comment = 3;
372
+ // Free-form payload of changes — serialized as JSON string to keep the
373
+ // legacy `any` shape without forcing a strict schema on a free-form patch.
374
+ string changes_json = 4;
375
+ }
376
+
377
+ // =================================================================
378
+ // Secure downloads
379
+ // =================================================================
380
+
381
+ message GetSecureDownloadLinksRequest {
382
+ string product_id = 1;
383
+ string user_id = 2;
384
+ int32 expires_in = 3;
385
+ }
386
+
387
+ message SecureDownloadLink {
388
+ string download_url = 1;
389
+ int32 expires_in = 2;
390
+ string file_name = 3;
391
+ double file_size = 4;
392
+ string attachment_id = 5;
393
+ }
394
+
395
+ message SecureDownloadLinksResponse {
396
+ repeated SecureDownloadLink links = 1;
397
+ }
398
+
399
+ message GetAttachmentDownloadInfoRequest {
400
+ string product_id = 1;
401
+ string attachment_id = 2;
402
+ string user_id = 3;
403
+ }
404
+
405
+ message AttachmentDownloadInfoResponse {
406
+ string file_name = 1;
407
+ double file_size = 2;
408
+ string content_type = 3;
409
+ }
410
+
411
+ message GetAttachmentDownloadUrlRequest {
412
+ string product_id = 1;
413
+ string attachment_id = 2;
414
+ string user_id = 3;
415
+ }
416
+
417
+ message AttachmentDownloadUrlResponse {
418
+ string download_url = 1;
419
+ int32 expires_in = 2;
420
+ string file_name = 3;
421
+ double file_size = 4;
422
+ }