chore(oas): replace response with $ref class JSDoc (Store A-PAY)
chore(oas): replace response with $ref class JSDoc (Store A-PAY)
This commit is contained in:
@@ -43,10 +43,7 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreAuthRes"
|
||||||
* properties:
|
|
||||||
* customer:
|
|
||||||
* $ref: "#/components/schemas/Customer"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import CustomerService from "../../../../services/customer"
|
import CustomerService from "../../../../services/customer"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @oas [get] /auth/{email}
|
* @oas [get] /auth/{email}
|
||||||
* operationId: "GetAuthEmail"
|
* operationId: "GetAuthEmail"
|
||||||
@@ -32,11 +33,7 @@ import CustomerService from "../../../../services/customer"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreGetAuthEmailRes"
|
||||||
* properties:
|
|
||||||
* exists:
|
|
||||||
* type: boolean
|
|
||||||
* description: Whether email exists or not.
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -32,10 +32,7 @@ import CustomerService from "../../../../services/customer"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreAuthRes"
|
||||||
* properties:
|
|
||||||
* customer:
|
|
||||||
* $ref: "#/components/schemas/Customer"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
@@ -19,10 +19,25 @@ export default (app) => {
|
|||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema StoreAuthRes
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* customer:
|
||||||
|
* $ref: "#/components/schemas/Customer"
|
||||||
|
*/
|
||||||
export type StoreAuthRes = {
|
export type StoreAuthRes = {
|
||||||
customer: Customer
|
customer: Customer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema StoreGetAuthEmailRes
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* exists:
|
||||||
|
* type: boolean
|
||||||
|
* description: Whether email exists or not.
|
||||||
|
*/
|
||||||
export type StoreGetAuthEmailRes = {
|
export type StoreGetAuthEmailRes = {
|
||||||
exists: boolean
|
exists: boolean
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,10 +42,7 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCartsRes"
|
||||||
* properties:
|
|
||||||
* cart:
|
|
||||||
* $ref: "#/components/schemas/Cart"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -24,10 +24,7 @@ import { IdempotencyKey } from "../../../../models/idempotency-key"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCartsRes"
|
||||||
* properties:
|
|
||||||
* cart:
|
|
||||||
* $ref: "#/components/schemas/Cart"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -40,31 +40,7 @@ import { IdempotencyKeyService } from "../../../../services"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCompleteCartRes"
|
||||||
* properties:
|
|
||||||
* type:
|
|
||||||
* type: string
|
|
||||||
* description: The type of the data property.
|
|
||||||
* enum: [order, cart, swap]
|
|
||||||
* data:
|
|
||||||
* type: object
|
|
||||||
* description: The data of the result object. Its type depends on the type field.
|
|
||||||
* oneOf:
|
|
||||||
* - type: object
|
|
||||||
* description: Cart was successfully authorized and order was placed successfully.
|
|
||||||
* properties:
|
|
||||||
* order:
|
|
||||||
* $ref: "#/components/schemas/Order"
|
|
||||||
* - type: object
|
|
||||||
* description: Cart was successfully authorized but requires further actions.
|
|
||||||
* properties:
|
|
||||||
* cart:
|
|
||||||
* $ref: "#/components/schemas/Cart"
|
|
||||||
* - type: object
|
|
||||||
* description: When cart is used for a swap and it has been completed successfully.
|
|
||||||
* properties:
|
|
||||||
* cart:
|
|
||||||
* $ref: "#/components/schemas/Swap"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -59,10 +59,7 @@ import PublishableAPIKeysFeatureFlag from "../../../../loaders/feature-flags/pub
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCartsRes"
|
||||||
* properties:
|
|
||||||
* cart:
|
|
||||||
* $ref: "#/components/schemas/Cart"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -53,10 +53,7 @@ import {
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCartsRes"
|
||||||
* properties:
|
|
||||||
* cart:
|
|
||||||
* $ref: "#/components/schemas/Cart"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -32,10 +32,7 @@ import IdempotencyKeyService from "../../../../services/idempotency-key"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCartsRes"
|
||||||
* properties:
|
|
||||||
* cart:
|
|
||||||
* $ref: "#/components/schemas/Cart"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -32,10 +32,7 @@ import { CartService } from "../../../../services"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCartsRes"
|
||||||
* properties:
|
|
||||||
* cart:
|
|
||||||
* $ref: "#/components/schemas/Cart"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -32,10 +32,7 @@ import { CartService } from "../../../../services"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCartsRes"
|
||||||
* properties:
|
|
||||||
* cart:
|
|
||||||
* $ref: "#/components/schemas/Cart"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -32,10 +32,7 @@ import { EntityManager } from "typeorm"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCartsRes"
|
||||||
* properties:
|
|
||||||
* cart:
|
|
||||||
* $ref: "#/components/schemas/Cart"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -29,10 +29,7 @@ import { CartService } from "../../../../services"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCartsRes"
|
||||||
* properties:
|
|
||||||
* cart:
|
|
||||||
* $ref: "#/components/schemas/Cart"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -156,10 +156,42 @@ export const defaultStoreCartRelations = [
|
|||||||
"discounts.rule",
|
"discounts.rule",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema StoreCartsRes
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* cart:
|
||||||
|
* $ref: "#/components/schemas/Cart"
|
||||||
|
*/
|
||||||
export type StoreCartsRes = {
|
export type StoreCartsRes = {
|
||||||
cart: Omit<Cart, "refundable_amount" | "refunded_total">
|
cart: Omit<Cart, "refundable_amount" | "refunded_total">
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema StoreCompleteCartRes
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* type:
|
||||||
|
* type: string
|
||||||
|
* description: The type of the data property.
|
||||||
|
* enum: [order, cart, swap]
|
||||||
|
* data:
|
||||||
|
* type: object
|
||||||
|
* description: The data of the result object. Its type depends on the type field.
|
||||||
|
* oneOf:
|
||||||
|
* - type: object
|
||||||
|
* allOf:
|
||||||
|
* - description: Cart was successfully authorized and order was placed successfully.
|
||||||
|
* - $ref: "#/components/schemas/Order"
|
||||||
|
* - type: object
|
||||||
|
* allOf:
|
||||||
|
* - description: Cart was successfully authorized but requires further actions.
|
||||||
|
* - $ref: "#/components/schemas/Cart"
|
||||||
|
* - type: object
|
||||||
|
* allOf:
|
||||||
|
* - description: When cart is used for a swap and it has been completed successfully.
|
||||||
|
* - $ref: "#/components/schemas/Swap"
|
||||||
|
*/
|
||||||
export type StoreCompleteCartRes =
|
export type StoreCompleteCartRes =
|
||||||
| {
|
| {
|
||||||
type: "cart"
|
type: "cart"
|
||||||
|
|||||||
@@ -31,10 +31,7 @@ import { EntityManager } from "typeorm"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCartsRes"
|
||||||
* properties:
|
|
||||||
* cart:
|
|
||||||
* $ref: "#/components/schemas/Cart"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -41,10 +41,7 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCartsRes"
|
||||||
* properties:
|
|
||||||
* cart:
|
|
||||||
* $ref: "#/components/schemas/Cart"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -55,10 +55,7 @@ import { IsType } from "../../../../utils/validators/is-type"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCartsRes"
|
||||||
* properties:
|
|
||||||
* cart:
|
|
||||||
* $ref: "#/components/schemas/Cart"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -42,10 +42,7 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCartsRes"
|
||||||
* properties:
|
|
||||||
* cart:
|
|
||||||
* $ref: "#/components/schemas/Cart"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -43,10 +43,7 @@ import { EntityManager } from "typeorm"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCartsRes"
|
||||||
* properties:
|
|
||||||
* cart:
|
|
||||||
* $ref: "#/components/schemas/Cart"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -29,10 +29,7 @@ import ProductCollectionService from "../../../../services/product-collection"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCollectionsRes"
|
||||||
* properties:
|
|
||||||
* collection:
|
|
||||||
* $ref: "#/components/schemas/ProductCollection"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -34,10 +34,35 @@ export const allowedFields = [
|
|||||||
...defaultStoreCollectionRelations,
|
...defaultStoreCollectionRelations,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema StoreCollectionsListRes
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* collections:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* $ref: "#/components/schemas/ProductCollection"
|
||||||
|
* count:
|
||||||
|
* type: integer
|
||||||
|
* description: The total number of items available
|
||||||
|
* offset:
|
||||||
|
* type: integer
|
||||||
|
* description: The number of items skipped before these items
|
||||||
|
* limit:
|
||||||
|
* type: integer
|
||||||
|
* description: The number of items per page
|
||||||
|
*/
|
||||||
export type StoreCollectionsListRes = PaginatedResponse & {
|
export type StoreCollectionsListRes = PaginatedResponse & {
|
||||||
collections: ProductCollection[]
|
collections: ProductCollection[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema StoreCollectionsRes
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* collection:
|
||||||
|
* $ref: "#/components/schemas/ProductCollection"
|
||||||
|
*/
|
||||||
export type StoreCollectionsRes = {
|
export type StoreCollectionsRes = {
|
||||||
collection: ProductCollection
|
collection: ProductCollection
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,21 +78,7 @@ import { Type } from "class-transformer"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCollectionsListRes"
|
||||||
* properties:
|
|
||||||
* collections:
|
|
||||||
* type: array
|
|
||||||
* items:
|
|
||||||
* $ref: "#/components/schemas/ProductCollection"
|
|
||||||
* count:
|
|
||||||
* type: integer
|
|
||||||
* description: The total number of items available
|
|
||||||
* offset:
|
|
||||||
* type: integer
|
|
||||||
* description: The number of items skipped before these items
|
|
||||||
* limit:
|
|
||||||
* type: integer
|
|
||||||
* description: The number of items per page
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -68,10 +68,7 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCustomersRes"
|
||||||
* properties:
|
|
||||||
* customer:
|
|
||||||
* $ref: "#/components/schemas/Customer"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
@@ -51,10 +51,7 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCustomersRes"
|
||||||
* properties:
|
|
||||||
* customer:
|
|
||||||
* $ref: "#/components/schemas/Customer"
|
|
||||||
* 422:
|
* 422:
|
||||||
* description: A customer with the same email exists
|
* description: A customer with the same email exists
|
||||||
* content:
|
* content:
|
||||||
|
|||||||
@@ -37,10 +37,7 @@ import CustomerService from "../../../../services/customer"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCustomersRes"
|
||||||
* properties:
|
|
||||||
* customer:
|
|
||||||
* $ref: "#/components/schemas/Customer"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
@@ -33,10 +33,7 @@ import CustomerService from "../../../../services/customer"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCustomersRes"
|
||||||
* properties:
|
|
||||||
* customer:
|
|
||||||
* $ref: "#/components/schemas/Customer"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Customer } from "../../../.."
|
import { Customer } from "../../../.."
|
||||||
import CustomerService from "../../../../services/customer"
|
import CustomerService from "../../../../services/customer"
|
||||||
import PaymentProviderService from "../../../../services/payment-provider"
|
import PaymentProviderService from "../../../../services/payment-provider"
|
||||||
import StoreService from "../../../../services/store"
|
|
||||||
import { PaymentProvider } from "../../../../models"
|
import { PaymentProvider } from "../../../../models"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,18 +35,7 @@ import { PaymentProvider } from "../../../../models"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCustomersListPaymentMethodsRes"
|
||||||
* properties:
|
|
||||||
* payment_methods:
|
|
||||||
* type: array
|
|
||||||
* items:
|
|
||||||
* properties:
|
|
||||||
* provider_id:
|
|
||||||
* type: string
|
|
||||||
* description: The id of the Payment Provider where the payment method is saved.
|
|
||||||
* data:
|
|
||||||
* type: object
|
|
||||||
* description: The data needed for the Payment Provider to use the saved payment method.
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import { Router } from "express"
|
import { Router } from "express"
|
||||||
import { Customer, Order, StorePostCustomersReq } from "../../../.."
|
import { Customer, Order } from "../../../.."
|
||||||
import { PaginatedResponse } from "../../../../types/common"
|
import { PaginatedResponse } from "../../../../types/common"
|
||||||
import middlewares, {
|
import middlewares, { transformQuery } from "../../../middlewares"
|
||||||
transformBody,
|
|
||||||
transformQuery,
|
|
||||||
} from "../../../middlewares"
|
|
||||||
import {
|
import {
|
||||||
defaultStoreOrdersFields,
|
defaultStoreOrdersFields,
|
||||||
defaultStoreOrdersRelations,
|
defaultStoreOrdersRelations,
|
||||||
@@ -114,14 +111,55 @@ export const allowedStoreCustomersFields = [
|
|||||||
"metadata",
|
"metadata",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema StoreCustomersRes
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* customer:
|
||||||
|
* $ref: "#/components/schemas/Customer"
|
||||||
|
*/
|
||||||
export type StoreCustomersRes = {
|
export type StoreCustomersRes = {
|
||||||
customer: Omit<Customer, "password_hash">
|
customer: Omit<Customer, "password_hash">
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema StoreCustomersListOrdersRes
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* orders:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* $ref: "#/components/schemas/Order"
|
||||||
|
* count:
|
||||||
|
* type: integer
|
||||||
|
* description: The total number of items available
|
||||||
|
* offset:
|
||||||
|
* type: integer
|
||||||
|
* description: The number of items skipped before these items
|
||||||
|
* limit:
|
||||||
|
* type: integer
|
||||||
|
* description: The number of items per page
|
||||||
|
*/
|
||||||
export type StoreCustomersListOrdersRes = PaginatedResponse & {
|
export type StoreCustomersListOrdersRes = PaginatedResponse & {
|
||||||
orders: Order[]
|
orders: Order[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema StoreCustomersListPaymentMethodsRes
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* payment_methods:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* provider_id:
|
||||||
|
* type: string
|
||||||
|
* description: The id of the Payment Provider where the payment method is saved.
|
||||||
|
* data:
|
||||||
|
* type: object
|
||||||
|
* description: The data needed for the Payment Provider to use the saved payment method.
|
||||||
|
*/
|
||||||
export type StoreCustomersListPaymentMethodsRes = {
|
export type StoreCustomersListPaymentMethodsRes = {
|
||||||
payment_methods: {
|
payment_methods: {
|
||||||
provider_id: string
|
provider_id: string
|
||||||
|
|||||||
@@ -163,21 +163,7 @@ import { DateComparisonOperator } from "../../../../types/common"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCustomersListOrdersRes"
|
||||||
* properties:
|
|
||||||
* orders:
|
|
||||||
* type: array
|
|
||||||
* items:
|
|
||||||
* $ref: "#/components/schemas/Order"
|
|
||||||
* count:
|
|
||||||
* type: integer
|
|
||||||
* description: The total number of items available
|
|
||||||
* offset:
|
|
||||||
* type: integer
|
|
||||||
* description: The number of items skipped before these items
|
|
||||||
* limit:
|
|
||||||
* type: integer
|
|
||||||
* description: The number of items per page
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
@@ -47,10 +47,7 @@ import { EntityManager } from "typeorm"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCustomersRes"
|
||||||
* properties:
|
|
||||||
* customer:
|
|
||||||
* $ref: "#/components/schemas/Customer"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
@@ -50,10 +50,7 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCustomersRes"
|
||||||
* properties:
|
|
||||||
* customer:
|
|
||||||
* $ref: "#/components/schemas/Customer"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
@@ -50,10 +50,7 @@ import { IsType } from "../../../../utils/validators/is-type"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreCustomersRes"
|
||||||
* properties:
|
|
||||||
* customer:
|
|
||||||
* $ref: "#/components/schemas/Customer"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
@@ -31,10 +31,7 @@ import GiftCardService from "../../../../services/gift-card"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreGiftCardsRes"
|
||||||
* properties:
|
|
||||||
* gift_card:
|
|
||||||
* $ref: "#/components/schemas/GiftCard"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -25,6 +25,13 @@ export const allowedStoreGiftCardRelations = ["region"]
|
|||||||
|
|
||||||
export const allowedStoreGiftCardFields = ["id", "code", "value", "balance"]
|
export const allowedStoreGiftCardFields = ["id", "code", "value", "balance"]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema StoreGiftCardsRes
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* gift_card:
|
||||||
|
* $ref: "#/components/schemas/GiftCard"
|
||||||
|
*/
|
||||||
export type StoreGiftCardsRes = {
|
export type StoreGiftCardsRes = {
|
||||||
gift_card: GiftCard
|
gift_card: GiftCard
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { OrderEditStatus, PaymentCollectionStatus } from "../../../../models"
|
|||||||
import { OrderEditService, PaymentProviderService } from "../../../../services"
|
import { OrderEditService, PaymentProviderService } from "../../../../services"
|
||||||
import {
|
import {
|
||||||
defaultStoreOrderEditFields,
|
defaultStoreOrderEditFields,
|
||||||
defaultStoreOrderEditRelations
|
defaultStoreOrderEditRelations,
|
||||||
} from "../../../../types/order-edit"
|
} from "../../../../types/order-edit"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,10 +37,7 @@ import {
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreOrderEditsRes"
|
||||||
* properties:
|
|
||||||
* order_edit:
|
|
||||||
* $ref: "#/components/schemas/OrderEdit"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { EntityManager } from "typeorm"
|
|||||||
import { OrderEditService } from "../../../../services"
|
import { OrderEditService } from "../../../../services"
|
||||||
import {
|
import {
|
||||||
defaultStoreOrderEditFields,
|
defaultStoreOrderEditFields,
|
||||||
defaultStoreOrderEditRelations
|
defaultStoreOrderEditRelations,
|
||||||
} from "../../../../types/order-edit"
|
} from "../../../../types/order-edit"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,10 +41,7 @@ import {
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreOrderEditsRes"
|
||||||
* properties:
|
|
||||||
* order_edit:
|
|
||||||
* $ref: "#/components/schemas/OrderEdit"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
@@ -30,10 +30,7 @@ import { OrderEditService } from "../../../../services"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreOrderEditsRes"
|
||||||
* properties:
|
|
||||||
* order_edit:
|
|
||||||
* $ref: "#/components/schemas/OrderEdit"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
@@ -41,6 +41,13 @@ export default (app) => {
|
|||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema StoreOrderEditsRes
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* order_edit:
|
||||||
|
* $ref: "#/components/schemas/OrderEdit"
|
||||||
|
*/
|
||||||
export type StoreOrderEditsRes = {
|
export type StoreOrderEditsRes = {
|
||||||
order_edit: Omit<
|
order_edit: Omit<
|
||||||
OrderEdit,
|
OrderEdit,
|
||||||
|
|||||||
@@ -31,10 +31,7 @@ import { OrderService } from "../../../../services"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreOrdersRes"
|
||||||
* properties:
|
|
||||||
* order:
|
|
||||||
* $ref: "#/components/schemas/Order"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -31,10 +31,7 @@ import { OrderService } from "../../../../services"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreOrdersRes"
|
||||||
* properties:
|
|
||||||
* order:
|
|
||||||
* $ref: "#/components/schemas/Order"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -83,6 +83,13 @@ export const defaultStoreOrdersFields = [
|
|||||||
"total",
|
"total",
|
||||||
] as (keyof Order)[]
|
] as (keyof Order)[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema StoreOrdersRes
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* order:
|
||||||
|
* $ref: "#/components/schemas/Order"
|
||||||
|
*/
|
||||||
export type StoreOrdersRes = {
|
export type StoreOrdersRes = {
|
||||||
order: Order
|
order: Order
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,10 +63,7 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StoreOrdersRes"
|
||||||
* properties:
|
|
||||||
* order:
|
|
||||||
* $ref: "#/components/schemas/Order"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
+1
-3
@@ -40,9 +40,7 @@ import { PaymentCollectionService } from "../../../../services"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* properties:
|
* $ref: "#/components/schemas/StorePaymentCollectionsRes"
|
||||||
* payment_collection:
|
|
||||||
* $ref: "#/components/schemas/PaymentCollection"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
+1
-3
@@ -37,9 +37,7 @@ import { PaymentCollectionService } from "../../../../services"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* properties:
|
* $ref: "#/components/schemas/StorePaymentCollectionsSessionRes"
|
||||||
* payment_session:
|
|
||||||
* $ref: "#/components/schemas/PaymentSession"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
@@ -37,10 +37,7 @@ import { FindParams } from "../../../../types/common"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StorePaymentCollectionsRes"
|
||||||
* properties:
|
|
||||||
* payment_collection:
|
|
||||||
* $ref: "#/components/schemas/PaymentCollection"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
@@ -71,10 +71,24 @@ export const defaultPaymentCollectionFields = [
|
|||||||
|
|
||||||
export const defaulPaymentCollectionRelations = ["region", "payment_sessions"]
|
export const defaulPaymentCollectionRelations = ["region", "payment_sessions"]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema StorePaymentCollectionsRes
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* payment_collection:
|
||||||
|
* $ref: "#/components/schemas/PaymentCollection"
|
||||||
|
*/
|
||||||
export type StorePaymentCollectionsRes = {
|
export type StorePaymentCollectionsRes = {
|
||||||
payment_collection: PaymentCollection
|
payment_collection: PaymentCollection
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema StorePaymentCollectionsSessionRes
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* payment_session:
|
||||||
|
* $ref: "#/components/schemas/PaymentSession"
|
||||||
|
*/
|
||||||
export type StorePaymentCollectionsSessionRes = {
|
export type StorePaymentCollectionsSessionRes = {
|
||||||
payment_session: PaymentSession
|
payment_session: PaymentSession
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -68,9 +68,7 @@ import { PaymentCollectionService } from "../../../../services"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* properties:
|
* $ref: "#/components/schemas/StorePaymentCollectionsRes"
|
||||||
* payment_collection:
|
|
||||||
* $ref: "#/components/schemas/PaymentCollection"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
@@ -47,9 +47,7 @@ import { PaymentCollectionService } from "../../../../services"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* properties:
|
* $ref: "#/components/schemas/StorePaymentCollectionsRes"
|
||||||
* payment_collection:
|
|
||||||
* $ref: "#/components/schemas/PaymentCollection"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "401":
|
* "401":
|
||||||
|
|||||||
@@ -32,10 +32,7 @@ import { PaymentCollectionService } from "../../../../services"
|
|||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* $ref: "#/components/schemas/StorePaymentCollectionsSessionRes"
|
||||||
* properties:
|
|
||||||
* payment_session:
|
|
||||||
* $ref: "#/components/schemas/PaymentSession"
|
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
Reference in New Issue
Block a user