docs: fixed some types in oas comments (#2413)
This commit is contained in:
@@ -108,7 +108,7 @@ import { Type } from "class-transformer"
|
|||||||
* // must be previously logged in or use api token
|
* // must be previously logged in or use api token
|
||||||
* medusa.admin.customerGroups.list()
|
* medusa.admin.customerGroups.list()
|
||||||
* .then(({ customer_groups, limit, offset, count }) => {
|
* .then(({ customer_groups, limit, offset, count }) => {
|
||||||
* console.log(customer_groups.id);
|
* console.log(customer_groups.length);
|
||||||
* });
|
* });
|
||||||
* - lang: Shell
|
* - lang: Shell
|
||||||
* label: cURL
|
* label: cURL
|
||||||
|
|||||||
@@ -49,10 +49,10 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* format: email
|
* format: email
|
||||||
* billing_address:
|
* billing_address:
|
||||||
* description: "The Address to be used for billing purposes."
|
* description: "The Address to be used for billing purposes."
|
||||||
* $ref: "#/components/schemas/address"
|
* $ref: "#/components/schemas/address_fields"
|
||||||
* shipping_address:
|
* shipping_address:
|
||||||
* description: "The Address to be used for shipping."
|
* description: "The Address to be used for shipping."
|
||||||
* $ref: "#/components/schemas/address"
|
* $ref: "#/components/schemas/address_fields"
|
||||||
* items:
|
* items:
|
||||||
* description: The Line Items that have been received.
|
* description: The Line Items that have been received.
|
||||||
* type: array
|
* type: array
|
||||||
|
|||||||
@@ -47,10 +47,10 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* format: email
|
* format: email
|
||||||
* billing_address:
|
* billing_address:
|
||||||
* description: "The Address to be used for billing purposes."
|
* description: "The Address to be used for billing purposes."
|
||||||
* $ref: "#/components/schemas/address"
|
* $ref: "#/components/schemas/address_fields"
|
||||||
* shipping_address:
|
* shipping_address:
|
||||||
* description: "The Address to be used for shipping."
|
* description: "The Address to be used for shipping."
|
||||||
* $ref: "#/components/schemas/address"
|
* $ref: "#/components/schemas/address_fields"
|
||||||
* discounts:
|
* discounts:
|
||||||
* description: "An array of Discount codes to add to the Draft Order."
|
* description: "An array of Discount codes to add to the Draft Order."
|
||||||
* type: array
|
* type: array
|
||||||
|
|||||||
@@ -35,11 +35,11 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* billing_address:
|
* billing_address:
|
||||||
* description: Billing address
|
* description: Billing address
|
||||||
* anyOf:
|
* anyOf:
|
||||||
* - $ref: "#/components/schemas/address"
|
* - $ref: "#/components/schemas/address_fields"
|
||||||
* shipping_address:
|
* shipping_address:
|
||||||
* description: Shipping address
|
* description: Shipping address
|
||||||
* anyOf:
|
* anyOf:
|
||||||
* - $ref: "#/components/schemas/address"
|
* - $ref: "#/components/schemas/address_fields"
|
||||||
* items:
|
* items:
|
||||||
* description: The Line Items for the order
|
* description: The Line Items for the order
|
||||||
* type: array
|
* type: array
|
||||||
|
|||||||
@@ -21,8 +21,16 @@ import { EntityManager } from "typeorm"
|
|||||||
* properties:
|
* properties:
|
||||||
* address:
|
* address:
|
||||||
* description: "The Address to add to the Customer."
|
* description: "The Address to add to the Customer."
|
||||||
* anyOf:
|
* allOf:
|
||||||
* - $ref: "#/components/schemas/address"
|
* - $ref: "#/components/schemas/address_fields"
|
||||||
|
* - type: object
|
||||||
|
* required:
|
||||||
|
* - first_name
|
||||||
|
* - last_name
|
||||||
|
* - address_1
|
||||||
|
* - city
|
||||||
|
* - country_code
|
||||||
|
* - postal_code
|
||||||
* x-codeSamples:
|
* x-codeSamples:
|
||||||
* - lang: JavaScript
|
* - lang: JavaScript
|
||||||
* label: JS Client
|
* label: JS Client
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { EntityManager } from "typeorm"
|
|||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* anyOf:
|
* anyOf:
|
||||||
* - $ref: "#/components/schemas/address"
|
* - $ref: "#/components/schemas/address_fields"
|
||||||
* x-codeSamples:
|
* x-codeSamples:
|
||||||
* - lang: JavaScript
|
* - lang: JavaScript
|
||||||
* label: JS Client
|
* label: JS Client
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import { EntityManager } from "typeorm"
|
|||||||
* billing_address:
|
* billing_address:
|
||||||
* description: "The Address to be used for billing purposes."
|
* description: "The Address to be used for billing purposes."
|
||||||
* anyOf:
|
* anyOf:
|
||||||
* - $ref: "#/components/schemas/address"
|
* - $ref: "#/components/schemas/address_fields"
|
||||||
* description: The full billing address object
|
* description: The full billing address object
|
||||||
* - type: string
|
* - type: string
|
||||||
* description: The ID of an existing billing address
|
* description: The ID of an existing billing address
|
||||||
|
|||||||
@@ -51,7 +51,16 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* schema:
|
* schema:
|
||||||
* properties:
|
* properties:
|
||||||
* product:
|
* product:
|
||||||
* $ref: "#/components/schemas/product"
|
* allOf:
|
||||||
|
* - $ref: "#/components/schemas/product"
|
||||||
|
* - type: object
|
||||||
|
* properties:
|
||||||
|
* variants:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* allOf:
|
||||||
|
* - $ref: "#/components/schemas/product_variant"
|
||||||
|
* - $ref: "#/components/schemas/product_variant_prices_fields"
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -141,7 +141,16 @@ import { IsType } from "../../../../utils/validators/is-type"
|
|||||||
* products:
|
* products:
|
||||||
* type: array
|
* type: array
|
||||||
* items:
|
* items:
|
||||||
* $ref: "#/components/schemas/product"
|
* allOf:
|
||||||
|
* - $ref: "#/components/schemas/product"
|
||||||
|
* - type: object
|
||||||
|
* properties:
|
||||||
|
* variants:
|
||||||
|
* type: array
|
||||||
|
* items:
|
||||||
|
* allOf:
|
||||||
|
* - $ref: "#/components/schemas/product_variant"
|
||||||
|
* - $ref: "#/components/schemas/product_variant_prices_fields"
|
||||||
* count:
|
* count:
|
||||||
* type: integer
|
* type: integer
|
||||||
* description: The total number of items available
|
* description: The total number of items available
|
||||||
|
|||||||
@@ -43,7 +43,9 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* schema:
|
* schema:
|
||||||
* properties:
|
* properties:
|
||||||
* variant:
|
* variant:
|
||||||
* $ref: "#/components/schemas/product_variant"
|
* allOf:
|
||||||
|
* - $ref: "#/components/schemas/product_variant"
|
||||||
|
* - $ref: "#/components/schemas/product_variant_prices_fields"
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -77,7 +77,9 @@ import { validator } from "../../../../utils/validator"
|
|||||||
* variants:
|
* variants:
|
||||||
* type: array
|
* type: array
|
||||||
* items:
|
* items:
|
||||||
* $ref: "#/components/schemas/product_variant"
|
* allOf:
|
||||||
|
* - $ref: "#/components/schemas/product_variant"
|
||||||
|
* - $ref: "#/components/schemas/product_variant_prices_fields"
|
||||||
* "400":
|
* "400":
|
||||||
* $ref: "#/components/responses/400_error"
|
* $ref: "#/components/responses/400_error"
|
||||||
* "404":
|
* "404":
|
||||||
|
|||||||
@@ -1,3 +1,126 @@
|
|||||||
|
import {
|
||||||
|
BeforeInsert,
|
||||||
|
Column,
|
||||||
|
Entity,
|
||||||
|
Index,
|
||||||
|
JoinColumn,
|
||||||
|
ManyToOne,
|
||||||
|
} from "typeorm"
|
||||||
|
|
||||||
|
import { Country } from "./country"
|
||||||
|
import { Customer } from "./customer"
|
||||||
|
import { DbAwareColumn } from "../utils/db-aware-column"
|
||||||
|
import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity"
|
||||||
|
import { generateEntityId } from "../utils/generate-entity-id"
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class Address extends SoftDeletableEntity {
|
||||||
|
@Index()
|
||||||
|
@Column({ type: "varchar", nullable: true })
|
||||||
|
customer_id: string | null
|
||||||
|
|
||||||
|
@ManyToOne(() => Customer)
|
||||||
|
@JoinColumn({ name: "customer_id" })
|
||||||
|
customer: Customer | null
|
||||||
|
|
||||||
|
@Column({ type: "varchar", nullable: true })
|
||||||
|
company: string | null
|
||||||
|
|
||||||
|
@Column({ type: "varchar", nullable: true })
|
||||||
|
first_name: string | null
|
||||||
|
|
||||||
|
@Column({ type: "varchar", nullable: true })
|
||||||
|
last_name: string | null
|
||||||
|
|
||||||
|
@Column({ type: "varchar", nullable: true })
|
||||||
|
address_1: string | null
|
||||||
|
|
||||||
|
@Column({ type: "varchar", nullable: true })
|
||||||
|
address_2: string | null
|
||||||
|
|
||||||
|
@Column({ type: "varchar", nullable: true })
|
||||||
|
city: string | null
|
||||||
|
|
||||||
|
@Column({ type: "varchar", nullable: true })
|
||||||
|
country_code: string | null
|
||||||
|
|
||||||
|
@ManyToOne(() => Country)
|
||||||
|
@JoinColumn({ name: "country_code", referencedColumnName: "iso_2" })
|
||||||
|
country: Country | null
|
||||||
|
|
||||||
|
@Column({ type: "varchar", nullable: true })
|
||||||
|
province: string | null
|
||||||
|
|
||||||
|
@Column({ type: "varchar", nullable: true })
|
||||||
|
postal_code: string | null
|
||||||
|
|
||||||
|
@Column({ type: "varchar", nullable: true })
|
||||||
|
phone: string | null
|
||||||
|
|
||||||
|
@DbAwareColumn({ type: "jsonb", nullable: true })
|
||||||
|
metadata: Record<string, unknown>
|
||||||
|
|
||||||
|
@BeforeInsert()
|
||||||
|
private beforeInsert(): void {
|
||||||
|
this.id = generateEntityId(this.id, "addr")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema address_fields
|
||||||
|
* title: "Address Fields"
|
||||||
|
* description: "Address fields used when creating/updating an address."
|
||||||
|
* x-resourceId: address
|
||||||
|
* properties:
|
||||||
|
* company:
|
||||||
|
* type: string
|
||||||
|
* description: Company name
|
||||||
|
* example: Acme
|
||||||
|
* first_name:
|
||||||
|
* type: string
|
||||||
|
* description: First name
|
||||||
|
* example: Arno
|
||||||
|
* last_name:
|
||||||
|
* type: string
|
||||||
|
* description: Last name
|
||||||
|
* example: Willms
|
||||||
|
* address_1:
|
||||||
|
* type: string
|
||||||
|
* description: Address line 1
|
||||||
|
* example: 14433 Kemmer Court
|
||||||
|
* address_2:
|
||||||
|
* type: string
|
||||||
|
* description: Address line 2
|
||||||
|
* example: Suite 369
|
||||||
|
* city:
|
||||||
|
* type: string
|
||||||
|
* description: City
|
||||||
|
* example: South Geoffreyview
|
||||||
|
* country_code:
|
||||||
|
* type: string
|
||||||
|
* description: The 2 character ISO code of the country in lower case
|
||||||
|
* externalDocs:
|
||||||
|
* url: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
|
||||||
|
* description: See a list of codes.
|
||||||
|
* example: st
|
||||||
|
* province:
|
||||||
|
* type: string
|
||||||
|
* description: Province
|
||||||
|
* example: Kentucky
|
||||||
|
* postal_code:
|
||||||
|
* type: string
|
||||||
|
* description: Postal Code
|
||||||
|
* example: 72093
|
||||||
|
* phone:
|
||||||
|
* type: string
|
||||||
|
* description: Phone Number
|
||||||
|
* example: 16128234334802
|
||||||
|
* metadata:
|
||||||
|
* type: object
|
||||||
|
* description: An optional key-value map with additional details
|
||||||
|
* example: {car: "white"}
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @schema address
|
* @schema address
|
||||||
* title: "Address"
|
* title: "Address"
|
||||||
@@ -80,72 +203,4 @@
|
|||||||
* type: object
|
* type: object
|
||||||
* description: An optional key-value map with additional details
|
* description: An optional key-value map with additional details
|
||||||
* example: {car: "white"}
|
* example: {car: "white"}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
|
||||||
BeforeInsert,
|
|
||||||
Column,
|
|
||||||
Entity,
|
|
||||||
Index,
|
|
||||||
JoinColumn,
|
|
||||||
ManyToOne,
|
|
||||||
} from "typeorm"
|
|
||||||
|
|
||||||
import { Country } from "./country"
|
|
||||||
import { Customer } from "./customer"
|
|
||||||
import { DbAwareColumn } from "../utils/db-aware-column"
|
|
||||||
import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity"
|
|
||||||
import { generateEntityId } from "../utils/generate-entity-id"
|
|
||||||
|
|
||||||
@Entity()
|
|
||||||
export class Address extends SoftDeletableEntity {
|
|
||||||
@Index()
|
|
||||||
@Column({ type: "varchar", nullable: true })
|
|
||||||
customer_id: string | null
|
|
||||||
|
|
||||||
@ManyToOne(() => Customer)
|
|
||||||
@JoinColumn({ name: "customer_id" })
|
|
||||||
customer: Customer | null
|
|
||||||
|
|
||||||
@Column({ type: "varchar", nullable: true })
|
|
||||||
company: string | null
|
|
||||||
|
|
||||||
@Column({ type: "varchar", nullable: true })
|
|
||||||
first_name: string | null
|
|
||||||
|
|
||||||
@Column({ type: "varchar", nullable: true })
|
|
||||||
last_name: string | null
|
|
||||||
|
|
||||||
@Column({ type: "varchar", nullable: true })
|
|
||||||
address_1: string | null
|
|
||||||
|
|
||||||
@Column({ type: "varchar", nullable: true })
|
|
||||||
address_2: string | null
|
|
||||||
|
|
||||||
@Column({ type: "varchar", nullable: true })
|
|
||||||
city: string | null
|
|
||||||
|
|
||||||
@Column({ type: "varchar", nullable: true })
|
|
||||||
country_code: string | null
|
|
||||||
|
|
||||||
@ManyToOne(() => Country)
|
|
||||||
@JoinColumn({ name: "country_code", referencedColumnName: "iso_2" })
|
|
||||||
country: Country | null
|
|
||||||
|
|
||||||
@Column({ type: "varchar", nullable: true })
|
|
||||||
province: string | null
|
|
||||||
|
|
||||||
@Column({ type: "varchar", nullable: true })
|
|
||||||
postal_code: string | null
|
|
||||||
|
|
||||||
@Column({ type: "varchar", nullable: true })
|
|
||||||
phone: string | null
|
|
||||||
|
|
||||||
@DbAwareColumn({ type: "jsonb", nullable: true })
|
|
||||||
metadata: Record<string, unknown>
|
|
||||||
|
|
||||||
@BeforeInsert()
|
|
||||||
private beforeInsert(): void {
|
|
||||||
this.id = generateEntityId(this.id, "addr")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -216,3 +216,44 @@ export class ProductVariant extends SoftDeletableEntity {
|
|||||||
* description: An optional key-value map with additional details
|
* description: An optional key-value map with additional details
|
||||||
* example: {car: "white"}
|
* example: {car: "white"}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @schema product_variant_prices_fields
|
||||||
|
* title: "Product Variant Prices Fields"
|
||||||
|
* description: "Product Variants Prices Fields that are only available in some requests."
|
||||||
|
* x-resourceId: product_variant_prices_fields
|
||||||
|
* properties:
|
||||||
|
* original_price:
|
||||||
|
* type: number
|
||||||
|
* description: The original price of the variant without any discounted prices applied.
|
||||||
|
* calculated_price:
|
||||||
|
* type: number
|
||||||
|
* description: The calculated price of the variant. Can be a discounted price.
|
||||||
|
* original_price_incl_tax:
|
||||||
|
* type: number
|
||||||
|
* description: The original price of the variant including taxes.
|
||||||
|
* calculated_price_incl_tax:
|
||||||
|
* type: number
|
||||||
|
* description: The calculated price of the variant including taxes.
|
||||||
|
* original_tax:
|
||||||
|
* type: number
|
||||||
|
* description: The taxes applied on the original price.
|
||||||
|
* calculated_tax:
|
||||||
|
* type: number
|
||||||
|
* description: The taxes applied on the calculated price.
|
||||||
|
* tax_rates:
|
||||||
|
* type: array
|
||||||
|
* description: An array of applied tax rates
|
||||||
|
* items:
|
||||||
|
* type: object
|
||||||
|
* properties:
|
||||||
|
* rate:
|
||||||
|
* type: number
|
||||||
|
* description: The tax rate value
|
||||||
|
* name:
|
||||||
|
* type: string
|
||||||
|
* description: The name of the tax rate
|
||||||
|
* code:
|
||||||
|
* type: string
|
||||||
|
* description: The code of the tax rate
|
||||||
|
*/
|
||||||
Reference in New Issue
Block a user