@mamindom/contracts 1.0.123 → 1.0.124

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.
@@ -868,6 +868,27 @@ export interface BulkLookupProductsRequest {
868
868
  export interface BulkLookupProductsResponse {
869
869
  results: ProductLookupResult[];
870
870
  }
871
+ export interface VariantLookupResult {
872
+ variantId: string;
873
+ productId: string;
874
+ sku: string;
875
+ found: boolean;
876
+ /** Резолвлена з урахуванням variant override. */
877
+ price: number;
878
+ oldPrice?: number | undefined;
879
+ stock: number;
880
+ hasOwnPrice: boolean;
881
+ /** Локалізована назва (uk → ru → перше) для зручності клієнта. */
882
+ nameUk: string;
883
+ mainImage: string;
884
+ colorId?: string | undefined;
885
+ }
886
+ export interface BulkLookupVariantsRequest {
887
+ variantIds: string[];
888
+ }
889
+ export interface BulkLookupVariantsResponse {
890
+ results: VariantLookupResult[];
891
+ }
871
892
  export interface ProductColorImagePayload {
872
893
  url: string;
873
894
  mediaId: string;
@@ -1004,6 +1025,7 @@ export interface ProductServiceClient {
1004
1025
  bulkUpdateSortOrder(request: BulkUpdateSortOrderRequest): Observable<SuccessResponse>;
1005
1026
  bulkSetPopular(request: BulkSetPopularRequest): Observable<SuccessResponse>;
1006
1027
  bulkLookupProducts(request: BulkLookupProductsRequest): Observable<BulkLookupProductsResponse>;
1028
+ bulkLookupVariants(request: BulkLookupVariantsRequest): Observable<BulkLookupVariantsResponse>;
1007
1029
  createProductGroup(request: CreateProductGroupRequest): Observable<ProductGroupResponse>;
1008
1030
  updateProductGroup(request: UpdateProductGroupRequest): Observable<ProductGroupResponse>;
1009
1031
  deleteProductGroup(request: DeleteProductGroupRequest): Observable<SuccessResponse>;
@@ -1050,6 +1072,7 @@ export interface ProductServiceController {
1050
1072
  bulkUpdateSortOrder(request: BulkUpdateSortOrderRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
1051
1073
  bulkSetPopular(request: BulkSetPopularRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
1052
1074
  bulkLookupProducts(request: BulkLookupProductsRequest): Promise<BulkLookupProductsResponse> | Observable<BulkLookupProductsResponse> | BulkLookupProductsResponse;
1075
+ bulkLookupVariants(request: BulkLookupVariantsRequest): Promise<BulkLookupVariantsResponse> | Observable<BulkLookupVariantsResponse> | BulkLookupVariantsResponse;
1053
1076
  createProductGroup(request: CreateProductGroupRequest): Promise<ProductGroupResponse> | Observable<ProductGroupResponse> | ProductGroupResponse;
1054
1077
  updateProductGroup(request: UpdateProductGroupRequest): Promise<ProductGroupResponse> | Observable<ProductGroupResponse> | ProductGroupResponse;
1055
1078
  deleteProductGroup(request: DeleteProductGroupRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
@@ -71,6 +71,7 @@ function ProductServiceControllerMethods() {
71
71
  "bulkUpdateSortOrder",
72
72
  "bulkSetPopular",
73
73
  "bulkLookupProducts",
74
+ "bulkLookupVariants",
74
75
  "createProductGroup",
75
76
  "updateProductGroup",
76
77
  "deleteProductGroup",
@@ -52,6 +52,7 @@ service ProductService {
52
52
  rpc BulkSetPopular (BulkSetPopularRequest) returns (SuccessResponse);
53
53
 
54
54
  rpc BulkLookupProducts (BulkLookupProductsRequest) returns (BulkLookupProductsResponse);
55
+ rpc BulkLookupVariants (BulkLookupVariantsRequest) returns (BulkLookupVariantsResponse);
55
56
 
56
57
 
57
58
  rpc CreateProductGroup (CreateProductGroupRequest) returns (ProductGroupResponse);
@@ -752,6 +753,36 @@ message BulkLookupProductsResponse {
752
753
  repeated ProductLookupResult results = 1;
753
754
  }
754
755
 
756
+ // ─── Bulk lookup variants by ID (for cart price snapshot) ────────────────────
757
+ //
758
+ // Використовується cart-service для отримання актуальної ціни саме за варіантом
759
+ // (variant.price якщо has_own_price, інакше product.price). Повертає достатньо
760
+ // для побудови line snapshot: ціна/стара ціна/назва/sku/stock/main_image.
761
+
762
+ message VariantLookupResult {
763
+ string variant_id = 1;
764
+ string product_id = 2;
765
+ string sku = 3;
766
+ bool found = 4;
767
+ // Резолвлена з урахуванням variant override.
768
+ double price = 5;
769
+ optional double old_price = 6;
770
+ int32 stock = 7;
771
+ bool has_own_price = 8;
772
+ // Локалізована назва (uk → ru → перше) для зручності клієнта.
773
+ string name_uk = 9;
774
+ string main_image = 10;
775
+ optional string color_id = 11;
776
+ }
777
+
778
+ message BulkLookupVariantsRequest {
779
+ repeated string variant_ids = 1;
780
+ }
781
+
782
+ message BulkLookupVariantsResponse {
783
+ repeated VariantLookupResult results = 1;
784
+ }
785
+
755
786
 
756
787
  // ─── Product colors ──────────────────────────────────────────────────────────
757
788
 
package/gen/product.ts CHANGED
@@ -889,6 +889,30 @@ export interface BulkLookupProductsResponse {
889
889
  results: ProductLookupResult[];
890
890
  }
891
891
 
892
+ export interface VariantLookupResult {
893
+ variantId: string;
894
+ productId: string;
895
+ sku: string;
896
+ found: boolean;
897
+ /** Резолвлена з урахуванням variant override. */
898
+ price: number;
899
+ oldPrice?: number | undefined;
900
+ stock: number;
901
+ hasOwnPrice: boolean;
902
+ /** Локалізована назва (uk → ru → перше) для зручності клієнта. */
903
+ nameUk: string;
904
+ mainImage: string;
905
+ colorId?: string | undefined;
906
+ }
907
+
908
+ export interface BulkLookupVariantsRequest {
909
+ variantIds: string[];
910
+ }
911
+
912
+ export interface BulkLookupVariantsResponse {
913
+ results: VariantLookupResult[];
914
+ }
915
+
892
916
  export interface ProductColorImagePayload {
893
917
  url: string;
894
918
  mediaId: string;
@@ -1054,6 +1078,8 @@ export interface ProductServiceClient {
1054
1078
 
1055
1079
  bulkLookupProducts(request: BulkLookupProductsRequest): Observable<BulkLookupProductsResponse>;
1056
1080
 
1081
+ bulkLookupVariants(request: BulkLookupVariantsRequest): Observable<BulkLookupVariantsResponse>;
1082
+
1057
1083
  createProductGroup(request: CreateProductGroupRequest): Observable<ProductGroupResponse>;
1058
1084
 
1059
1085
  updateProductGroup(request: UpdateProductGroupRequest): Observable<ProductGroupResponse>;
@@ -1192,6 +1218,10 @@ export interface ProductServiceController {
1192
1218
  request: BulkLookupProductsRequest,
1193
1219
  ): Promise<BulkLookupProductsResponse> | Observable<BulkLookupProductsResponse> | BulkLookupProductsResponse;
1194
1220
 
1221
+ bulkLookupVariants(
1222
+ request: BulkLookupVariantsRequest,
1223
+ ): Promise<BulkLookupVariantsResponse> | Observable<BulkLookupVariantsResponse> | BulkLookupVariantsResponse;
1224
+
1195
1225
  createProductGroup(
1196
1226
  request: CreateProductGroupRequest,
1197
1227
  ): Promise<ProductGroupResponse> | Observable<ProductGroupResponse> | ProductGroupResponse;
@@ -1295,6 +1325,7 @@ export function ProductServiceControllerMethods() {
1295
1325
  "bulkUpdateSortOrder",
1296
1326
  "bulkSetPopular",
1297
1327
  "bulkLookupProducts",
1328
+ "bulkLookupVariants",
1298
1329
  "createProductGroup",
1299
1330
  "updateProductGroup",
1300
1331
  "deleteProductGroup",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mamindom/contracts",
3
3
  "description": "proto",
4
- "version": "1.0.123",
4
+ "version": "1.0.124",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",
7
7
  "exports": {
@@ -52,6 +52,7 @@ service ProductService {
52
52
  rpc BulkSetPopular (BulkSetPopularRequest) returns (SuccessResponse);
53
53
 
54
54
  rpc BulkLookupProducts (BulkLookupProductsRequest) returns (BulkLookupProductsResponse);
55
+ rpc BulkLookupVariants (BulkLookupVariantsRequest) returns (BulkLookupVariantsResponse);
55
56
 
56
57
 
57
58
  rpc CreateProductGroup (CreateProductGroupRequest) returns (ProductGroupResponse);
@@ -752,6 +753,36 @@ message BulkLookupProductsResponse {
752
753
  repeated ProductLookupResult results = 1;
753
754
  }
754
755
 
756
+ // ─── Bulk lookup variants by ID (for cart price snapshot) ────────────────────
757
+ //
758
+ // Використовується cart-service для отримання актуальної ціни саме за варіантом
759
+ // (variant.price якщо has_own_price, інакше product.price). Повертає достатньо
760
+ // для побудови line snapshot: ціна/стара ціна/назва/sku/stock/main_image.
761
+
762
+ message VariantLookupResult {
763
+ string variant_id = 1;
764
+ string product_id = 2;
765
+ string sku = 3;
766
+ bool found = 4;
767
+ // Резолвлена з урахуванням variant override.
768
+ double price = 5;
769
+ optional double old_price = 6;
770
+ int32 stock = 7;
771
+ bool has_own_price = 8;
772
+ // Локалізована назва (uk → ru → перше) для зручності клієнта.
773
+ string name_uk = 9;
774
+ string main_image = 10;
775
+ optional string color_id = 11;
776
+ }
777
+
778
+ message BulkLookupVariantsRequest {
779
+ repeated string variant_ids = 1;
780
+ }
781
+
782
+ message BulkLookupVariantsResponse {
783
+ repeated VariantLookupResult results = 1;
784
+ }
785
+
755
786
 
756
787
  // ─── Product colors ──────────────────────────────────────────────────────────
757
788