fix merge conflicts

This commit is contained in:
olivermrbl
2021-03-17 14:50:07 +01:00
65 changed files with 3527 additions and 2619 deletions
@@ -2,7 +2,7 @@ import { MedusaError, Validator } from "medusa-core-utils"
import { defaultRelations, defaultFields } from "./"
/**
* @oas [post] /return-reasons/:id
* @oas [post] /return-reasons/{id}
* operationId: "PostReturnReasonsReason"
* summary: "Update a Return Reason"
* description: "Updates a Return Reason"
@@ -5,8 +5,10 @@ import { defaultRelations, defaultFields } from "./"
* operationId: "GetGiftCardsCode"
* summary: "Retrieve Gift Card by Code"
* description: "Retrieves a Gift Card by its associated unqiue code."
* parameters:
* - (path) code=* {string} The unique Gift Card code.
* tags:
* - Region
* - Gift Card
* responses:
* 200:
* description: OK
@@ -22,6 +24,8 @@ import { defaultRelations, defaultFields } from "./"
* description: The original value of the Gift Card.
* balance:
* description: The current balanace of the Gift Card
* region:
* $ref: "#/components/schemas/region"
*/
export default async (req, res) => {
const { code } = req.params
@@ -11,10 +11,10 @@ export default app => {
return app
}
export const defaultRelations = []
export const defaultRelations = ["region"]
export const defaultFields = ["id", "code", "value", "balance"]
export const allowedRelations = []
export const allowedRelations = ["region"]
export const allowedFields = ["id", "code", "value", "balance"]
@@ -6,9 +6,19 @@ const route = Router()
export default app => {
app.use("/orders", route)
/**
* Lookup
*/
route.get("/", middlewares.wrap(require("./lookup-order").default))
/**
* Retrieve Order
*/
route.get("/:id", middlewares.wrap(require("./get-order").default))
/**
* Retrieve by Cart Id
*/
route.get(
"/cart/:cart_id",
middlewares.wrap(require("./get-order-by-cart").default)
@@ -32,6 +42,9 @@ export const defaultRelations = [
export const defaultFields = [
"id",
"status",
"fulfillment_status",
"payment_status",
"display_id",
"cart_id",
"customer_id",
@@ -43,6 +56,7 @@ export const defaultFields = [
"shipping_total",
"discount_total",
"tax_total",
"items.refundable",
"refunded_total",
"gift_card_total",
"subtotal",
@@ -65,12 +79,16 @@ export const allowedRelations = [
export const allowedFields = [
"id",
"status",
"fulfillment_status",
"payment_status",
"display_id",
"cart_id",
"customer_id",
"email",
"region_id",
"currency_code",
"items.refundable",
"tax_rate",
"created_at",
"shipping_total",
@@ -1,6 +1,26 @@
import { Validator, MedusaError } from "medusa-core-utils"
import { defaultRelations, defaultFields } from "./index"
/**
* @oas [get] /orders
* operationId: "GetOrders"
* summary: "Look Up an Order"
* description: "Looks for an Order with a given `display_id`, `email` pair. The `display_id`, `email` pair must match in order for the Order to be returned."
* parameters:
* - (query) display_id=* {number} The display id given to the Order.
* - (query) email=* {string} The email of the Order with the given display_id.
* tags:
* - Order
* responses:
* 200:
* description: OK
* content:
* application/json:
* schema:
* properties:
* order:
* $ref: "#/components/schemas/order"
*/
export default async (req, res) => {
const schema = Validator.object().keys({
display_id: Validator.number().required(),
@@ -1,6 +1,48 @@
import { MedusaError, Validator } from "medusa-core-utils"
import { defaultRelations, defaultFields } from "./"
/**
* @oas [post] /returns
* operationId: "PostReturns"
* summary: "Create Return"
* description: "Creates a Return for an Order."
* requestBody:
* content:
* application/json:
* schema:
* properties:
* order_id:
* type: string
* description: The id of the Order to create the Return from.
* items:
* description: "The items to include in the Return."
* type: array
* items:
* properties:
* item_id:
* description: The id of the Line Item from the Order.
* type: string
* quantity:
* description: The quantity to return.
* type: integer
* return_shipping:
* description: If the Return is to be handled by the store operator the Customer can choose a Return Shipping Method. Alternatvely the Customer can handle the Return themselves.
* type: object
* properties:
* option_id:
* type: string
* description: The id of the Shipping Option to create the Shipping Method from.
* tags:
* - Return
* responses:
* 200:
* description: OK
* content:
* application/json:
* schema:
* properties:
* return:
* $ref: "#/components/schemas/return"
*/
export default async (req, res) => {
const schema = Validator.object().keys({
order_id: Validator.string().required(),