@mercurjs/b2c-core 1.4.3 → 1.4.5
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/admin/index.js +3 -1
- package/.medusa/server/src/admin/index.mjs +3 -1
- package/.medusa/server/src/api/admin/attributes/validators.d.ts +355 -59
- package/.medusa/server/src/api/admin/configuration/validators.d.ts +3 -2
- package/.medusa/server/src/api/admin/notifications/route.js +8 -2
- package/.medusa/server/src/api/admin/order-sets/validators.d.ts +5 -3
- package/.medusa/server/src/api/admin/products/validators.d.ts +909 -500
- package/.medusa/server/src/api/admin/sellers/validators.d.ts +20 -16
- package/.medusa/server/src/api/admin/stock-locations/route.js +2 -2
- package/.medusa/server/src/api/store/carts/[id]/promotions/route.d.ts +3 -0
- package/.medusa/server/src/api/store/carts/[id]/promotions/route.js +34 -0
- package/.medusa/server/src/api/store/order-set/validators.d.ts +3 -2
- package/.medusa/server/src/api/store/returns/validators.d.ts +3 -2
- package/.medusa/server/src/api/store/seller/validators.d.ts +3 -2
- package/.medusa/server/src/api/store/shipping-options/validators.d.ts +24 -26
- package/.medusa/server/src/api/store/wishlist/validators.d.ts +3 -2
- package/.medusa/server/src/api/vendor/attributes/validators.d.ts +9 -7
- package/.medusa/server/src/api/vendor/campaigns/[id]/promotions/route.d.ts +76 -0
- package/.medusa/server/src/api/vendor/campaigns/[id]/promotions/route.js +89 -0
- 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 +18 -9
- package/.medusa/server/src/api/vendor/campaigns/route.d.ts +6 -0
- package/.medusa/server/src/api/vendor/campaigns/route.js +10 -4
- package/.medusa/server/src/api/vendor/campaigns/validators.d.ts +203 -11
- package/.medusa/server/src/api/vendor/campaigns/validators.js +43 -4
- package/.medusa/server/src/api/vendor/customer-groups/route.d.ts +2 -2
- package/.medusa/server/src/api/vendor/customer-groups/route.js +5 -5
- package/.medusa/server/src/api/vendor/customer-groups/validators.d.ts +604 -2
- package/.medusa/server/src/api/vendor/customer-groups/validators.js +37 -2
- package/.medusa/server/src/api/vendor/customers/validators.d.ts +6 -4
- package/.medusa/server/src/api/vendor/fulfillment-providers/validators.d.ts +3 -2
- package/.medusa/server/src/api/vendor/fulfillment-sets/validators.d.ts +22 -6
- package/.medusa/server/src/api/vendor/inventory-items/[id]/route.d.ts +23 -0
- package/.medusa/server/src/api/vendor/inventory-items/[id]/route.js +48 -2
- package/.medusa/server/src/api/vendor/inventory-items/middlewares.js +12 -1
- package/.medusa/server/src/api/vendor/inventory-items/validators.d.ts +37 -104
- package/.medusa/server/src/api/vendor/invites/validators.d.ts +3 -2
- package/.medusa/server/src/api/vendor/members/validators.d.ts +7 -6
- package/.medusa/server/src/api/vendor/notifications/validators.d.ts +3 -2
- package/.medusa/server/src/api/vendor/orders/validators.d.ts +13 -11
- package/.medusa/server/src/api/vendor/payouts/validators.d.ts +3 -2
- package/.medusa/server/src/api/vendor/price-lists/validators.d.ts +18 -16
- package/.medusa/server/src/api/vendor/price-preferences/validators.d.ts +37 -29
- package/.medusa/server/src/api/vendor/product-categories/validators.d.ts +317 -26
- package/.medusa/server/src/api/vendor/product-collections/validators.d.ts +6 -4
- package/.medusa/server/src/api/vendor/product-tags/route.js +8 -2
- package/.medusa/server/src/api/vendor/product-tags/validators.d.ts +31 -29
- 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 +14 -2
- package/.medusa/server/src/api/vendor/product-types/validators.js +9 -3
- package/.medusa/server/src/api/vendor/products/route.js +7 -3
- package/.medusa/server/src/api/vendor/products/utils.d.ts +4 -1
- package/.medusa/server/src/api/vendor/products/utils.js +40 -2
- package/.medusa/server/src/api/vendor/products/validators.d.ts +905 -377
- package/.medusa/server/src/api/vendor/promotions/validators.d.ts +57 -53
- package/.medusa/server/src/api/vendor/regions/validators.d.ts +3 -2
- package/.medusa/server/src/api/vendor/reservations/validators.d.ts +7 -6
- package/.medusa/server/src/api/vendor/returns/validators.d.ts +9 -8
- package/.medusa/server/src/api/vendor/sellers/validators.d.ts +20 -20
- package/.medusa/server/src/api/vendor/shipping-options/validators.d.ts +27 -26
- package/.medusa/server/src/api/vendor/shipping-profiles/validators.d.ts +5 -4
- package/.medusa/server/src/api/vendor/stock-locations/validators.d.ts +49 -59
- package/.medusa/server/src/links/seller-campaign.js +1 -1
- package/.medusa/server/src/links/seller-customer-group.js +1 -1
- package/.medusa/server/src/modules/attribute/migrations/Migration20250617080244.d.ts +1 -1
- package/.medusa/server/src/modules/attribute/migrations/Migration20250617080244.js +2 -2
- package/.medusa/server/src/modules/attribute/migrations/Migration20250620110849.d.ts +1 -1
- package/.medusa/server/src/modules/attribute/migrations/Migration20250620110849.js +2 -2
- package/.medusa/server/src/modules/attribute/migrations/Migration20250828065431.d.ts +1 -1
- package/.medusa/server/src/modules/attribute/migrations/Migration20250828065431.js +2 -2
- package/.medusa/server/src/modules/attribute/service.d.ts +1 -1
- package/.medusa/server/src/modules/configuration/migrations/Migration20250114063624.d.ts +1 -1
- package/.medusa/server/src/modules/configuration/migrations/Migration20250114063624.js +2 -2
- package/.medusa/server/src/modules/configuration/migrations/Migration20250324131111.d.ts +1 -1
- package/.medusa/server/src/modules/configuration/migrations/Migration20250324131111.js +2 -2
- package/.medusa/server/src/modules/marketplace/migrations/Migration20241207151814.d.ts +1 -1
- package/.medusa/server/src/modules/marketplace/migrations/Migration20241207151814.js +2 -2
- package/.medusa/server/src/modules/payout/migrations/Migration20250317090626.d.ts +1 -1
- package/.medusa/server/src/modules/payout/migrations/Migration20250317090626.js +2 -2
- package/.medusa/server/src/modules/payout/migrations/Migration20250612144913.d.ts +1 -1
- package/.medusa/server/src/modules/payout/migrations/Migration20250612144913.js +2 -2
- package/.medusa/server/src/modules/payout/service.d.ts +1 -1
- package/.medusa/server/src/modules/secondary_categories/migrations/Migration20251014102054.d.ts +1 -1
- package/.medusa/server/src/modules/secondary_categories/migrations/Migration20251014102054.js +2 -2
- package/.medusa/server/src/modules/seller/migrations/Migration20241206125415.d.ts +1 -1
- package/.medusa/server/src/modules/seller/migrations/Migration20241206125415.js +2 -2
- package/.medusa/server/src/modules/seller/migrations/Migration20250212131627.d.ts +1 -1
- package/.medusa/server/src/modules/seller/migrations/Migration20250212131627.js +2 -2
- package/.medusa/server/src/modules/seller/migrations/Migration20250225083755.d.ts +1 -1
- package/.medusa/server/src/modules/seller/migrations/Migration20250225083755.js +2 -2
- package/.medusa/server/src/modules/seller/migrations/Migration20250225094708.d.ts +1 -1
- package/.medusa/server/src/modules/seller/migrations/Migration20250225094708.js +2 -2
- package/.medusa/server/src/modules/seller/migrations/Migration20250307091819.d.ts +1 -1
- package/.medusa/server/src/modules/seller/migrations/Migration20250307091819.js +2 -2
- package/.medusa/server/src/modules/seller/migrations/Migration20250313065552.d.ts +1 -1
- package/.medusa/server/src/modules/seller/migrations/Migration20250313065552.js +2 -2
- package/.medusa/server/src/modules/seller/migrations/Migration20250530111528.d.ts +1 -1
- package/.medusa/server/src/modules/seller/migrations/Migration20250530111528.js +2 -2
- package/.medusa/server/src/modules/seller/utils.d.ts +4 -0
- package/.medusa/server/src/modules/seller/utils.js +18 -1
- package/.medusa/server/src/modules/split-order-payment/migrations/Migration20250516075429.d.ts +1 -1
- package/.medusa/server/src/modules/split-order-payment/migrations/Migration20250516075429.js +2 -2
- package/.medusa/server/src/modules/taxcode/migrations/Migration20250116135408.d.ts +1 -1
- package/.medusa/server/src/modules/taxcode/migrations/Migration20250116135408.js +2 -2
- package/.medusa/server/src/modules/wishlist/migrations/Migration20250424110903.d.ts +1 -1
- package/.medusa/server/src/modules/wishlist/migrations/Migration20250424110903.js +2 -2
- package/.medusa/server/src/workflows/cart/workflows/split-and-complete-cart.js +2 -2
- package/.medusa/server/src/workflows/order/steps/calculate-payout-for-order.d.ts +1 -1
- package/.medusa/server/src/workflows/promotions/steps/register-usage-step.d.ts +7 -2
- package/.medusa/server/src/workflows/promotions/steps/register-usage-step.js +6 -6
- 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 +10 -10
- package/package.json +15 -28
|
@@ -3,6 +3,7 @@ import { StoreStatus } from '@mercurjs/framework';
|
|
|
3
3
|
export type AdminSellerParamsType = z.infer<typeof AdminSellerParams>;
|
|
4
4
|
export declare const AdminSellerParams: z.ZodObject<{
|
|
5
5
|
fields: z.ZodOptional<z.ZodString>;
|
|
6
|
+
} & {
|
|
6
7
|
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
7
8
|
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
8
9
|
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -10,19 +11,20 @@ export declare const AdminSellerParams: z.ZodObject<{
|
|
|
10
11
|
}, "strip", z.ZodTypeAny, {
|
|
11
12
|
offset: number;
|
|
12
13
|
limit: number;
|
|
13
|
-
fields?: string | undefined;
|
|
14
14
|
order?: string | undefined;
|
|
15
|
+
fields?: string | undefined;
|
|
15
16
|
with_deleted?: boolean | undefined;
|
|
16
17
|
}, {
|
|
18
|
+
order?: string | undefined;
|
|
17
19
|
fields?: string | undefined;
|
|
18
20
|
offset?: unknown;
|
|
19
21
|
limit?: unknown;
|
|
20
|
-
order?: string | undefined;
|
|
21
22
|
with_deleted?: unknown;
|
|
22
23
|
}>;
|
|
23
24
|
export type AdminGetSellerProductsParamsType = z.infer<typeof AdminGetSellerProductsParams>;
|
|
24
25
|
export declare const AdminGetSellerProductsParams: z.ZodObject<{
|
|
25
26
|
fields: z.ZodOptional<z.ZodString>;
|
|
27
|
+
} & {
|
|
26
28
|
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
27
29
|
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
28
30
|
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -30,19 +32,20 @@ export declare const AdminGetSellerProductsParams: z.ZodObject<{
|
|
|
30
32
|
}, "strip", z.ZodTypeAny, {
|
|
31
33
|
offset: number;
|
|
32
34
|
limit: number;
|
|
33
|
-
fields?: string | undefined;
|
|
34
35
|
order?: string | undefined;
|
|
36
|
+
fields?: string | undefined;
|
|
35
37
|
with_deleted?: boolean | undefined;
|
|
36
38
|
}, {
|
|
39
|
+
order?: string | undefined;
|
|
37
40
|
fields?: string | undefined;
|
|
38
41
|
offset?: unknown;
|
|
39
42
|
limit?: unknown;
|
|
40
|
-
order?: string | undefined;
|
|
41
43
|
with_deleted?: unknown;
|
|
42
44
|
}>;
|
|
43
45
|
export type AdminGetSellerOrdersParamsType = z.infer<typeof AdminGetSellerOrdersParams>;
|
|
44
46
|
export declare const AdminGetSellerOrdersParams: z.ZodObject<{
|
|
45
47
|
fields: z.ZodOptional<z.ZodString>;
|
|
48
|
+
} & {
|
|
46
49
|
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
47
50
|
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
48
51
|
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -50,19 +53,20 @@ export declare const AdminGetSellerOrdersParams: z.ZodObject<{
|
|
|
50
53
|
}, "strip", z.ZodTypeAny, {
|
|
51
54
|
offset: number;
|
|
52
55
|
limit: number;
|
|
53
|
-
fields?: string | undefined;
|
|
54
56
|
order?: string | undefined;
|
|
57
|
+
fields?: string | undefined;
|
|
55
58
|
with_deleted?: boolean | undefined;
|
|
56
59
|
}, {
|
|
60
|
+
order?: string | undefined;
|
|
57
61
|
fields?: string | undefined;
|
|
58
62
|
offset?: unknown;
|
|
59
63
|
limit?: unknown;
|
|
60
|
-
order?: string | undefined;
|
|
61
64
|
with_deleted?: unknown;
|
|
62
65
|
}>;
|
|
63
66
|
export type AdminGetSellerCustomerGroupsParamsType = z.infer<typeof AdminGetSellerCustomerGroupsParams>;
|
|
64
67
|
export declare const AdminGetSellerCustomerGroupsParams: z.ZodObject<{
|
|
65
68
|
fields: z.ZodOptional<z.ZodString>;
|
|
69
|
+
} & {
|
|
66
70
|
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
67
71
|
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
68
72
|
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -70,14 +74,14 @@ export declare const AdminGetSellerCustomerGroupsParams: z.ZodObject<{
|
|
|
70
74
|
}, "strip", z.ZodTypeAny, {
|
|
71
75
|
offset: number;
|
|
72
76
|
limit: number;
|
|
73
|
-
fields?: string | undefined;
|
|
74
77
|
order?: string | undefined;
|
|
78
|
+
fields?: string | undefined;
|
|
75
79
|
with_deleted?: boolean | undefined;
|
|
76
80
|
}, {
|
|
81
|
+
order?: string | undefined;
|
|
77
82
|
fields?: string | undefined;
|
|
78
83
|
offset?: unknown;
|
|
79
84
|
limit?: unknown;
|
|
80
|
-
order?: string | undefined;
|
|
81
85
|
with_deleted?: unknown;
|
|
82
86
|
}>;
|
|
83
87
|
export type AdminUpdateSellerType = z.infer<typeof AdminUpdateSeller>;
|
|
@@ -95,31 +99,31 @@ export declare const AdminUpdateSeller: z.ZodObject<{
|
|
|
95
99
|
tax_id: z.ZodOptional<z.ZodString>;
|
|
96
100
|
store_status: z.ZodOptional<z.ZodNativeEnum<typeof StoreStatus>>;
|
|
97
101
|
}, "strict", z.ZodTypeAny, {
|
|
102
|
+
store_status?: StoreStatus | undefined;
|
|
98
103
|
name?: string | undefined;
|
|
99
104
|
description?: string | undefined;
|
|
100
105
|
photo?: string | undefined;
|
|
101
|
-
email?: string | undefined;
|
|
102
|
-
phone?: string | undefined;
|
|
103
106
|
address_line?: string | undefined;
|
|
104
107
|
city?: string | undefined;
|
|
105
|
-
state?: string | undefined;
|
|
106
108
|
postal_code?: string | undefined;
|
|
107
109
|
country_code?: string | undefined;
|
|
108
110
|
tax_id?: string | undefined;
|
|
109
|
-
|
|
111
|
+
email?: string | undefined;
|
|
112
|
+
phone?: string | undefined;
|
|
113
|
+
state?: string | undefined;
|
|
110
114
|
}, {
|
|
115
|
+
store_status?: StoreStatus | undefined;
|
|
111
116
|
name?: unknown;
|
|
112
117
|
description?: string | undefined;
|
|
113
118
|
photo?: string | undefined;
|
|
114
|
-
email?: string | undefined;
|
|
115
|
-
phone?: string | undefined;
|
|
116
119
|
address_line?: string | undefined;
|
|
117
120
|
city?: string | undefined;
|
|
118
|
-
state?: string | undefined;
|
|
119
121
|
postal_code?: string | undefined;
|
|
120
122
|
country_code?: string | undefined;
|
|
121
123
|
tax_id?: string | undefined;
|
|
122
|
-
|
|
124
|
+
email?: string | undefined;
|
|
125
|
+
phone?: string | undefined;
|
|
126
|
+
state?: string | undefined;
|
|
123
127
|
}>;
|
|
124
128
|
export type AdminInviteSellerType = z.infer<typeof AdminInviteSeller>;
|
|
125
129
|
export declare const AdminInviteSeller: z.ZodObject<{
|
|
@@ -13,9 +13,9 @@ async function GET(req, res) {
|
|
|
13
13
|
const filteredStockLocations = stockLocations.filter((stockLocation) => !stockLocation.seller);
|
|
14
14
|
res.json({
|
|
15
15
|
stock_locations: filteredStockLocations,
|
|
16
|
-
count: metadata?.count,
|
|
16
|
+
count: filteredStockLocations.length ?? metadata?.count,
|
|
17
17
|
offset: metadata?.skip,
|
|
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Usc0JBQXNCLENBQUMsTUFBTSxJQUFJLFFBQVEsRUFBRSxLQUFLO1FBQ3ZELE1BQU0sRUFBRSxRQUFRLEVBQUUsSUFBSTtRQUN0QixLQUFLLEVBQUUsUUFBUSxFQUFFLElBQUk7S0FDdEIsQ0FBQyxDQUFBO0FBQ0osQ0FBQyJ9
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AuthenticatedMedusaRequest, MedusaResponse } from "@medusajs/framework";
|
|
2
|
+
import { StoreAddCartPromotionsType } from "@medusajs/medusa/api/store/carts/validators";
|
|
3
|
+
export declare const POST: (req: AuthenticatedMedusaRequest<StoreAddCartPromotionsType>, res: MedusaResponse) => Promise<void>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.POST = void 0;
|
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
5
|
+
const core_flows_1 = require("@medusajs/medusa/core-flows");
|
|
6
|
+
const framework_1 = require("@mercurjs/framework");
|
|
7
|
+
const seller_1 = require("../../../../../modules/seller");
|
|
8
|
+
const POST = async (req, res) => {
|
|
9
|
+
const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
|
|
10
|
+
const seller = await (0, framework_1.fetchSellerByAuthActorId)(req.auth_context?.actor_id, req.scope);
|
|
11
|
+
const validatePromotions = await (0, seller_1.validateSellerPromotions)(req.validatedBody.promo_codes, req.scope, seller.id);
|
|
12
|
+
if (!validatePromotions.valid) {
|
|
13
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, 'Some of the promotion codes are invalid');
|
|
14
|
+
}
|
|
15
|
+
await core_flows_1.updateCartPromotionsWorkflow.run({
|
|
16
|
+
input: {
|
|
17
|
+
cart_id: req.params.id,
|
|
18
|
+
promo_codes: req.validatedBody.promo_codes,
|
|
19
|
+
action: req.validatedBody.promo_codes.length > 0
|
|
20
|
+
? utils_1.PromotionActions.ADD
|
|
21
|
+
: utils_1.PromotionActions.REPLACE,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
const { data: [cart] } = await query.graph({
|
|
25
|
+
entity: 'cart',
|
|
26
|
+
filters: {
|
|
27
|
+
id: req.params.id
|
|
28
|
+
},
|
|
29
|
+
fields: req.queryConfig.fields
|
|
30
|
+
});
|
|
31
|
+
res.json({ cart });
|
|
32
|
+
};
|
|
33
|
+
exports.POST = POST;
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvYXBpL3N0b3JlL2NhcnRzL1tpZF0vcHJvbW90aW9ucy9yb3V0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSxxREFBb0c7QUFFcEcsNERBQTBFO0FBQzFFLG1EQUE4RDtBQUM5RCwwREFBd0U7QUFFakUsTUFBTSxJQUFJLEdBQUcsS0FBSyxFQUNyQixHQUEyRCxFQUMzRCxHQUFtQixFQUNuQixFQUFFO0lBQ0YsTUFBTSxLQUFLLEdBQUcsR0FBRyxDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsaUNBQXlCLENBQUMsS0FBSyxDQUFDLENBQUE7SUFFaEUsTUFBTSxNQUFNLEdBQUcsTUFBTSxJQUFBLG9DQUF3QixFQUMzQyxHQUFHLENBQUMsWUFBWSxFQUFFLFFBQVEsRUFDMUIsR0FBRyxDQUFDLEtBQUssQ0FDVixDQUFBO0lBRUQsTUFBTSxrQkFBa0IsR0FBRyxNQUFNLElBQUEsaUNBQXdCLEVBQ3ZELEdBQUcsQ0FBQyxhQUFhLENBQUMsV0FBVyxFQUM3QixHQUFHLENBQUMsS0FBSyxFQUNULE1BQU0sQ0FBQyxFQUFFLENBQ1YsQ0FBQTtJQUVELElBQUksQ0FBQyxrQ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|
3
|
+
} & {
|
|
3
4
|
offset: import("zod").ZodEffects<import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>, number, unknown>;
|
|
4
5
|
limit: import("zod").ZodEffects<import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>, number, unknown>;
|
|
5
6
|
order: import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
@@ -7,13 +8,13 @@ export declare const StoreGetOrderSetParams: import("zod").ZodObject<{
|
|
|
7
8
|
}, "strip", import("zod").ZodTypeAny, {
|
|
8
9
|
offset: number;
|
|
9
10
|
limit: number;
|
|
10
|
-
fields?: string | undefined;
|
|
11
11
|
order?: string | undefined;
|
|
12
|
+
fields?: string | undefined;
|
|
12
13
|
with_deleted?: boolean | undefined;
|
|
13
14
|
}, {
|
|
15
|
+
order?: string | undefined;
|
|
14
16
|
fields?: string | undefined;
|
|
15
17
|
offset?: unknown;
|
|
16
18
|
limit?: unknown;
|
|
17
|
-
order?: string | undefined;
|
|
18
19
|
with_deleted?: unknown;
|
|
19
20
|
}>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const StoreGetReturnsParams: import("zod").ZodObject<{
|
|
2
2
|
fields: import("zod").ZodOptional<import("zod").ZodString>;
|
|
3
|
+
} & {
|
|
3
4
|
offset: import("zod").ZodEffects<import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>, number, unknown>;
|
|
4
5
|
limit: import("zod").ZodEffects<import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>, number, unknown>;
|
|
5
6
|
order: import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
@@ -7,13 +8,13 @@ export declare const StoreGetReturnsParams: import("zod").ZodObject<{
|
|
|
7
8
|
}, "strip", import("zod").ZodTypeAny, {
|
|
8
9
|
offset: number;
|
|
9
10
|
limit: number;
|
|
10
|
-
fields?: string | undefined;
|
|
11
11
|
order?: string | undefined;
|
|
12
|
+
fields?: string | undefined;
|
|
12
13
|
with_deleted?: boolean | undefined;
|
|
13
14
|
}, {
|
|
15
|
+
order?: string | undefined;
|
|
14
16
|
fields?: string | undefined;
|
|
15
17
|
offset?: unknown;
|
|
16
18
|
limit?: unknown;
|
|
17
|
-
order?: string | undefined;
|
|
18
19
|
with_deleted?: unknown;
|
|
19
20
|
}>;
|
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
export type StoreGetSellersParamsType = z.infer<typeof StoreGetSellersParams>;
|
|
3
3
|
export declare const StoreGetSellersParams: z.ZodObject<{
|
|
4
4
|
fields: z.ZodOptional<z.ZodString>;
|
|
5
|
+
} & {
|
|
5
6
|
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
6
7
|
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
7
8
|
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -9,13 +10,13 @@ export declare const StoreGetSellersParams: z.ZodObject<{
|
|
|
9
10
|
}, "strip", z.ZodTypeAny, {
|
|
10
11
|
offset: number;
|
|
11
12
|
limit: number;
|
|
12
|
-
fields?: string | undefined;
|
|
13
13
|
order?: string | undefined;
|
|
14
|
+
fields?: string | undefined;
|
|
14
15
|
with_deleted?: boolean | undefined;
|
|
15
16
|
}, {
|
|
17
|
+
order?: string | undefined;
|
|
16
18
|
fields?: string | undefined;
|
|
17
19
|
offset?: unknown;
|
|
18
20
|
limit?: unknown;
|
|
19
|
-
order?: string | undefined;
|
|
20
21
|
with_deleted?: unknown;
|
|
21
22
|
}>;
|
|
@@ -17,48 +17,46 @@ export declare const StoreGetShippingOptionsFields: z.ZodObject<{
|
|
|
17
17
|
is_return?: boolean | undefined;
|
|
18
18
|
}>;
|
|
19
19
|
export type StoreGetShippingOptionsType = z.infer<typeof StoreGetShippingOptions>;
|
|
20
|
-
export declare const StoreGetShippingOptions: z.ZodObject<{
|
|
20
|
+
export declare const StoreGetShippingOptions: z.ZodObject<{} & {
|
|
21
21
|
[x: string]: any;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
$and: z.ZodOptional<z.ZodLazy<z.ZodArray<z.ZodObject<{
|
|
23
|
+
cart_id: z.ZodString;
|
|
24
|
+
is_return: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
}, "strict", z.ZodTypeAny, {
|
|
26
|
+
cart_id: string;
|
|
27
|
+
is_return?: boolean | undefined;
|
|
26
28
|
}, {
|
|
27
|
-
|
|
29
|
+
cart_id: string;
|
|
30
|
+
is_return?: boolean | undefined;
|
|
28
31
|
}>, "many">>>;
|
|
29
|
-
$or: z.ZodOptional<z.ZodLazy<z.ZodArray<z.ZodObject<
|
|
30
|
-
|
|
32
|
+
$or: z.ZodOptional<z.ZodLazy<z.ZodArray<z.ZodObject<{
|
|
33
|
+
cart_id: z.ZodString;
|
|
34
|
+
is_return: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
}, "strict", z.ZodTypeAny, {
|
|
36
|
+
cart_id: string;
|
|
37
|
+
is_return?: boolean | undefined;
|
|
31
38
|
}, {
|
|
32
|
-
|
|
39
|
+
cart_id: string;
|
|
40
|
+
is_return?: boolean | undefined;
|
|
33
41
|
}>, "many">>>;
|
|
34
42
|
}, "strip", z.ZodTypeAny, {
|
|
35
43
|
[x: string]: any;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
$and?: {
|
|
39
|
-
[x: string]: any;
|
|
40
|
-
}[] | undefined;
|
|
41
|
-
$or?: {
|
|
42
|
-
[x: string]: any;
|
|
43
|
-
}[] | undefined;
|
|
44
|
+
$and?: unknown;
|
|
45
|
+
$or?: unknown;
|
|
44
46
|
}, {
|
|
45
47
|
[x: string]: any;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
$and?: {
|
|
49
|
-
[x: string]: any;
|
|
50
|
-
}[] | undefined;
|
|
51
|
-
$or?: {
|
|
52
|
-
[x: string]: any;
|
|
53
|
-
}[] | undefined;
|
|
48
|
+
$and?: unknown;
|
|
49
|
+
$or?: unknown;
|
|
54
50
|
}>;
|
|
55
51
|
export type StoreGetReturnShippingOptionsParamsType = z.infer<typeof StoreGetReturnShippingOptions>;
|
|
56
52
|
export declare const StoreGetReturnShippingOptions: z.ZodObject<{
|
|
53
|
+
fields: z.ZodOptional<z.ZodString>;
|
|
54
|
+
} & {
|
|
57
55
|
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
58
56
|
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
59
|
-
fields: z.ZodOptional<z.ZodString>;
|
|
60
57
|
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
61
58
|
with_deleted: z.ZodEffects<z.ZodOptional<z.ZodBoolean>, boolean | undefined, unknown>;
|
|
59
|
+
} & {
|
|
62
60
|
order_id: z.ZodString;
|
|
63
61
|
}, "strict", z.ZodTypeAny, {
|
|
64
62
|
offset: number;
|
|
@@ -18,6 +18,7 @@ export type StoreGetWishlistsParamsType = z.infer<typeof StoreGetWishlistsParams
|
|
|
18
18
|
*/
|
|
19
19
|
export declare const StoreGetWishlistsParams: z.ZodObject<{
|
|
20
20
|
fields: z.ZodOptional<z.ZodString>;
|
|
21
|
+
} & {
|
|
21
22
|
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
22
23
|
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
23
24
|
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -25,14 +26,14 @@ export declare const StoreGetWishlistsParams: z.ZodObject<{
|
|
|
25
26
|
}, "strip", z.ZodTypeAny, {
|
|
26
27
|
offset: number;
|
|
27
28
|
limit: number;
|
|
28
|
-
fields?: string | undefined;
|
|
29
29
|
order?: string | undefined;
|
|
30
|
+
fields?: string | undefined;
|
|
30
31
|
with_deleted?: boolean | undefined;
|
|
31
32
|
}, {
|
|
33
|
+
order?: string | undefined;
|
|
32
34
|
fields?: string | undefined;
|
|
33
35
|
offset?: unknown;
|
|
34
36
|
limit?: unknown;
|
|
35
|
-
order?: string | undefined;
|
|
36
37
|
with_deleted?: unknown;
|
|
37
38
|
}>;
|
|
38
39
|
export type StoreCreateWishlistType = z.infer<typeof StoreCreateWishlist>;
|
|
@@ -2,11 +2,13 @@ import { z } from 'zod';
|
|
|
2
2
|
import { AttributeUIComponent } from '@mercurjs/framework';
|
|
3
3
|
export type VendorGetAttributesParamsType = z.infer<typeof VendorGetAttributesParams>;
|
|
4
4
|
export declare const VendorGetAttributesParams: z.ZodObject<{
|
|
5
|
+
fields: z.ZodOptional<z.ZodString>;
|
|
6
|
+
} & {
|
|
5
7
|
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
6
8
|
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
7
|
-
fields: z.ZodOptional<z.ZodString>;
|
|
8
9
|
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
9
10
|
with_deleted: z.ZodEffects<z.ZodOptional<z.ZodBoolean>, boolean | undefined, unknown>;
|
|
11
|
+
} & {
|
|
10
12
|
id: z.ZodOptional<z.ZodString>;
|
|
11
13
|
name: z.ZodOptional<z.ZodString>;
|
|
12
14
|
handle: z.ZodOptional<z.ZodString>;
|
|
@@ -14,21 +16,21 @@ export declare const VendorGetAttributesParams: z.ZodObject<{
|
|
|
14
16
|
}, "strip", z.ZodTypeAny, {
|
|
15
17
|
offset: number;
|
|
16
18
|
limit: number;
|
|
17
|
-
fields?: string | undefined;
|
|
18
|
-
order?: string | undefined;
|
|
19
|
-
with_deleted?: boolean | undefined;
|
|
20
19
|
id?: string | undefined;
|
|
21
20
|
name?: string | undefined;
|
|
22
21
|
handle?: string | undefined;
|
|
22
|
+
fields?: string | undefined;
|
|
23
|
+
order?: string | undefined;
|
|
24
|
+
with_deleted?: boolean | undefined;
|
|
23
25
|
ui_component?: AttributeUIComponent | undefined;
|
|
24
26
|
}, {
|
|
27
|
+
id?: string | undefined;
|
|
25
28
|
offset?: unknown;
|
|
26
29
|
limit?: unknown;
|
|
30
|
+
name?: string | undefined;
|
|
31
|
+
handle?: string | undefined;
|
|
27
32
|
fields?: string | undefined;
|
|
28
33
|
order?: string | undefined;
|
|
29
34
|
with_deleted?: unknown;
|
|
30
|
-
id?: string | undefined;
|
|
31
|
-
name?: string | undefined;
|
|
32
|
-
handle?: string | undefined;
|
|
33
35
|
ui_component?: AttributeUIComponent | undefined;
|
|
34
36
|
}>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { AuthenticatedMedusaRequest, MedusaResponse } from "@medusajs/framework/http";
|
|
2
|
+
import { LinkMethodRequest } from "@medusajs/framework/types";
|
|
3
|
+
/**
|
|
4
|
+
* @oas [post] /vendor/campaigns/{id}/promotions
|
|
5
|
+
* operationId: VendorPostCampaignsIdPromotions
|
|
6
|
+
* summary: Manage the Promotions of a Campaign
|
|
7
|
+
* description: Manage the promotions of a campaign, either by adding them or removing them from the campaign.
|
|
8
|
+
* x-authenticated: true
|
|
9
|
+
* parameters:
|
|
10
|
+
* - name: id
|
|
11
|
+
* in: path
|
|
12
|
+
* description: The campaign's ID.
|
|
13
|
+
* required: true
|
|
14
|
+
* schema:
|
|
15
|
+
* type: string
|
|
16
|
+
* - name: fields
|
|
17
|
+
* in: query
|
|
18
|
+
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
|
|
19
|
+
* fields. without prefix it will replace the entire default fields.
|
|
20
|
+
* required: false
|
|
21
|
+
* schema:
|
|
22
|
+
* type: string
|
|
23
|
+
* title: fields
|
|
24
|
+
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
|
|
25
|
+
* fields. without prefix it will replace the entire default fields.
|
|
26
|
+
* externalDocs:
|
|
27
|
+
* url: "#select-fields-and-relations"
|
|
28
|
+
* security:
|
|
29
|
+
* - api_token: []
|
|
30
|
+
* - cookie_auth: []
|
|
31
|
+
* - jwt_token: []
|
|
32
|
+
* requestBody:
|
|
33
|
+
* content:
|
|
34
|
+
* application/json:
|
|
35
|
+
* schema:
|
|
36
|
+
* type: object
|
|
37
|
+
* description: The promotions to add or remove from the campaign.
|
|
38
|
+
* properties:
|
|
39
|
+
* add:
|
|
40
|
+
* type: array
|
|
41
|
+
* description: The promotions to add to the campaign.
|
|
42
|
+
* items:
|
|
43
|
+
* type: string
|
|
44
|
+
* title: add
|
|
45
|
+
* description: A promotion's ID.
|
|
46
|
+
* remove:
|
|
47
|
+
* type: array
|
|
48
|
+
* description: The promotions to remove from the campaign.
|
|
49
|
+
* items:
|
|
50
|
+
* type: string
|
|
51
|
+
* title: remove
|
|
52
|
+
* description: A promotion's ID.
|
|
53
|
+
* tags:
|
|
54
|
+
* - Vendor Campaigns
|
|
55
|
+
* responses:
|
|
56
|
+
* "200":
|
|
57
|
+
* description: OK
|
|
58
|
+
* content:
|
|
59
|
+
* application/json:
|
|
60
|
+
* schema:
|
|
61
|
+
* $ref: "#/components/schemas/VendorCampaign"
|
|
62
|
+
* "400":
|
|
63
|
+
* $ref: "#/components/responses/400_error"
|
|
64
|
+
* "401":
|
|
65
|
+
* $ref: "#/components/responses/unauthorized"
|
|
66
|
+
* "404":
|
|
67
|
+
* $ref: "#/components/responses/not_found_error"
|
|
68
|
+
* "409":
|
|
69
|
+
* $ref: "#/components/responses/invalid_state_error"
|
|
70
|
+
* "422":
|
|
71
|
+
* $ref: "#/components/responses/invalid_request_error"
|
|
72
|
+
* "500":
|
|
73
|
+
* $ref: "#/components/responses/500_error"
|
|
74
|
+
*
|
|
75
|
+
*/
|
|
76
|
+
export declare const POST: (req: AuthenticatedMedusaRequest<LinkMethodRequest>, res: MedusaResponse) => Promise<void>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.POST = void 0;
|
|
4
|
+
const core_flows_1 = require("@medusajs/core-flows");
|
|
5
|
+
const helpers_1 = require("@medusajs/medusa/api/admin/campaigns/helpers");
|
|
6
|
+
/**
|
|
7
|
+
* @oas [post] /vendor/campaigns/{id}/promotions
|
|
8
|
+
* operationId: VendorPostCampaignsIdPromotions
|
|
9
|
+
* summary: Manage the Promotions of a Campaign
|
|
10
|
+
* description: Manage the promotions of a campaign, either by adding them or removing them from the campaign.
|
|
11
|
+
* x-authenticated: true
|
|
12
|
+
* parameters:
|
|
13
|
+
* - name: id
|
|
14
|
+
* in: path
|
|
15
|
+
* description: The campaign's ID.
|
|
16
|
+
* required: true
|
|
17
|
+
* schema:
|
|
18
|
+
* type: string
|
|
19
|
+
* - name: fields
|
|
20
|
+
* in: query
|
|
21
|
+
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
|
|
22
|
+
* fields. without prefix it will replace the entire default fields.
|
|
23
|
+
* required: false
|
|
24
|
+
* schema:
|
|
25
|
+
* type: string
|
|
26
|
+
* title: fields
|
|
27
|
+
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
|
|
28
|
+
* fields. without prefix it will replace the entire default fields.
|
|
29
|
+
* externalDocs:
|
|
30
|
+
* url: "#select-fields-and-relations"
|
|
31
|
+
* security:
|
|
32
|
+
* - api_token: []
|
|
33
|
+
* - cookie_auth: []
|
|
34
|
+
* - jwt_token: []
|
|
35
|
+
* requestBody:
|
|
36
|
+
* content:
|
|
37
|
+
* application/json:
|
|
38
|
+
* schema:
|
|
39
|
+
* type: object
|
|
40
|
+
* description: The promotions to add or remove from the campaign.
|
|
41
|
+
* properties:
|
|
42
|
+
* add:
|
|
43
|
+
* type: array
|
|
44
|
+
* description: The promotions to add to the campaign.
|
|
45
|
+
* items:
|
|
46
|
+
* type: string
|
|
47
|
+
* title: add
|
|
48
|
+
* description: A promotion's ID.
|
|
49
|
+
* remove:
|
|
50
|
+
* type: array
|
|
51
|
+
* description: The promotions to remove from the campaign.
|
|
52
|
+
* items:
|
|
53
|
+
* type: string
|
|
54
|
+
* title: remove
|
|
55
|
+
* description: A promotion's ID.
|
|
56
|
+
* tags:
|
|
57
|
+
* - Vendor Campaigns
|
|
58
|
+
* responses:
|
|
59
|
+
* "200":
|
|
60
|
+
* description: OK
|
|
61
|
+
* content:
|
|
62
|
+
* application/json:
|
|
63
|
+
* schema:
|
|
64
|
+
* $ref: "#/components/schemas/VendorCampaign"
|
|
65
|
+
* "400":
|
|
66
|
+
* $ref: "#/components/responses/400_error"
|
|
67
|
+
* "401":
|
|
68
|
+
* $ref: "#/components/responses/unauthorized"
|
|
69
|
+
* "404":
|
|
70
|
+
* $ref: "#/components/responses/not_found_error"
|
|
71
|
+
* "409":
|
|
72
|
+
* $ref: "#/components/responses/invalid_state_error"
|
|
73
|
+
* "422":
|
|
74
|
+
* $ref: "#/components/responses/invalid_request_error"
|
|
75
|
+
* "500":
|
|
76
|
+
* $ref: "#/components/responses/500_error"
|
|
77
|
+
*
|
|
78
|
+
*/
|
|
79
|
+
const POST = async (req, res) => {
|
|
80
|
+
const { id } = req.params;
|
|
81
|
+
const { add, remove } = req.validatedBody;
|
|
82
|
+
await (0, core_flows_1.addOrRemoveCampaignPromotionsWorkflow)(req.scope).run({
|
|
83
|
+
input: { id, add, remove },
|
|
84
|
+
});
|
|
85
|
+
const campaign = await (0, helpers_1.refetchCampaign)(req.params.id, req.scope, req.queryConfig.fields);
|
|
86
|
+
res.status(200).json({ campaign });
|
|
87
|
+
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R0FBRyxDQUFDLENBQUMsSUFBSSxDQUFDLEVBQUUsUUFBUSxFQUFFLENBQUMsQ0FBQTtBQUNwQyxDQUFDLENBQUE7QUFqQlksUUFBQSxJQUFJLFFBaUJoQiJ9
|
|
@@ -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"
|