fix: merge
This commit is contained in:
62
docs-util/fixture-gen/__tests__/admin/auth.js
Normal file
62
docs-util/fixture-gen/__tests__/admin/auth.js
Normal file
@@ -0,0 +1,62 @@
|
||||
const { dropDatabase } = require("pg-god");
|
||||
const path = require("path");
|
||||
|
||||
const setupServer = require("../../../helpers/setup-server");
|
||||
const { useApi } = require("../../../helpers/use-api");
|
||||
const { initDb } = require("../../../helpers/use-db");
|
||||
|
||||
const adminSeeder = require("../../helpers/admin-seeder");
|
||||
|
||||
const fixtureWriter = require("../../utils/write-fixture").default;
|
||||
|
||||
jest.setTimeout(30000);
|
||||
|
||||
describe("/admin/auth", () => {
|
||||
let medusaProcess;
|
||||
let dbConnection;
|
||||
|
||||
beforeAll(async () => {
|
||||
const cwd = path.resolve(path.join(__dirname, "..", ".."));
|
||||
dbConnection = await initDb({ cwd });
|
||||
medusaProcess = await setupServer({ cwd });
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await dbConnection.close();
|
||||
await dropDatabase({ databaseName: "medusa-fixtures" });
|
||||
|
||||
medusaProcess.kill();
|
||||
});
|
||||
|
||||
describe("POST /admin/products", () => {
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
const manager = dbConnection.manager;
|
||||
await manager.query(`DELETE FROM "user"`);
|
||||
});
|
||||
|
||||
it("authenticates user", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const response = await api
|
||||
.post("/admin/auth", {
|
||||
email: "admin@medusa.js",
|
||||
password: "secret_password",
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
expect(response.status).toEqual(200);
|
||||
|
||||
fixtureWriter.addFixture("user", response.data.user);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,6 @@
|
||||
const { dropDatabase } = require("pg-god");
|
||||
const path = require("path");
|
||||
const { ProductVariant } = require("@medusajs/medusa");
|
||||
|
||||
const setupServer = require("../../../helpers/setup-server");
|
||||
const { useApi } = require("../../../helpers/use-api");
|
||||
@@ -161,4 +162,93 @@ describe("/admin/orders", () => {
|
||||
fixtureWriter.addFixture("return", response.data.order.returns[0]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("POST /admin/orders/:id/swaps", () => {
|
||||
let id;
|
||||
let varId;
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection);
|
||||
const order = await orderSeeder(dbConnection, {
|
||||
fulfillment_status: "fulfilled",
|
||||
payment_status: "captured",
|
||||
});
|
||||
id = order.id;
|
||||
|
||||
const pVar = await dbConnection.manager.findOne(ProductVariant, {});
|
||||
varId = pVar.id;
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
const manager = dbConnection.manager;
|
||||
await manager.query(`DELETE FROM "fulfillment_item"`);
|
||||
await manager.query(`DELETE FROM "fulfillment"`);
|
||||
await manager.query(`DELETE FROM "return_item"`);
|
||||
await manager.query(`DELETE FROM "return"`);
|
||||
await manager.query(`DELETE FROM "claim_image"`);
|
||||
await manager.query(`DELETE FROM "claim_tag"`);
|
||||
await manager.query(`DELETE FROM "claim_item"`);
|
||||
await manager.query(`DELETE FROM "shipping_method"`);
|
||||
await manager.query(`DELETE FROM "line_item"`);
|
||||
await manager.query(`DELETE FROM "swap"`);
|
||||
await manager.query(`DELETE FROM "cart"`);
|
||||
await manager.query(`DELETE FROM "claim_order"`);
|
||||
await manager.query(`DELETE FROM "money_amount"`);
|
||||
await manager.query(`DELETE FROM "product_option_value"`);
|
||||
await manager.query(`DELETE FROM "product_option"`);
|
||||
await manager.query(`DELETE FROM "product_variant"`);
|
||||
await manager.query(`DELETE FROM "product"`);
|
||||
await manager.query(`DELETE FROM "shipping_option"`);
|
||||
await manager.query(`DELETE FROM "discount"`);
|
||||
await manager.query(`DELETE FROM "payment"`);
|
||||
await manager.query(`DELETE FROM "order"`);
|
||||
await manager.query(`DELETE FROM "customer"`);
|
||||
await manager.query(
|
||||
`UPDATE "country" SET region_id=NULL WHERE iso_2 = 'us'`
|
||||
);
|
||||
await manager.query(`DELETE FROM "region"`);
|
||||
await manager.query(`DELETE FROM "user"`);
|
||||
});
|
||||
|
||||
it("creates a swap", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const { data } = await api.get(`/admin/orders/${id}`, {
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
},
|
||||
});
|
||||
const order = data.order;
|
||||
|
||||
const response = await api.post(
|
||||
`/admin/orders/${id}/swaps`,
|
||||
{
|
||||
return_items: [
|
||||
{
|
||||
item_id: order.items[0].id,
|
||||
quantity: 1,
|
||||
},
|
||||
],
|
||||
additional_items: [
|
||||
{
|
||||
variant_id: varId,
|
||||
quantity: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
},
|
||||
}
|
||||
);
|
||||
expect(response.status).toEqual(200);
|
||||
|
||||
fixtureWriter.addFixture("swap", response.data.order.swaps[0]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -78,10 +78,6 @@ describe("/shipping-options", () => {
|
||||
|
||||
fixtureWriter.addFixture("region", getRes.data.shipping_option.region);
|
||||
fixtureWriter.addFixture("shipping_option", getRes.data.shipping_option);
|
||||
fixtureWriter.addFixture(
|
||||
"shipping_profile",
|
||||
getRes.data.shipping_option.shipping_profile
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
74
docs-util/fixture-gen/__tests__/admin/shipping-profile.js
Normal file
74
docs-util/fixture-gen/__tests__/admin/shipping-profile.js
Normal file
@@ -0,0 +1,74 @@
|
||||
const { dropDatabase } = require("pg-god");
|
||||
const path = require("path");
|
||||
const { Region } = require("@medusajs/medusa");
|
||||
|
||||
const setupServer = require("../../../helpers/setup-server");
|
||||
const { useApi } = require("../../../helpers/use-api");
|
||||
const { initDb } = require("../../../helpers/use-db");
|
||||
|
||||
const adminSeeder = require("../../helpers/admin-seeder");
|
||||
|
||||
const fixtureWriter = require("../../utils/write-fixture").default;
|
||||
|
||||
jest.setTimeout(30000);
|
||||
|
||||
describe("/shipping-profiles", () => {
|
||||
let medusaProcess;
|
||||
let dbConnection;
|
||||
|
||||
beforeAll(async () => {
|
||||
const cwd = path.resolve(path.join(__dirname, "..", ".."));
|
||||
dbConnection = await initDb({ cwd });
|
||||
medusaProcess = await setupServer({ cwd });
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
dbConnection.close();
|
||||
await dropDatabase({ databaseName: "medusa-fixtures" });
|
||||
|
||||
medusaProcess.kill();
|
||||
});
|
||||
|
||||
describe("POST /admin/shipping-profiles", () => {
|
||||
let regId;
|
||||
beforeEach(async () => {
|
||||
await adminSeeder(dbConnection);
|
||||
const manager = dbConnection.manager;
|
||||
const created = manager.create(Region, {
|
||||
name: "Test Region",
|
||||
currency_code: "usd",
|
||||
tax_rate: 0,
|
||||
fulfillment_providers: [
|
||||
{
|
||||
id: "test-ful",
|
||||
},
|
||||
],
|
||||
});
|
||||
const newReg = await manager.save(created);
|
||||
regId = newReg.id;
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
const manager = dbConnection.manager;
|
||||
await manager.query(`DELETE FROM "shipping_option"`);
|
||||
await manager.query(`DELETE FROM "region"`);
|
||||
await manager.query(`DELETE FROM "user"`);
|
||||
});
|
||||
|
||||
it("creates a cart", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const getRes = await api.get(`/admin/shipping-profiles`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
},
|
||||
});
|
||||
expect(getRes.status).toEqual(200);
|
||||
|
||||
fixtureWriter.addFixture(
|
||||
"shipping_profile",
|
||||
getRes.data.shipping_profiles[0]
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
56
docs-util/fixture-gen/__tests__/admin/store.js
Normal file
56
docs-util/fixture-gen/__tests__/admin/store.js
Normal file
@@ -0,0 +1,56 @@
|
||||
const { dropDatabase } = require("pg-god");
|
||||
const path = require("path");
|
||||
const { Region } = require("@medusajs/medusa");
|
||||
|
||||
const setupServer = require("../../../helpers/setup-server");
|
||||
const { useApi } = require("../../../helpers/use-api");
|
||||
const { initDb } = require("../../../helpers/use-db");
|
||||
|
||||
const adminSeeder = require("../../helpers/admin-seeder");
|
||||
|
||||
const fixtureWriter = require("../../utils/write-fixture").default;
|
||||
|
||||
jest.setTimeout(30000);
|
||||
|
||||
describe("/shipping-profiles", () => {
|
||||
let medusaProcess;
|
||||
let dbConnection;
|
||||
|
||||
beforeAll(async () => {
|
||||
const cwd = path.resolve(path.join(__dirname, "..", ".."));
|
||||
dbConnection = await initDb({ cwd });
|
||||
medusaProcess = await setupServer({ cwd });
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
dbConnection.close();
|
||||
await dropDatabase({ databaseName: "medusa-fixtures" });
|
||||
|
||||
medusaProcess.kill();
|
||||
});
|
||||
|
||||
describe("GET /admin/store", () => {
|
||||
let regId;
|
||||
beforeEach(async () => {
|
||||
await adminSeeder(dbConnection);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
const manager = dbConnection.manager;
|
||||
await manager.query(`DELETE FROM "user"`);
|
||||
});
|
||||
|
||||
it("creates a cart", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const getRes = await api.get(`/admin/store`, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
},
|
||||
});
|
||||
expect(getRes.status).toEqual(200);
|
||||
|
||||
fixtureWriter.addFixture("store", getRes.data.store);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -43,7 +43,7 @@ module.exports = async (connection, data = {}) => {
|
||||
},
|
||||
],
|
||||
});
|
||||
const newProdVar = manager.save(prodVar);
|
||||
const newProdVar = await manager.save(prodVar);
|
||||
|
||||
const ma = manager.create(MoneyAmount, {
|
||||
variant_id: newProdVar.id,
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
"build": "babel src -d dist --extensions \".ts,.js\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@medusajs/medusa": "1.1.11-dev-1615546466988",
|
||||
"medusa-interfaces": "1.1.1-dev-1615546466988"
|
||||
"@medusajs/medusa": "1.1.11-dev-1615929449260",
|
||||
"medusa-interfaces": "1.1.1-dev-1615929449260"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.12.10",
|
||||
"@babel/core": "^7.12.10",
|
||||
"@babel/node": "^7.12.10",
|
||||
"babel-preset-medusa-package": "1.1.0-dev-1615546466988"
|
||||
"babel-preset-medusa-package": "1.1.0-dev-1615929449260"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -946,10 +946,10 @@
|
||||
dependencies:
|
||||
"@hapi/hoek" "^9.0.0"
|
||||
|
||||
"@medusajs/medusa@1.1.11-dev-1615546466988":
|
||||
version "1.1.11-dev-1615546466988"
|
||||
resolved "http://localhost:4873/@medusajs%2fmedusa/-/medusa-1.1.11-dev-1615546466988.tgz#6d09c9ae174cee30a70e76e7e50e69bfc7d4b92a"
|
||||
integrity sha512-Y9gB8VXoZ/SN00UB8hRJ4xWRdSZX3mCz19ls2SDP4SrqUlWcG04LZDYeKbXQqXRKFFzwR/yNnWOCkLvlrK+69w==
|
||||
"@medusajs/medusa@1.1.11-dev-1615929449260":
|
||||
version "1.1.11-dev-1615929449260"
|
||||
resolved "http://localhost:4873/@medusajs%2fmedusa/-/medusa-1.1.11-dev-1615929449260.tgz#4635d197df491fa10ad80c6fda5818edb6cbe9ad"
|
||||
integrity sha512-Yx94TuEWe76MLslv1PmDOIDrEJ5lQz8cL2rikK7OquK4oyt0Y8xCE5MNgiiZCP71/sv3TMCoTx0GZxrl02vk8w==
|
||||
dependencies:
|
||||
"@babel/plugin-transform-classes" "^7.9.5"
|
||||
"@hapi/joi" "^16.1.8"
|
||||
@@ -971,8 +971,8 @@
|
||||
joi "^17.3.0"
|
||||
joi-objectid "^3.0.1"
|
||||
jsonwebtoken "^8.5.1"
|
||||
medusa-core-utils "1.1.0-dev-1615546466988"
|
||||
medusa-test-utils "1.1.3-dev-1615546466988"
|
||||
medusa-core-utils "1.1.0-dev-1615929449260"
|
||||
medusa-test-utils "1.1.3-dev-1615929449260"
|
||||
morgan "^1.9.1"
|
||||
multer "^1.4.2"
|
||||
passport "^0.4.0"
|
||||
@@ -1184,10 +1184,10 @@ babel-plugin-transform-typescript-metadata@^0.3.1:
|
||||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.0.0"
|
||||
|
||||
babel-preset-medusa-package@1.1.0-dev-1615546466988:
|
||||
version "1.1.0-dev-1615546466988"
|
||||
resolved "http://localhost:4873/babel-preset-medusa-package/-/babel-preset-medusa-package-1.1.0-dev-1615546466988.tgz#7b99e2a01c4aa9ccd0f293ca6015c866cae941b5"
|
||||
integrity sha512-lMNL7fpsVgHJsiX69p7VLmNh7wCjA6nRZq9nslRisBYgeZ4O5fpatlXvL22kU4HaxGhhhF6n5LdpovCcvXoJYg==
|
||||
babel-preset-medusa-package@1.1.0-dev-1615929449260:
|
||||
version "1.1.0-dev-1615929449260"
|
||||
resolved "http://localhost:4873/babel-preset-medusa-package/-/babel-preset-medusa-package-1.1.0-dev-1615929449260.tgz#668c9d5f7e385ca1f3b0c681b6e90f0195d45025"
|
||||
integrity sha512-y3GY3HFPPWOCY6OZ3rh3Ybms/LI6PzvD6Mo+nP6RBw1us6p4UAle1EoQrOp4gXYb5WX9PsYN5TwVUwgDNO7uwg==
|
||||
dependencies:
|
||||
"@babel/plugin-proposal-class-properties" "^7.12.1"
|
||||
"@babel/plugin-proposal-decorators" "^7.12.1"
|
||||
@@ -2649,28 +2649,28 @@ media-typer@0.3.0:
|
||||
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
|
||||
integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=
|
||||
|
||||
medusa-core-utils@1.1.0-dev-1615546466988:
|
||||
version "1.1.0-dev-1615546466988"
|
||||
resolved "http://localhost:4873/medusa-core-utils/-/medusa-core-utils-1.1.0-dev-1615546466988.tgz#dfcc316b59d24c0c03c2f3eb53f8c9fe9771cc03"
|
||||
integrity sha512-LHKb/CiNTgbCDHJPt32QCnm4/J39uMasv19TUSB3/8Np85RWalXWQjMWmQF+f/pFuzB0/6bx7z4SFiYK6dw7YQ==
|
||||
medusa-core-utils@1.1.0-dev-1615929449260:
|
||||
version "1.1.0-dev-1615929449260"
|
||||
resolved "http://localhost:4873/medusa-core-utils/-/medusa-core-utils-1.1.0-dev-1615929449260.tgz#ad6334e195a77cbf1764ea637f6071a4441adf68"
|
||||
integrity sha512-udhVtrOWoab7Mljb4r427+iCZ1vy/XJb+yr6Q8xZe535on6DYpjahEiuLgkyy19wX50kVv5yt3raTE4Vg3yKEw==
|
||||
dependencies:
|
||||
joi "^17.3.0"
|
||||
joi-objectid "^3.0.1"
|
||||
|
||||
medusa-interfaces@1.1.1-dev-1615546466988:
|
||||
version "1.1.1-dev-1615546466988"
|
||||
resolved "http://localhost:4873/medusa-interfaces/-/medusa-interfaces-1.1.1-dev-1615546466988.tgz#0e109781d8691b8495c79e4d3bccd5c63668fcf0"
|
||||
integrity sha512-Hc+aSqTwPU63HJDi11eGj5uP3ebCi3BC5YEDptumMf/JRDDZdwq8SRcwtCNKMBSIlPpsqjBqHcm8Dn7uvwXhhA==
|
||||
medusa-interfaces@1.1.1-dev-1615929449260:
|
||||
version "1.1.1-dev-1615929449260"
|
||||
resolved "http://localhost:4873/medusa-interfaces/-/medusa-interfaces-1.1.1-dev-1615929449260.tgz#6034b9f472591b85294430ecce8c68a8b05bd58a"
|
||||
integrity sha512-w4ORNLHtec/DbMTLCfWatcUU9uVZfQtiOV12/quxg+N9K/2yk7jl8SAWhFiCc0gbT7Trwy1+V8esGEaAIPqMkQ==
|
||||
dependencies:
|
||||
medusa-core-utils "1.1.0-dev-1615546466988"
|
||||
medusa-core-utils "1.1.0-dev-1615929449260"
|
||||
|
||||
medusa-test-utils@1.1.3-dev-1615546466988:
|
||||
version "1.1.3-dev-1615546466988"
|
||||
resolved "http://localhost:4873/medusa-test-utils/-/medusa-test-utils-1.1.3-dev-1615546466988.tgz#85e3f5b435fe4259cab3ac69bad9a23d1b301c4f"
|
||||
integrity sha512-ZBqX7+UEFYXcdoRFnNiv6uv3UR+bU2IBLMVdAk+/FpxX9GYBW385LKoUiCs6oRIAtHqFICHh+RNuakI2v7ra7A==
|
||||
medusa-test-utils@1.1.3-dev-1615929449260:
|
||||
version "1.1.3-dev-1615929449260"
|
||||
resolved "http://localhost:4873/medusa-test-utils/-/medusa-test-utils-1.1.3-dev-1615929449260.tgz#7b6d81c6eae1147e5f36d7242021f9f245e8662d"
|
||||
integrity sha512-Kqxf8/HjusYvVLf6jjdC62ci68JGyE20P1W8suB7cM8qnXNJHuKh5EXhFJRFX00tgr3N2oq68qrAUNcakB0IKA==
|
||||
dependencies:
|
||||
"@babel/plugin-transform-classes" "^7.9.5"
|
||||
medusa-core-utils "1.1.0-dev-1615546466988"
|
||||
medusa-core-utils "1.1.0-dev-1615929449260"
|
||||
randomatic "^3.1.1"
|
||||
|
||||
merge-descriptors@1.0.1:
|
||||
|
||||
@@ -6,8 +6,8 @@ const importFrom = require("import-from");
|
||||
const initialize = async () => {
|
||||
const app = express();
|
||||
|
||||
const loaders = importFrom(process.cwd(), "@medusajs/medusa/dist/loaders")
|
||||
.default;
|
||||
const cwd = process.cwd();
|
||||
const loaders = importFrom(cwd, "@medusajs/medusa/dist/loaders").default;
|
||||
|
||||
const { dbConnection } = await loaders({
|
||||
directory: path.resolve(process.cwd()),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -53,7 +53,7 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
customer:
|
||||
user:
|
||||
$ref: '#/components/schemas/user'
|
||||
requestBody:
|
||||
content:
|
||||
@@ -83,7 +83,7 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
customer:
|
||||
user:
|
||||
$ref: '#/components/schemas/user'
|
||||
/collections:
|
||||
post:
|
||||
@@ -695,6 +695,49 @@ paths:
|
||||
properties:
|
||||
discount:
|
||||
$ref: '#/components/schemas/discount'
|
||||
/notifications:
|
||||
get:
|
||||
operationId: GetNotifications
|
||||
summary: List Notifications
|
||||
description: Retrieves a list of Notifications.
|
||||
tags:
|
||||
- Notification
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
notifications:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/notification'
|
||||
'/notifications/{id}/resend':
|
||||
post:
|
||||
operationId: PostNotificationsNotificationResend
|
||||
summary: Resend Notification
|
||||
description: >-
|
||||
Resends a previously sent notifications, with the same data but
|
||||
optionally to a different address
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Notification
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Notification
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
notification:
|
||||
$ref: '#/components/schemas/notification'
|
||||
/gift-cards:
|
||||
post:
|
||||
operationId: PostGiftCards
|
||||
@@ -867,49 +910,6 @@ paths:
|
||||
properties:
|
||||
gift_card:
|
||||
$ref: '#/components/schemas/gift_card'
|
||||
/notifications:
|
||||
get:
|
||||
operationId: GetNotifications
|
||||
summary: List Notifications
|
||||
description: Retrieves a list of Notifications.
|
||||
tags:
|
||||
- Notification
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
notifications:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/notification'
|
||||
'/notifications/{id}/resend':
|
||||
post:
|
||||
operationId: PostNotificationsNotificationResend
|
||||
summary: Resend Notification
|
||||
description: >-
|
||||
Resends a previously sent notifications, with the same data but
|
||||
optionally to a different address
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Notification
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Notification
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
notification:
|
||||
$ref: '#/components/schemas/notification'
|
||||
'/orders/{id}/shipping-methods':
|
||||
post:
|
||||
operationId: PostOrdersOrderShippingMethods
|
||||
@@ -1511,8 +1511,10 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
order:
|
||||
$ref: '#/components/schemas/order'
|
||||
orders:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/order'
|
||||
'/orders/{id}/swaps/{swap_id}/process-payment':
|
||||
post:
|
||||
operationId: PostOrdersOrderSwapsSwapProcessPayment
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1000,6 +1000,7 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
<<<<<<< HEAD
|
||||
id:
|
||||
description: The id of the Gift Card
|
||||
code:
|
||||
@@ -1104,6 +1105,8 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
=======
|
||||
>>>>>>> origin/master
|
||||
customer:
|
||||
$ref: '#/components/schemas/customer'
|
||||
'/regions/{id}':
|
||||
@@ -1156,6 +1159,7 @@ paths:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/region'
|
||||
<<<<<<< HEAD
|
||||
'/swaps/{cart_id}':
|
||||
get:
|
||||
operationId: GetSwapsSwapCartId
|
||||
@@ -1180,11 +1184,15 @@ paths:
|
||||
swap:
|
||||
$ref: '#/components/schemas/swap'
|
||||
/shipping-options:
|
||||
=======
|
||||
'/products/{id}':
|
||||
>>>>>>> origin/master
|
||||
get:
|
||||
operationId: GetShippingOptions
|
||||
summary: Retrieve Shipping Options
|
||||
description: Retrieves a list of Shipping Options.
|
||||
operationId: GetProductsProduct
|
||||
summary: Retrieves a Product
|
||||
description: Retrieves a Product.
|
||||
parameters:
|
||||
<<<<<<< HEAD
|
||||
- in: query
|
||||
name: is_return
|
||||
description: >-
|
||||
@@ -1200,6 +1208,140 @@ paths:
|
||||
- in: query
|
||||
name: region_id
|
||||
description: the Region to retrieve Shipping Options from.
|
||||
=======
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Product.
|
||||
>>>>>>> origin/master
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Product
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
product:
|
||||
$ref: '#/components/schemas/product'
|
||||
/products:
|
||||
get:
|
||||
operationId: GetProducts
|
||||
summary: List Products
|
||||
description: Retrieves a list of Products.
|
||||
tags:
|
||||
- Product
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
count:
|
||||
description: The total number of Products.
|
||||
type: integer
|
||||
offset:
|
||||
description: The offset for pagination.
|
||||
type: integer
|
||||
limit:
|
||||
description: 'The maxmimum number of Products to return,'
|
||||
type: integer
|
||||
products:
|
||||
type: array
|
||||
items:
|
||||
<<<<<<< HEAD
|
||||
$ref: '#/components/schemas/shipping_option'
|
||||
=======
|
||||
$ref: '#/components/schemas/product'
|
||||
'/swaps/{cart_id}':
|
||||
get:
|
||||
operationId: GetSwapsSwapCartId
|
||||
summary: Retrieve Swap by Cart id
|
||||
description: Retrieves a Swap by the id of the Cart used to confirm the Swap.
|
||||
parameters:
|
||||
- in: path
|
||||
name: cart_id
|
||||
required: true
|
||||
description: The id of the Cart
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Swap
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
swap:
|
||||
$ref: '#/components/schemas/swap'
|
||||
>>>>>>> origin/master
|
||||
'/variants/{variant_id}':
|
||||
get:
|
||||
operationId: GetVariantsVariant
|
||||
summary: Retrieve a Product Variant
|
||||
description: Retrieves a Product Variant by id
|
||||
parameters:
|
||||
- in: path
|
||||
name: variant_id
|
||||
required: true
|
||||
description: The id of the Product Variant.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Product Variant
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
variant:
|
||||
$ref: '#/components/schemas/product_variant'
|
||||
/variants:
|
||||
get:
|
||||
operationId: GetVariants
|
||||
summary: Retrieve Product Variants
|
||||
description: Retrieves a list of Product Variants
|
||||
parameters:
|
||||
- in: query
|
||||
name: ids
|
||||
description: A comma separated list of Product Variant ids to filter by.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Product Variant
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
variants:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/product_variant'
|
||||
/shipping-options:
|
||||
get:
|
||||
operationId: GetShippingOptions
|
||||
summary: Retrieve Shipping Options
|
||||
description: Retrieves a list of Shipping Options.
|
||||
parameters:
|
||||
- in: query
|
||||
name: product_ids
|
||||
description: A comma separated list of Product ids to filter Shipping Options by.
|
||||
schema:
|
||||
type: string
|
||||
- in: query
|
||||
name: region_id
|
||||
description: the Region to retrieve Shipping Options from.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
@@ -1240,53 +1382,6 @@ paths:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/shipping_option'
|
||||
'/variants/{variant_id}':
|
||||
get:
|
||||
operationId: GetVariantsVariant
|
||||
summary: Retrieve a Product Variant
|
||||
description: Retrieves a Product Variant by id
|
||||
parameters:
|
||||
- in: path
|
||||
name: variant_id
|
||||
required: true
|
||||
description: The id of the Product Variant.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Product Variant
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
variant:
|
||||
$ref: '#/components/schemas/product_variant'
|
||||
/variants:
|
||||
get:
|
||||
operationId: GetVariants
|
||||
summary: Retrieve Product Variants
|
||||
description: Retrieves a list of Product Variants
|
||||
parameters:
|
||||
- in: query
|
||||
name: ids
|
||||
description: A comma separated list of Product Variant ids to filter by.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Product Variant
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
variants:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/product_variant'
|
||||
components:
|
||||
schemas:
|
||||
address:
|
||||
|
||||
@@ -2282,9 +2282,9 @@ domexception@^1.0.1:
|
||||
webidl-conversions "^4.0.2"
|
||||
|
||||
dot-prop@^4.1.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.0.tgz#1f19e0c2e1aa0e32797c49799f2837ac6af69c57"
|
||||
integrity sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.1.tgz#45884194a71fc2cda71cbb4bceb3a4dd2f433ba4"
|
||||
integrity sha512-l0p4+mIuJIua0mhxGoh4a+iNL9bmeK5DvnSVQa6T0OhrVmaEa1XScX5Etc673FePCJOArq/4Pa2cLGODUWTPOQ==
|
||||
dependencies:
|
||||
is-obj "^1.0.0"
|
||||
|
||||
@@ -3213,9 +3213,9 @@ inherits@2.0.3:
|
||||
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
|
||||
|
||||
ini@^1.3.4, ini@~1.3.0:
|
||||
version "1.3.5"
|
||||
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
|
||||
integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==
|
||||
version "1.3.8"
|
||||
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c"
|
||||
integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==
|
||||
|
||||
inquirer@^7.0.0:
|
||||
version "7.1.0"
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
"test:fixtures": "jest --config=docs-util/jest.config.js --runInBand"
|
||||
},
|
||||
"dependencies": {
|
||||
"import-from": "^3.0.0",
|
||||
"oas-normalize": "^2.3.1",
|
||||
"swagger-inline": "^3.2.2"
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
module.exports = {
|
||||
testEnvironment: "node",
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import _ from "lodash"
|
||||
import jwt from "jsonwebtoken"
|
||||
import { Validator } from "medusa-core-utils"
|
||||
import config from "../../../../config"
|
||||
@@ -19,7 +20,7 @@ import config from "../../../../config"
|
||||
* application/json:
|
||||
* schema:
|
||||
* properties:
|
||||
* customer:
|
||||
* user:
|
||||
* $ref: "#/components/schemas/user"
|
||||
*/
|
||||
export default async (req, res) => {
|
||||
@@ -46,5 +47,7 @@ export default async (req, res) => {
|
||||
expiresIn: "24h",
|
||||
})
|
||||
|
||||
res.json({ user: result.user })
|
||||
const cleanRes = _.omit(result.user, ["password_hash"])
|
||||
|
||||
res.json({ user: cleanRes })
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import passport from "passport"
|
||||
import _ from "lodash"
|
||||
|
||||
/**
|
||||
* @oas [get] /auth
|
||||
@@ -14,11 +14,13 @@ import passport from "passport"
|
||||
* application/json:
|
||||
* schema:
|
||||
* properties:
|
||||
* customer:
|
||||
* user:
|
||||
* $ref: "#/components/schemas/user"
|
||||
*/
|
||||
export default async (req, res) => {
|
||||
const userService = req.scope.resolve("userService")
|
||||
const user = await userService.retrieve(req.user.userId)
|
||||
res.status(200).json({ user })
|
||||
|
||||
const cleanRes = _.omit(user, ["password_hash"])
|
||||
res.status(200).json({ user: cleanRes })
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { defaultFields, defaultRelations } from "./"
|
||||
* summary: "Create a Swap"
|
||||
* description: "Creates a Swap. Swaps are used to handle Return of previously purchased goods and Fulfillment of replacements simultaneously."
|
||||
* parameters:
|
||||
* - (path) id=* {string} The id of the Swap.
|
||||
* - (path) id=* {string} The id of the Order.
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
|
||||
@@ -6,7 +6,7 @@ import { MedusaError, Validator } from "medusa-core-utils"
|
||||
* @oas [get] /orders
|
||||
* operationId: "GetOrders"
|
||||
* summary: "List Orders"
|
||||
* description: "Retrieves an list of Orders"
|
||||
* description: "Retrieves a list of Orders"
|
||||
* tags:
|
||||
* - Order
|
||||
* responses:
|
||||
@@ -16,8 +16,10 @@ import { MedusaError, Validator } from "medusa-core-utils"
|
||||
* application/json:
|
||||
* schema:
|
||||
* properties:
|
||||
* order:
|
||||
* $ref: "#/components/schemas/order"
|
||||
* orders:
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: "#/components/schemas/order"
|
||||
*/
|
||||
export default async (req, res) => {
|
||||
const schema = Validator.orderFilter()
|
||||
|
||||
@@ -2724,9 +2724,9 @@ domexception@^1.0.1:
|
||||
webidl-conversions "^4.0.2"
|
||||
|
||||
dot-prop@^4.1.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.0.tgz#1f19e0c2e1aa0e32797c49799f2837ac6af69c57"
|
||||
integrity sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.1.tgz#45884194a71fc2cda71cbb4bceb3a4dd2f433ba4"
|
||||
integrity sha512-l0p4+mIuJIua0mhxGoh4a+iNL9bmeK5DvnSVQa6T0OhrVmaEa1XScX5Etc673FePCJOArq/4Pa2cLGODUWTPOQ==
|
||||
dependencies:
|
||||
is-obj "^1.0.0"
|
||||
|
||||
@@ -3594,9 +3594,9 @@ has@^1.0.1, has@^1.0.3:
|
||||
function-bind "^1.1.1"
|
||||
|
||||
highlight.js@^10.0.0:
|
||||
version "10.4.0"
|
||||
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.4.0.tgz#ef3ce475e5dfa7a48484260b49ea242ddab823a0"
|
||||
integrity sha512-EfrUGcQ63oLJbj0J0RI9ebX6TAITbsDBLbsjr881L/X5fMO9+oadKzEF21C7R3ULKG6Gv3uoab2HiqVJa/4+oA==
|
||||
version "10.5.0"
|
||||
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.5.0.tgz#3f09fede6a865757378f2d9ebdcbc15ba268f98f"
|
||||
integrity sha512-xTmvd9HiIHR6L53TMC7TKolEj65zG1XU+Onr8oi86mYa+nLcIbxTTWkpW7CsEwv/vK7u1zb8alZIMLDqqN6KTw==
|
||||
|
||||
homedir-polyfill@^1.0.1:
|
||||
version "1.0.3"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The BSD Zero Clause License (0BSD)
|
||||
|
||||
Copyright (c) 2020 Gatsby Inc.
|
||||
Copyright (c) 2020 Medusa Commerce
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
@@ -49,8 +49,19 @@ const JsonBox = ({ text, resourceId, endpoint, spec }) => {
|
||||
cleanDets["x-resourceId"] in fixtures.resources
|
||||
) {
|
||||
toSet[name] = fixtures.resources[cleanDets["x-resourceId"]]
|
||||
} else {
|
||||
} else if (cleanDets.type === "array") {
|
||||
toSet[name] = cleanDets
|
||||
if (cleanDets.items.$ref) {
|
||||
const [, ...path] = cleanDets.items.$ref.split("/")
|
||||
let cleanObj = deref(path, spec)
|
||||
if (
|
||||
cleanObj["x-resourceId"] &&
|
||||
cleanObj["x-resourceId"] in fixtures.resources
|
||||
) {
|
||||
cleanObj = fixtures.resources[cleanObj["x-resourceId"]]
|
||||
}
|
||||
toSet[name] = [cleanObj]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user