@mercurjs/b2c-core 1.4.4 → 1.5.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.
- package/.medusa/server/src/api/admin/products/validators.d.ts +54 -54
- package/.medusa/server/src/api/admin/stock-locations/route.d.ts +1 -1
- package/.medusa/server/src/api/admin/stock-locations/route.js +21 -8
- package/.medusa/server/src/api/vendor/campaigns/[id]/route.d.ts +55 -4
- package/.medusa/server/src/api/vendor/campaigns/[id]/route.js +59 -3
- package/.medusa/server/src/api/vendor/campaigns/helpers.d.ts +4 -0
- package/.medusa/server/src/api/vendor/campaigns/helpers.js +34 -0
- package/.medusa/server/src/api/vendor/campaigns/middlewares.js +11 -11
- package/.medusa/server/src/api/vendor/campaigns/route.d.ts +2 -2
- package/.medusa/server/src/api/vendor/campaigns/route.js +34 -15
- package/.medusa/server/src/api/vendor/campaigns/validators.d.ts +191 -3
- package/.medusa/server/src/api/vendor/campaigns/validators.js +24 -15
- package/.medusa/server/src/api/vendor/product-types/route.d.ts +6 -0
- package/.medusa/server/src/api/vendor/product-types/route.js +8 -1
- package/.medusa/server/src/api/vendor/product-types/validators.d.ts +15 -4
- package/.medusa/server/src/api/vendor/product-types/validators.js +9 -3
- package/.medusa/server/src/api/vendor/products/[id]/variants/route.d.ts +127 -2
- package/.medusa/server/src/api/vendor/products/[id]/variants/route.js +149 -4
- package/.medusa/server/src/api/vendor/products/middlewares.js +12 -1
- package/.medusa/server/src/api/vendor/products/query-config.d.ts +12 -0
- package/.medusa/server/src/api/vendor/products/query-config.js +42 -2
- package/.medusa/server/src/api/vendor/products/route.js +3 -1
- package/.medusa/server/src/api/vendor/products/validators.d.ts +391 -54
- package/.medusa/server/src/api/vendor/products/validators.js +33 -2
- package/.medusa/server/src/api/vendor/promotions/middlewares.js +3 -1
- package/.medusa/server/src/api/vendor/promotions/rule-attribute-options/[rule_type]/route.d.ts +2 -1
- package/.medusa/server/src/api/vendor/promotions/rule-attribute-options/[rule_type]/route.js +8 -8
- package/.medusa/server/src/api/vendor/promotions/rule-value-options/[rule_type]/[rule_attribute_id]/route.d.ts +3 -64
- package/.medusa/server/src/api/vendor/promotions/rule-value-options/[rule_type]/[rule_attribute_id]/route.js +47 -24
- package/.medusa/server/src/api/vendor/promotions/utils.d.ts +4 -4
- package/.medusa/server/src/api/vendor/promotions/utils.js +50 -50
- package/.medusa/server/src/api/vendor/promotions/validators.d.ts +11 -10
- package/.medusa/server/src/api/vendor/promotions/validators.js +17 -5
- package/.medusa/server/src/api/vendor/uploads/route.js +1 -1
- package/.medusa/server/src/shared/infra/http/middlewares/types.d.ts +14 -0
- package/.medusa/server/src/shared/infra/http/middlewares/types.js +3 -0
- package/.medusa/server/src/shared/infra/http/middlewares/vendor-promotions-rule-attribute-options-path-params-guard.d.ts +3 -0
- package/.medusa/server/src/shared/infra/http/middlewares/vendor-promotions-rule-attribute-options-path-params-guard.js +24 -0
- package/.medusa/server/src/shared/infra/http/middlewares/vendor-promotions-rule-value-options-path-params-guard.d.ts +2 -1
- package/.medusa/server/src/shared/infra/http/middlewares/vendor-promotions-rule-value-options-path-params-guard.js +9 -1
- package/.medusa/server/src/shared/infra/http/utils/zod.d.ts +33 -0
- package/.medusa/server/src/shared/infra/http/utils/zod.js +28 -2
- package/.medusa/server/src/workflows/seller/steps/send-invitation-email.js +6 -2
- package/.medusa/server/src/workflows/seller/steps/validate-products-to-import.d.ts +4 -3
- package/package.json +1 -1
|
@@ -1043,6 +1043,8 @@ export declare const CreateProductVariant: z.ZodObject<{
|
|
|
1043
1043
|
}>, "many">>;
|
|
1044
1044
|
}, "strict", z.ZodTypeAny, {
|
|
1045
1045
|
title: string;
|
|
1046
|
+
allow_backorder: false;
|
|
1047
|
+
manage_inventory: true;
|
|
1046
1048
|
prices: {
|
|
1047
1049
|
currency_code: string;
|
|
1048
1050
|
amount: number;
|
|
@@ -1050,8 +1052,6 @@ export declare const CreateProductVariant: z.ZodObject<{
|
|
|
1050
1052
|
max_quantity?: number | null | undefined;
|
|
1051
1053
|
rules?: Record<string, string> | undefined;
|
|
1052
1054
|
}[];
|
|
1053
|
-
allow_backorder: false;
|
|
1054
|
-
manage_inventory: true;
|
|
1055
1055
|
length?: number | undefined;
|
|
1056
1056
|
options?: Record<string, string> | undefined;
|
|
1057
1057
|
width?: number | undefined;
|
|
@@ -1063,10 +1063,10 @@ export declare const CreateProductVariant: z.ZodObject<{
|
|
|
1063
1063
|
material?: string | undefined;
|
|
1064
1064
|
metadata?: Record<string, unknown> | undefined;
|
|
1065
1065
|
sku?: string | undefined;
|
|
1066
|
+
variant_rank?: number | undefined;
|
|
1066
1067
|
ean?: string | undefined;
|
|
1067
1068
|
upc?: string | undefined;
|
|
1068
1069
|
barcode?: string | undefined;
|
|
1069
|
-
variant_rank?: number | undefined;
|
|
1070
1070
|
inventory_items?: {
|
|
1071
1071
|
inventory_item_id: string;
|
|
1072
1072
|
required_quantity: number;
|
|
@@ -1091,12 +1091,12 @@ export declare const CreateProductVariant: z.ZodObject<{
|
|
|
1091
1091
|
material?: string | undefined;
|
|
1092
1092
|
metadata?: Record<string, unknown> | undefined;
|
|
1093
1093
|
sku?: string | undefined;
|
|
1094
|
-
ean?: string | undefined;
|
|
1095
|
-
upc?: string | undefined;
|
|
1096
|
-
barcode?: string | undefined;
|
|
1097
1094
|
allow_backorder?: false | undefined;
|
|
1098
1095
|
manage_inventory?: true | undefined;
|
|
1099
1096
|
variant_rank?: number | undefined;
|
|
1097
|
+
ean?: string | undefined;
|
|
1098
|
+
upc?: string | undefined;
|
|
1099
|
+
barcode?: string | undefined;
|
|
1100
1100
|
inventory_items?: {
|
|
1101
1101
|
inventory_item_id: string;
|
|
1102
1102
|
required_quantity: number;
|
|
@@ -1241,6 +1241,12 @@ export declare const UpdateProductVariant: z.ZodObject<{
|
|
|
1241
1241
|
material?: string | null | undefined;
|
|
1242
1242
|
metadata?: Record<string, unknown> | null | undefined;
|
|
1243
1243
|
sku?: string | null | undefined;
|
|
1244
|
+
allow_backorder?: boolean | undefined;
|
|
1245
|
+
manage_inventory?: boolean | undefined;
|
|
1246
|
+
variant_rank?: number | undefined;
|
|
1247
|
+
ean?: string | null | undefined;
|
|
1248
|
+
upc?: string | null | undefined;
|
|
1249
|
+
barcode?: string | null | undefined;
|
|
1244
1250
|
prices?: {
|
|
1245
1251
|
id?: string | undefined;
|
|
1246
1252
|
currency_code?: string | undefined;
|
|
@@ -1249,12 +1255,6 @@ export declare const UpdateProductVariant: z.ZodObject<{
|
|
|
1249
1255
|
max_quantity?: number | null | undefined;
|
|
1250
1256
|
rules?: Record<string, string> | undefined;
|
|
1251
1257
|
}[] | undefined;
|
|
1252
|
-
ean?: string | null | undefined;
|
|
1253
|
-
upc?: string | null | undefined;
|
|
1254
|
-
barcode?: string | null | undefined;
|
|
1255
|
-
allow_backorder?: boolean | undefined;
|
|
1256
|
-
manage_inventory?: boolean | undefined;
|
|
1257
|
-
variant_rank?: number | undefined;
|
|
1258
1258
|
}, {
|
|
1259
1259
|
length?: number | null | undefined;
|
|
1260
1260
|
options?: Record<string, string> | undefined;
|
|
@@ -1269,6 +1269,12 @@ export declare const UpdateProductVariant: z.ZodObject<{
|
|
|
1269
1269
|
material?: string | null | undefined;
|
|
1270
1270
|
metadata?: Record<string, unknown> | null | undefined;
|
|
1271
1271
|
sku?: string | null | undefined;
|
|
1272
|
+
allow_backorder?: boolean | undefined;
|
|
1273
|
+
manage_inventory?: boolean | undefined;
|
|
1274
|
+
variant_rank?: number | undefined;
|
|
1275
|
+
ean?: string | null | undefined;
|
|
1276
|
+
upc?: string | null | undefined;
|
|
1277
|
+
barcode?: string | null | undefined;
|
|
1272
1278
|
prices?: {
|
|
1273
1279
|
id?: string | undefined;
|
|
1274
1280
|
currency_code?: string | undefined;
|
|
@@ -1277,12 +1283,6 @@ export declare const UpdateProductVariant: z.ZodObject<{
|
|
|
1277
1283
|
max_quantity?: number | null | undefined;
|
|
1278
1284
|
rules?: Record<string, string> | undefined;
|
|
1279
1285
|
}[] | undefined;
|
|
1280
|
-
ean?: string | null | undefined;
|
|
1281
|
-
upc?: string | null | undefined;
|
|
1282
|
-
barcode?: string | null | undefined;
|
|
1283
|
-
allow_backorder?: boolean | undefined;
|
|
1284
|
-
manage_inventory?: boolean | undefined;
|
|
1285
|
-
variant_rank?: number | undefined;
|
|
1286
1286
|
}>;
|
|
1287
1287
|
/**
|
|
1288
1288
|
* @schema CreateProduct
|
|
@@ -1499,6 +1499,8 @@ export declare const CreateProduct: z.ZodObject<{
|
|
|
1499
1499
|
}>, "many">>;
|
|
1500
1500
|
}, "strict", z.ZodTypeAny, {
|
|
1501
1501
|
title: string;
|
|
1502
|
+
allow_backorder: false;
|
|
1503
|
+
manage_inventory: true;
|
|
1502
1504
|
prices: {
|
|
1503
1505
|
currency_code: string;
|
|
1504
1506
|
amount: number;
|
|
@@ -1506,8 +1508,6 @@ export declare const CreateProduct: z.ZodObject<{
|
|
|
1506
1508
|
max_quantity?: number | null | undefined;
|
|
1507
1509
|
rules?: Record<string, string> | undefined;
|
|
1508
1510
|
}[];
|
|
1509
|
-
allow_backorder: false;
|
|
1510
|
-
manage_inventory: true;
|
|
1511
1511
|
length?: number | undefined;
|
|
1512
1512
|
options?: Record<string, string> | undefined;
|
|
1513
1513
|
width?: number | undefined;
|
|
@@ -1519,10 +1519,10 @@ export declare const CreateProduct: z.ZodObject<{
|
|
|
1519
1519
|
material?: string | undefined;
|
|
1520
1520
|
metadata?: Record<string, unknown> | undefined;
|
|
1521
1521
|
sku?: string | undefined;
|
|
1522
|
+
variant_rank?: number | undefined;
|
|
1522
1523
|
ean?: string | undefined;
|
|
1523
1524
|
upc?: string | undefined;
|
|
1524
1525
|
barcode?: string | undefined;
|
|
1525
|
-
variant_rank?: number | undefined;
|
|
1526
1526
|
inventory_items?: {
|
|
1527
1527
|
inventory_item_id: string;
|
|
1528
1528
|
required_quantity: number;
|
|
@@ -1547,12 +1547,12 @@ export declare const CreateProduct: z.ZodObject<{
|
|
|
1547
1547
|
material?: string | undefined;
|
|
1548
1548
|
metadata?: Record<string, unknown> | undefined;
|
|
1549
1549
|
sku?: string | undefined;
|
|
1550
|
-
ean?: string | undefined;
|
|
1551
|
-
upc?: string | undefined;
|
|
1552
|
-
barcode?: string | undefined;
|
|
1553
1550
|
allow_backorder?: false | undefined;
|
|
1554
1551
|
manage_inventory?: true | undefined;
|
|
1555
1552
|
variant_rank?: number | undefined;
|
|
1553
|
+
ean?: string | undefined;
|
|
1554
|
+
upc?: string | undefined;
|
|
1555
|
+
barcode?: string | undefined;
|
|
1556
1556
|
inventory_items?: {
|
|
1557
1557
|
inventory_item_id: string;
|
|
1558
1558
|
required_quantity: number;
|
|
@@ -1589,6 +1589,8 @@ export declare const CreateProduct: z.ZodObject<{
|
|
|
1589
1589
|
description?: string | undefined;
|
|
1590
1590
|
variants?: {
|
|
1591
1591
|
title: string;
|
|
1592
|
+
allow_backorder: false;
|
|
1593
|
+
manage_inventory: true;
|
|
1592
1594
|
prices: {
|
|
1593
1595
|
currency_code: string;
|
|
1594
1596
|
amount: number;
|
|
@@ -1596,8 +1598,6 @@ export declare const CreateProduct: z.ZodObject<{
|
|
|
1596
1598
|
max_quantity?: number | null | undefined;
|
|
1597
1599
|
rules?: Record<string, string> | undefined;
|
|
1598
1600
|
}[];
|
|
1599
|
-
allow_backorder: false;
|
|
1600
|
-
manage_inventory: true;
|
|
1601
1601
|
length?: number | undefined;
|
|
1602
1602
|
options?: Record<string, string> | undefined;
|
|
1603
1603
|
width?: number | undefined;
|
|
@@ -1609,10 +1609,10 @@ export declare const CreateProduct: z.ZodObject<{
|
|
|
1609
1609
|
material?: string | undefined;
|
|
1610
1610
|
metadata?: Record<string, unknown> | undefined;
|
|
1611
1611
|
sku?: string | undefined;
|
|
1612
|
+
variant_rank?: number | undefined;
|
|
1612
1613
|
ean?: string | undefined;
|
|
1613
1614
|
upc?: string | undefined;
|
|
1614
1615
|
barcode?: string | undefined;
|
|
1615
|
-
variant_rank?: number | undefined;
|
|
1616
1616
|
inventory_items?: {
|
|
1617
1617
|
inventory_item_id: string;
|
|
1618
1618
|
required_quantity: number;
|
|
@@ -1674,12 +1674,12 @@ export declare const CreateProduct: z.ZodObject<{
|
|
|
1674
1674
|
material?: string | undefined;
|
|
1675
1675
|
metadata?: Record<string, unknown> | undefined;
|
|
1676
1676
|
sku?: string | undefined;
|
|
1677
|
-
ean?: string | undefined;
|
|
1678
|
-
upc?: string | undefined;
|
|
1679
|
-
barcode?: string | undefined;
|
|
1680
1677
|
allow_backorder?: false | undefined;
|
|
1681
1678
|
manage_inventory?: true | undefined;
|
|
1682
1679
|
variant_rank?: number | undefined;
|
|
1680
|
+
ean?: string | undefined;
|
|
1681
|
+
upc?: string | undefined;
|
|
1682
|
+
barcode?: string | undefined;
|
|
1683
1683
|
inventory_items?: {
|
|
1684
1684
|
inventory_item_id: string;
|
|
1685
1685
|
required_quantity: number;
|
|
@@ -1932,6 +1932,12 @@ export declare const UpdateProduct: z.ZodObject<{
|
|
|
1932
1932
|
material?: string | null | undefined;
|
|
1933
1933
|
metadata?: Record<string, unknown> | null | undefined;
|
|
1934
1934
|
sku?: string | null | undefined;
|
|
1935
|
+
allow_backorder?: boolean | undefined;
|
|
1936
|
+
manage_inventory?: boolean | undefined;
|
|
1937
|
+
variant_rank?: number | undefined;
|
|
1938
|
+
ean?: string | null | undefined;
|
|
1939
|
+
upc?: string | null | undefined;
|
|
1940
|
+
barcode?: string | null | undefined;
|
|
1935
1941
|
prices?: {
|
|
1936
1942
|
id?: string | undefined;
|
|
1937
1943
|
currency_code?: string | undefined;
|
|
@@ -1940,12 +1946,6 @@ export declare const UpdateProduct: z.ZodObject<{
|
|
|
1940
1946
|
max_quantity?: number | null | undefined;
|
|
1941
1947
|
rules?: Record<string, string> | undefined;
|
|
1942
1948
|
}[] | undefined;
|
|
1943
|
-
ean?: string | null | undefined;
|
|
1944
|
-
upc?: string | null | undefined;
|
|
1945
|
-
barcode?: string | null | undefined;
|
|
1946
|
-
allow_backorder?: boolean | undefined;
|
|
1947
|
-
manage_inventory?: boolean | undefined;
|
|
1948
|
-
variant_rank?: number | undefined;
|
|
1949
1949
|
}, {
|
|
1950
1950
|
length?: number | null | undefined;
|
|
1951
1951
|
options?: Record<string, string> | undefined;
|
|
@@ -1960,6 +1960,12 @@ export declare const UpdateProduct: z.ZodObject<{
|
|
|
1960
1960
|
material?: string | null | undefined;
|
|
1961
1961
|
metadata?: Record<string, unknown> | null | undefined;
|
|
1962
1962
|
sku?: string | null | undefined;
|
|
1963
|
+
allow_backorder?: boolean | undefined;
|
|
1964
|
+
manage_inventory?: boolean | undefined;
|
|
1965
|
+
variant_rank?: number | undefined;
|
|
1966
|
+
ean?: string | null | undefined;
|
|
1967
|
+
upc?: string | null | undefined;
|
|
1968
|
+
barcode?: string | null | undefined;
|
|
1963
1969
|
prices?: {
|
|
1964
1970
|
id?: string | undefined;
|
|
1965
1971
|
currency_code?: string | undefined;
|
|
@@ -1968,12 +1974,6 @@ export declare const UpdateProduct: z.ZodObject<{
|
|
|
1968
1974
|
max_quantity?: number | null | undefined;
|
|
1969
1975
|
rules?: Record<string, string> | undefined;
|
|
1970
1976
|
}[] | undefined;
|
|
1971
|
-
ean?: string | null | undefined;
|
|
1972
|
-
upc?: string | null | undefined;
|
|
1973
|
-
barcode?: string | null | undefined;
|
|
1974
|
-
allow_backorder?: boolean | undefined;
|
|
1975
|
-
manage_inventory?: boolean | undefined;
|
|
1976
|
-
variant_rank?: number | undefined;
|
|
1977
1977
|
}>, "many">>;
|
|
1978
1978
|
subtitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1979
1979
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -2042,6 +2042,12 @@ export declare const UpdateProduct: z.ZodObject<{
|
|
|
2042
2042
|
material?: string | null | undefined;
|
|
2043
2043
|
metadata?: Record<string, unknown> | null | undefined;
|
|
2044
2044
|
sku?: string | null | undefined;
|
|
2045
|
+
allow_backorder?: boolean | undefined;
|
|
2046
|
+
manage_inventory?: boolean | undefined;
|
|
2047
|
+
variant_rank?: number | undefined;
|
|
2048
|
+
ean?: string | null | undefined;
|
|
2049
|
+
upc?: string | null | undefined;
|
|
2050
|
+
barcode?: string | null | undefined;
|
|
2045
2051
|
prices?: {
|
|
2046
2052
|
id?: string | undefined;
|
|
2047
2053
|
currency_code?: string | undefined;
|
|
@@ -2050,12 +2056,6 @@ export declare const UpdateProduct: z.ZodObject<{
|
|
|
2050
2056
|
max_quantity?: number | null | undefined;
|
|
2051
2057
|
rules?: Record<string, string> | undefined;
|
|
2052
2058
|
}[] | undefined;
|
|
2053
|
-
ean?: string | null | undefined;
|
|
2054
|
-
upc?: string | null | undefined;
|
|
2055
|
-
barcode?: string | null | undefined;
|
|
2056
|
-
allow_backorder?: boolean | undefined;
|
|
2057
|
-
manage_inventory?: boolean | undefined;
|
|
2058
|
-
variant_rank?: number | undefined;
|
|
2059
2059
|
}[] | undefined;
|
|
2060
2060
|
title?: string | undefined;
|
|
2061
2061
|
subtitle?: string | null | undefined;
|
|
@@ -2108,6 +2108,12 @@ export declare const UpdateProduct: z.ZodObject<{
|
|
|
2108
2108
|
material?: string | null | undefined;
|
|
2109
2109
|
metadata?: Record<string, unknown> | null | undefined;
|
|
2110
2110
|
sku?: string | null | undefined;
|
|
2111
|
+
allow_backorder?: boolean | undefined;
|
|
2112
|
+
manage_inventory?: boolean | undefined;
|
|
2113
|
+
variant_rank?: number | undefined;
|
|
2114
|
+
ean?: string | null | undefined;
|
|
2115
|
+
upc?: string | null | undefined;
|
|
2116
|
+
barcode?: string | null | undefined;
|
|
2111
2117
|
prices?: {
|
|
2112
2118
|
id?: string | undefined;
|
|
2113
2119
|
currency_code?: string | undefined;
|
|
@@ -2116,12 +2122,6 @@ export declare const UpdateProduct: z.ZodObject<{
|
|
|
2116
2122
|
max_quantity?: number | null | undefined;
|
|
2117
2123
|
rules?: Record<string, string> | undefined;
|
|
2118
2124
|
}[] | undefined;
|
|
2119
|
-
ean?: string | null | undefined;
|
|
2120
|
-
upc?: string | null | undefined;
|
|
2121
|
-
barcode?: string | null | undefined;
|
|
2122
|
-
allow_backorder?: boolean | undefined;
|
|
2123
|
-
manage_inventory?: boolean | undefined;
|
|
2124
|
-
variant_rank?: number | undefined;
|
|
2125
2125
|
}[] | undefined;
|
|
2126
2126
|
title?: string | undefined;
|
|
2127
2127
|
subtitle?: string | null | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MedusaRequest, MedusaResponse } from
|
|
1
|
+
import { MedusaRequest, MedusaResponse } from "@medusajs/framework";
|
|
2
2
|
export declare function GET(req: MedusaRequest, res: MedusaResponse): Promise<void>;
|
|
@@ -1,21 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.GET = GET;
|
|
4
7
|
const utils_1 = require("@medusajs/framework/utils");
|
|
8
|
+
const seller_stock_location_1 = __importDefault(require("../../../links/seller-stock-location"));
|
|
5
9
|
async function GET(req, res) {
|
|
6
10
|
const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
|
|
11
|
+
const { data: sellerLinks } = await query.graph({
|
|
12
|
+
entity: seller_stock_location_1.default.entryPoint,
|
|
13
|
+
fields: ["stock_location_id"],
|
|
14
|
+
});
|
|
15
|
+
const linkedStockLocationIds = sellerLinks.map((link) => link.stock_location_id);
|
|
7
16
|
const { data: stockLocations, metadata } = await query.graph({
|
|
8
|
-
entity:
|
|
9
|
-
fields:
|
|
10
|
-
filters:
|
|
11
|
-
|
|
17
|
+
entity: "stock_location",
|
|
18
|
+
fields: req.queryConfig.fields,
|
|
19
|
+
filters: {
|
|
20
|
+
...req.filterableFields,
|
|
21
|
+
...(linkedStockLocationIds.length > 0 && {
|
|
22
|
+
id: { $nin: linkedStockLocationIds },
|
|
23
|
+
}),
|
|
24
|
+
},
|
|
25
|
+
pagination: req.queryConfig.pagination,
|
|
12
26
|
});
|
|
13
|
-
const filteredStockLocations = stockLocations.filter((stockLocation) => !stockLocation.seller);
|
|
14
27
|
res.json({
|
|
15
|
-
stock_locations:
|
|
28
|
+
stock_locations: stockLocations,
|
|
16
29
|
count: metadata?.count,
|
|
17
30
|
offset: metadata?.skip,
|
|
18
|
-
limit: metadata?.take
|
|
31
|
+
limit: metadata?.take,
|
|
19
32
|
});
|
|
20
33
|
}
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvYXBpL2FkbWluL3N0b2NrLWxvY2F0aW9ucy9yb3V0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUtBLGtCQWlDQztBQXJDRCxxREFBc0U7QUFFdEUsaUdBQTJFO0FBRXBFLEtBQUssVUFBVSxHQUFHLENBQ3ZCLEdBQWtCLEVBQ2xCLEdBQW1CO0lBRW5CLE1BQU0sS0FBSyxHQUFHLEdBQUcsQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLGlDQUF5QixDQUFDLEtBQUssQ0FBQyxDQUFDO0lBRWpFLE1BQU0sRUFBRSxJQUFJLEVBQUUsV0FBVyxFQUFFLEdBQUcsTUFBTSxLQUFLLENBQUMsS0FBSyxDQUFDO1FBQzlDLE1BQU0sRUFBRSwrQkFBdUIsQ0FBQyxVQUFVO1FBQzFDLE1BQU0sRUFBRSxDQUFDLG1CQUFtQixDQUFDO0tBQzlCLENBQUMsQ0FBQztJQUVILE1BQU0sc0JBQXNCLEdBQUcsV0FBVyxDQUFDLEdBQUcsQ0FDNUMsQ0FBQyxJQUFJLEVBQUUsRUFBRSxDQUFDLElBQUksQ0FBQyxpQkFBaUIsQ0FDakMsQ0FBQztJQUVGLE1BQU0sRUFBRSxJQUFJLEVBQUUsY0FBYyxFQUFFLFFBQVEsRUFBRSxHQUFHLE1BQU0sS0FBSyxDQUFDLEtBQUssQ0FBQztRQUMzRCxNQUFNLEVBQUUsZ0JBQWdCO1FBQ3hCLE1BQU0sRUFBRSxHQUFHLENBQUMsV0FBVyxDQUFDLE1BQU07UUFDOUIsT0FBTyxFQUFFO1lBQ1AsR0FBRyxHQUFHLENBQUMsZ0JBQWdCO1lBQ3ZCLEdBQUcsQ0FBQyxzQkFBc0IsQ0FBQyxNQUFNLEdBQUcsQ0FBQyxJQUFJO2dCQUN2QyxFQUFFLEVBQUUsRUFBRSxJQUFJLEVBQUUsc0JBQXNCLEVBQUU7YUFDckMsQ0FBQztTQUNIO1FBQ0QsVUFBVSxFQUFFLEdBQUcsQ0FBQyxXQUFXLENBQUMsVUFBVTtLQUN2QyxDQUFDLENBQUM7SUFFSCxHQUFHLENBQUMsSUFBSSxDQUFDO1FBQ1AsZUFBZSxFQUFFLGNBQWM7UUFDL0IsS0FBSyxFQUFFLFFBQVEsRUFBRSxLQUFLO1FBQ3RCLE1BQU0sRUFBRSxRQUFRLEVBQUUsSUFBSTtRQUN0QixLQUFLLEVBQUUsUUFBUSxFQUFFLElBQUk7S0FDdEIsQ0FBQyxDQUFDO0FBQ0wsQ0FBQyJ9
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AuthenticatedMedusaRequest, MedusaResponse } from '@medusajs/framework';
|
|
2
|
-
import { VendorUpdateCampaignType } from '../validators';
|
|
2
|
+
import { VendorGetCampaignByIdParamsType, VendorUpdateCampaignType } from '../validators';
|
|
3
3
|
/**
|
|
4
4
|
* @oas [get] /vendor/campaigns/{id}
|
|
5
5
|
* operationId: "VendorGetCampaignById"
|
|
6
6
|
* summary: "Get campaign"
|
|
7
|
-
* description: "Retrieves campaign by id for the authenticated vendor."
|
|
7
|
+
* description: "Retrieves campaign by id for the authenticated vendor. Supports filtering, searching, and sorting of associated promotions."
|
|
8
8
|
* x-authenticated: true
|
|
9
9
|
* parameters:
|
|
10
10
|
* - in: path
|
|
@@ -18,7 +18,58 @@ import { VendorUpdateCampaignType } from '../validators';
|
|
|
18
18
|
* schema:
|
|
19
19
|
* type: string
|
|
20
20
|
* required: false
|
|
21
|
-
* description: Comma-separated fields to include in the response.
|
|
21
|
+
* description: Comma-separated fields to include in the response. Use `*promotions` or `promotions.*` to include promotions.
|
|
22
|
+
* example: "*promotions"
|
|
23
|
+
* - name: q
|
|
24
|
+
* in: query
|
|
25
|
+
* schema:
|
|
26
|
+
* type: string
|
|
27
|
+
* required: false
|
|
28
|
+
* description: Search query to filter promotions by code (case-insensitive partial match).
|
|
29
|
+
* example: "test"
|
|
30
|
+
* - name: created_at
|
|
31
|
+
* in: query
|
|
32
|
+
* schema:
|
|
33
|
+
* type: string
|
|
34
|
+
* required: false
|
|
35
|
+
* description: |
|
|
36
|
+
* Filter promotions by created_at date. Must be a JSON object (URL-encoded) with comparison operators.
|
|
37
|
+
* Supported operators: `$gte`, `$lte`, `$gt`, `$lt`, `$eq`, `$ne`.
|
|
38
|
+
* Example: `{"$gte":"2025-11-19T11:00:00.000Z"}` (URL-encoded: `%7B%22%24gte%22%3A%222025-11-19T11%3A00%3A00.000Z%22%7D`)
|
|
39
|
+
* example: '{"$gte":"2025-11-19T11:00:00.000Z"}'
|
|
40
|
+
* - name: updated_at
|
|
41
|
+
* in: query
|
|
42
|
+
* schema:
|
|
43
|
+
* type: string
|
|
44
|
+
* required: false
|
|
45
|
+
* description: |
|
|
46
|
+
* Filter promotions by updated_at date. Must be a JSON object (URL-encoded) with comparison operators.
|
|
47
|
+
* Supported operators: `$gte`, `$lte`, `$gt`, `$lt`, `$eq`, `$ne`.
|
|
48
|
+
* Example: `{"$gte":"2025-11-19T11:00:00.000Z"}` (URL-encoded: `%7B%22%24gte%22%3A%222025-11-19T11%3A00%3A00.000Z%22%7D`)
|
|
49
|
+
* example: '{"$gte":"2025-11-19T11:00:00.000Z"}'
|
|
50
|
+
* - name: order
|
|
51
|
+
* in: query
|
|
52
|
+
* schema:
|
|
53
|
+
* type: string
|
|
54
|
+
* required: false
|
|
55
|
+
* description: |
|
|
56
|
+
* Sort promotions by property. Prefix with `-` for descending order.
|
|
57
|
+
* Examples: `code`, `-code`, `created_at`, `-created_at`, `updated_at`, `-updated_at`
|
|
58
|
+
* example: "-code"
|
|
59
|
+
* - name: offset
|
|
60
|
+
* in: query
|
|
61
|
+
* schema:
|
|
62
|
+
* type: number
|
|
63
|
+
* required: false
|
|
64
|
+
* description: The number of promotions to skip before starting to collect the result set.
|
|
65
|
+
* example: 0
|
|
66
|
+
* - name: limit
|
|
67
|
+
* in: query
|
|
68
|
+
* schema:
|
|
69
|
+
* type: number
|
|
70
|
+
* required: false
|
|
71
|
+
* description: The number of promotions to return.
|
|
72
|
+
* example: 50
|
|
22
73
|
* responses:
|
|
23
74
|
* "200":
|
|
24
75
|
* description: OK
|
|
@@ -35,7 +86,7 @@ import { VendorUpdateCampaignType } from '../validators';
|
|
|
35
86
|
* - api_token: []
|
|
36
87
|
* - cookie_auth: []
|
|
37
88
|
*/
|
|
38
|
-
export declare const GET: (req: AuthenticatedMedusaRequest, res: MedusaResponse) => Promise<void>;
|
|
89
|
+
export declare const GET: (req: AuthenticatedMedusaRequest<{}, VendorGetCampaignByIdParamsType>, res: MedusaResponse) => Promise<void>;
|
|
39
90
|
/**
|
|
40
91
|
* @oas [delete] /vendor/campaigns/{id}
|
|
41
92
|
* operationId: "VendorDeleteCampaignById"
|
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.POST = exports.DELETE = exports.GET = void 0;
|
|
4
4
|
const utils_1 = require("@medusajs/framework/utils");
|
|
5
5
|
const core_flows_1 = require("@medusajs/medusa/core-flows");
|
|
6
|
+
const helpers_1 = require("../helpers");
|
|
6
7
|
/**
|
|
7
8
|
* @oas [get] /vendor/campaigns/{id}
|
|
8
9
|
* operationId: "VendorGetCampaignById"
|
|
9
10
|
* summary: "Get campaign"
|
|
10
|
-
* description: "Retrieves campaign by id for the authenticated vendor."
|
|
11
|
+
* description: "Retrieves campaign by id for the authenticated vendor. Supports filtering, searching, and sorting of associated promotions."
|
|
11
12
|
* x-authenticated: true
|
|
12
13
|
* parameters:
|
|
13
14
|
* - in: path
|
|
@@ -21,7 +22,58 @@ const core_flows_1 = require("@medusajs/medusa/core-flows");
|
|
|
21
22
|
* schema:
|
|
22
23
|
* type: string
|
|
23
24
|
* required: false
|
|
24
|
-
* description: Comma-separated fields to include in the response.
|
|
25
|
+
* description: Comma-separated fields to include in the response. Use `*promotions` or `promotions.*` to include promotions.
|
|
26
|
+
* example: "*promotions"
|
|
27
|
+
* - name: q
|
|
28
|
+
* in: query
|
|
29
|
+
* schema:
|
|
30
|
+
* type: string
|
|
31
|
+
* required: false
|
|
32
|
+
* description: Search query to filter promotions by code (case-insensitive partial match).
|
|
33
|
+
* example: "test"
|
|
34
|
+
* - name: created_at
|
|
35
|
+
* in: query
|
|
36
|
+
* schema:
|
|
37
|
+
* type: string
|
|
38
|
+
* required: false
|
|
39
|
+
* description: |
|
|
40
|
+
* Filter promotions by created_at date. Must be a JSON object (URL-encoded) with comparison operators.
|
|
41
|
+
* Supported operators: `$gte`, `$lte`, `$gt`, `$lt`, `$eq`, `$ne`.
|
|
42
|
+
* Example: `{"$gte":"2025-11-19T11:00:00.000Z"}` (URL-encoded: `%7B%22%24gte%22%3A%222025-11-19T11%3A00%3A00.000Z%22%7D`)
|
|
43
|
+
* example: '{"$gte":"2025-11-19T11:00:00.000Z"}'
|
|
44
|
+
* - name: updated_at
|
|
45
|
+
* in: query
|
|
46
|
+
* schema:
|
|
47
|
+
* type: string
|
|
48
|
+
* required: false
|
|
49
|
+
* description: |
|
|
50
|
+
* Filter promotions by updated_at date. Must be a JSON object (URL-encoded) with comparison operators.
|
|
51
|
+
* Supported operators: `$gte`, `$lte`, `$gt`, `$lt`, `$eq`, `$ne`.
|
|
52
|
+
* Example: `{"$gte":"2025-11-19T11:00:00.000Z"}` (URL-encoded: `%7B%22%24gte%22%3A%222025-11-19T11%3A00%3A00.000Z%22%7D`)
|
|
53
|
+
* example: '{"$gte":"2025-11-19T11:00:00.000Z"}'
|
|
54
|
+
* - name: order
|
|
55
|
+
* in: query
|
|
56
|
+
* schema:
|
|
57
|
+
* type: string
|
|
58
|
+
* required: false
|
|
59
|
+
* description: |
|
|
60
|
+
* Sort promotions by property. Prefix with `-` for descending order.
|
|
61
|
+
* Examples: `code`, `-code`, `created_at`, `-created_at`, `updated_at`, `-updated_at`
|
|
62
|
+
* example: "-code"
|
|
63
|
+
* - name: offset
|
|
64
|
+
* in: query
|
|
65
|
+
* schema:
|
|
66
|
+
* type: number
|
|
67
|
+
* required: false
|
|
68
|
+
* description: The number of promotions to skip before starting to collect the result set.
|
|
69
|
+
* example: 0
|
|
70
|
+
* - name: limit
|
|
71
|
+
* in: query
|
|
72
|
+
* schema:
|
|
73
|
+
* type: number
|
|
74
|
+
* required: false
|
|
75
|
+
* description: The number of promotions to return.
|
|
76
|
+
* example: 50
|
|
25
77
|
* responses:
|
|
26
78
|
* "200":
|
|
27
79
|
* description: OK
|
|
@@ -47,6 +99,10 @@ const GET = async (req, res) => {
|
|
|
47
99
|
id: req.params.id
|
|
48
100
|
}
|
|
49
101
|
});
|
|
102
|
+
if (campaign) {
|
|
103
|
+
const promotions = await (0, helpers_1.getFilteredCampaignPromotions)(req.scope, req.params.id, req.validatedQuery, req.queryConfig.fields || [], req.queryConfig.pagination);
|
|
104
|
+
campaign.promotions = promotions ?? [];
|
|
105
|
+
}
|
|
50
106
|
res.json({ campaign });
|
|
51
107
|
};
|
|
52
108
|
exports.GET = GET;
|
|
@@ -158,4 +214,4 @@ const POST = async (req, res) => {
|
|
|
158
214
|
res.json({ campaign });
|
|
159
215
|
};
|
|
160
216
|
exports.POST = POST;
|
|
161
|
-
//# sourceM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ixHQUF5RCxFQUN6RCxHQUFtQixFQUNuQixFQUFFO0lBQ0YsTUFBTSxLQUFLLEdBQUcsR0FBRyxDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsaUNBQXlCLENBQUMsS0FBSyxDQUFDLENBQUE7SUFFaEUsTUFBTSxvQ0FBdUIsQ0FBQyxHQUFHLENBQUM7UUFDaEMsU0FBUyxFQUFFLEdBQUcsQ0FBQyxLQUFLO1FBQ3BCLEtBQUssRUFBRTtZQUNMLGFBQWEsRUFBRTtnQkFDYjtvQkFDRSxFQUFFLEVBQUUsR0FBRyxDQUFDLE1BQU0sQ0FBQyxFQUFFO29CQUNqQixHQUFHLEdBQUcsQ0FBQyxhQUFhO2lCQUNyQjthQUNGO1NBQ0Y7S0FDRixDQUFDLENBQUE7SUFFRixNQUFNLEVBQ0osSUFBSSxFQUFFLENBQUMsUUFBUSxDQUFDLEVBQ2pCLEdBQUcsTUFBTSxLQUFLLENBQUMsS0FBSyxDQUFDO1FBQ3BCLE1BQU0sRUFBRSxVQUFVO1FBQ2xCLE1BQU0sRUFBRSxHQUFHLENBQUMsV0FBVyxDQUFDLE1BQU07UUFDOUIsT0FBTyxFQUFFO1lBQ1AsRUFBRSxFQUFFLEdBQUcsQ0FBQyxNQUFNLENBQUMsRUFBRTtTQUNsQjtLQUNGLENBQUMsQ0FBQTtJQUVGLEdBQUcsQ0FBQyxJQUFJLENBQUMsRUFBRSxRQUFRLEVBQUUsQ0FBQyxDQUFBO0FBQ3hCLENBQUMsQ0FBQTtBQTdCWSxRQUFBLElBQUksUUE2QmhCIn0=
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AuthenticatedMedusaRequest, MedusaRequest } from '@medusajs/framework';
|
|
2
|
+
import type { MedusaContainer, PromotionDTO } from '@medusajs/framework/types';
|
|
3
|
+
import { VendorGetCampaignByIdParamsType } from './validators';
|
|
4
|
+
export declare function getFilteredCampaignPromotions(container: MedusaContainer, campaignId: string, filters: AuthenticatedMedusaRequest<{}, VendorGetCampaignByIdParamsType>['validatedQuery'], fields: string[], pagination?: MedusaRequest['queryConfig']['pagination']): Promise<PromotionDTO[]>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFilteredCampaignPromotions = getFilteredCampaignPromotions;
|
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
5
|
+
async function getFilteredCampaignPromotions(container, campaignId, filters, fields, pagination) {
|
|
6
|
+
const query = container.resolve(utils_1.ContainerRegistrationKeys.QUERY);
|
|
7
|
+
const shouldIncludePromotions = fields.includes('*') ||
|
|
8
|
+
fields.some((field) => field === '*promotions' ||
|
|
9
|
+
field === 'promotions' ||
|
|
10
|
+
field.startsWith('promotions.'));
|
|
11
|
+
if (!shouldIncludePromotions) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
const promotionFilters = {
|
|
15
|
+
campaign_id: campaignId
|
|
16
|
+
};
|
|
17
|
+
if (filters.created_at) {
|
|
18
|
+
promotionFilters.created_at = filters.created_at;
|
|
19
|
+
}
|
|
20
|
+
if (filters.updated_at) {
|
|
21
|
+
promotionFilters.updated_at = filters.updated_at;
|
|
22
|
+
}
|
|
23
|
+
if (filters?.q && filters?.q?.length > 0) {
|
|
24
|
+
promotionFilters.code = { $ilike: `%${filters.q}%` };
|
|
25
|
+
}
|
|
26
|
+
const { data: promotions } = await query.graph({
|
|
27
|
+
entity: 'promotion',
|
|
28
|
+
fields: ['*'],
|
|
29
|
+
filters: promotionFilters,
|
|
30
|
+
pagination
|
|
31
|
+
});
|
|
32
|
+
return promotions || [];
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGVscGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9hcGkvdmVuZG9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yxFQUFFLENBQUM7UUFDekMsZ0JBQWdCLENBQUMsSUFBSSxHQUFHLEVBQUUsTUFBTSxFQUFFLElBQUksT0FBTyxDQUFDLENBQUMsR0FBRyxFQUFFLENBQUE7SUFDdEQsQ0FBQztJQUVELE1BQU0sRUFBRSxJQUFJLEVBQUUsVUFBVSxFQUFFLEdBQUcsTUFBTSxLQUFLLENBQUMsS0FBSyxDQUFDO1FBQzdDLE1BQU0sRUFBRSxXQUFXO1FBQ25CLE1BQU0sRUFBRSxDQUFDLEdBQUcsQ0FBQztRQUNiLE9BQU8sRUFBRSxnQkFBZ0I7UUFDekIsVUFBVTtLQUNYLENBQUMsQ0FBQTtJQUVGLE9BQU8sVUFBVSxJQUFJLEVBQUUsQ0FBQTtBQUN6QixDQUFDIn0=
|
|
@@ -5,17 +5,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.vendorCampaignsMiddlewares = void 0;
|
|
7
7
|
const framework_1 = require("@medusajs/framework");
|
|
8
|
+
const validators_1 = require("@medusajs/medusa/api/utils/validators");
|
|
8
9
|
const seller_campaign_1 = __importDefault(require("../../../links/seller-campaign"));
|
|
9
10
|
const middlewares_1 = require("../../../shared/infra/http/middlewares");
|
|
10
11
|
const query_config_1 = require("./query-config");
|
|
11
|
-
const
|
|
12
|
-
const validators_2 = require("@medusajs/medusa/api/utils/validators");
|
|
12
|
+
const validators_2 = require("./validators");
|
|
13
13
|
exports.vendorCampaignsMiddlewares = [
|
|
14
14
|
{
|
|
15
15
|
method: ['GET'],
|
|
16
16
|
matcher: '/vendor/campaigns',
|
|
17
17
|
middlewares: [
|
|
18
|
-
(0, framework_1.validateAndTransformQuery)(
|
|
18
|
+
(0, framework_1.validateAndTransformQuery)(validators_2.VendorGetCampaignsParams, query_config_1.vendorCampaignQueryConfig.list),
|
|
19
19
|
(0, middlewares_1.filterBySellerId)()
|
|
20
20
|
]
|
|
21
21
|
},
|
|
@@ -23,7 +23,7 @@ exports.vendorCampaignsMiddlewares = [
|
|
|
23
23
|
method: ['GET'],
|
|
24
24
|
matcher: '/vendor/campaigns/:id',
|
|
25
25
|
middlewares: [
|
|
26
|
-
(0, framework_1.validateAndTransformQuery)(
|
|
26
|
+
(0, framework_1.validateAndTransformQuery)(validators_2.VendorGetCampaignByIdParams, query_config_1.vendorCampaignQueryConfig.retrieve),
|
|
27
27
|
(0, middlewares_1.checkResourceOwnershipByResourceId)({
|
|
28
28
|
entryPoint: seller_campaign_1.default.entryPoint,
|
|
29
29
|
filterField: 'campaign_id'
|
|
@@ -34,8 +34,8 @@ exports.vendorCampaignsMiddlewares = [
|
|
|
34
34
|
method: ['POST'],
|
|
35
35
|
matcher: '/vendor/campaigns/:id',
|
|
36
36
|
middlewares: [
|
|
37
|
-
(0, framework_1.validateAndTransformBody)(
|
|
38
|
-
(0, framework_1.validateAndTransformQuery)(
|
|
37
|
+
(0, framework_1.validateAndTransformBody)(validators_2.VendorUpdateCampaign),
|
|
38
|
+
(0, framework_1.validateAndTransformQuery)(validators_2.VendorGetCampaignsParams, query_config_1.vendorCampaignQueryConfig.retrieve),
|
|
39
39
|
(0, middlewares_1.checkResourceOwnershipByResourceId)({
|
|
40
40
|
entryPoint: seller_campaign_1.default.entryPoint,
|
|
41
41
|
filterField: 'campaign_id'
|
|
@@ -56,17 +56,17 @@ exports.vendorCampaignsMiddlewares = [
|
|
|
56
56
|
method: ['POST'],
|
|
57
57
|
matcher: '/vendor/campaigns',
|
|
58
58
|
middlewares: [
|
|
59
|
-
(0, framework_1.validateAndTransformBody)(
|
|
60
|
-
(0, framework_1.validateAndTransformQuery)(
|
|
59
|
+
(0, framework_1.validateAndTransformBody)(validators_2.VendorCreateCampaign),
|
|
60
|
+
(0, framework_1.validateAndTransformQuery)(validators_2.VendorGetCampaignsParams, query_config_1.vendorCampaignQueryConfig.retrieve)
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
method: ["POST"],
|
|
65
65
|
matcher: "/vendor/campaigns/:id/promotions",
|
|
66
66
|
middlewares: [
|
|
67
|
-
(0, framework_1.validateAndTransformBody)((0,
|
|
68
|
-
(0, framework_1.validateAndTransformQuery)(
|
|
67
|
+
(0, framework_1.validateAndTransformBody)((0, validators_1.createLinkBody)()),
|
|
68
|
+
(0, framework_1.validateAndTransformQuery)(validators_2.VendorGetCampaignsParams, query_config_1.vendorCampaignQueryConfig.retrieve),
|
|
69
69
|
],
|
|
70
70
|
},
|
|
71
71
|
];
|
|
72
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
72
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWlkZGxld2FyZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvYXBpL3ZlbmRvci9jYW1wYWlnbnMvbWlkZGxld2FyZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsbURBSTRCO0FBRTVCLHNFQUFzRTtBQUN0RSxxRkFBMkQ7QUFDM0Qsd0VBRytDO0FBQy9DLGlEQUEwRDtBQUMxRCw2Q0FLcUI7QUFFUixRQUFBLDBCQUEwQixHQUFzQjtJQUMzRDtRQUNFLE1BQU0sRUFBRSxDQUFDLEtBQUssQ0FBQztRQUNmLE9BQU8sRUFBRSxtQkFBbUI7UUFDNUIsV0FBVyxFQUFFO1lBQ1gsSUFBQSxxQ0FBeUIsRUFDdkIscUNBQXdCLEVBQ3hCLHdDQUF5QixDQUFDLElBQUksQ0FDL0I7WUFDRCxJQUFBLDhCQUFnQixHQUFFO1NBQ25CO0tBQ0Y7SUFDRDtRQUNFLE1BQU0sRUFBRSxDQUFDLEtBQUssQ0FBQztRQUNmLE9BQU8sRUFBRSx1QkFBdUI7UUFDaEMsV0FBVyxFQUFFO1lBQ1gsSUFBQSxxQ0FBeUIsRUFDdkIsd0N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UFBRSxDQUFDLE1BQU0sQ0FBQztRQUNoQixPQUFPLEVBQUUsa0NBQWtDO1FBQzNDLFdBQVcsRUFBRTtZQUNYLElBQUEsb0NBQXdCLEVBQUMsSUFBQSwyQkFBYyxHQUFFLENBQUM7WUFDMUMsSUFBQSxxQ0FBeUIsRUFDdkIscUNBQXdCLEVBQ3hCLHdDQUF5QixDQUFDLFFBQVEsQ0FDbkM7U0FDRjtLQUNGO0NBQ0YsQ0FBQSJ9
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AuthenticatedMedusaRequest, MedusaResponse } from "@medusajs/framework";
|
|
2
|
-
import { VendorCreateCampaignType } from "./validators";
|
|
2
|
+
import { VendorCreateCampaignType, VendorGetCampaignsParamsType } from "./validators";
|
|
3
3
|
/**
|
|
4
4
|
* @oas [get] /vendor/campaigns
|
|
5
5
|
* operationId: "VendorListCampaigns"
|
|
@@ -58,7 +58,7 @@ import { VendorCreateCampaignType } from "./validators";
|
|
|
58
58
|
* - api_token: []
|
|
59
59
|
* - cookie_auth: []
|
|
60
60
|
*/
|
|
61
|
-
export declare const GET: (req: AuthenticatedMedusaRequest, res: MedusaResponse) => Promise<
|
|
61
|
+
export declare const GET: (req: AuthenticatedMedusaRequest<{}, VendorGetCampaignsParamsType>, res: MedusaResponse) => Promise<MedusaResponse | undefined>;
|
|
62
62
|
/**
|
|
63
63
|
* @oas [post] /vendor/campaigns
|
|
64
64
|
* operationId: "VendorCreateCampaign"
|