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
|
||||
* medusa.admin.customerGroups.list()
|
||||
* .then(({ customer_groups, limit, offset, count }) => {
|
||||
* console.log(customer_groups.id);
|
||||
* console.log(customer_groups.length);
|
||||
* });
|
||||
* - lang: Shell
|
||||
* label: cURL
|
||||
|
||||
@@ -49,10 +49,10 @@ import { validator } from "../../../../utils/validator"
|
||||
* format: email
|
||||
* billing_address:
|
||||
* description: "The Address to be used for billing purposes."
|
||||
* $ref: "#/components/schemas/address"
|
||||
* $ref: "#/components/schemas/address_fields"
|
||||
* shipping_address:
|
||||
* description: "The Address to be used for shipping."
|
||||
* $ref: "#/components/schemas/address"
|
||||
* $ref: "#/components/schemas/address_fields"
|
||||
* items:
|
||||
* description: The Line Items that have been received.
|
||||
* type: array
|
||||
|
||||
@@ -47,10 +47,10 @@ import { validator } from "../../../../utils/validator"
|
||||
* format: email
|
||||
* billing_address:
|
||||
* description: "The Address to be used for billing purposes."
|
||||
* $ref: "#/components/schemas/address"
|
||||
* $ref: "#/components/schemas/address_fields"
|
||||
* shipping_address:
|
||||
* description: "The Address to be used for shipping."
|
||||
* $ref: "#/components/schemas/address"
|
||||
* $ref: "#/components/schemas/address_fields"
|
||||
* discounts:
|
||||
* description: "An array of Discount codes to add to the Draft Order."
|
||||
* type: array
|
||||
|
||||
@@ -35,11 +35,11 @@ import { validator } from "../../../../utils/validator"
|
||||
* billing_address:
|
||||
* description: Billing address
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/address"
|
||||
* - $ref: "#/components/schemas/address_fields"
|
||||
* shipping_address:
|
||||
* description: Shipping address
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/address"
|
||||
* - $ref: "#/components/schemas/address_fields"
|
||||
* items:
|
||||
* description: The Line Items for the order
|
||||
* type: array
|
||||
|
||||
@@ -21,8 +21,16 @@ import { EntityManager } from "typeorm"
|
||||
* properties:
|
||||
* address:
|
||||
* description: "The Address to add to the Customer."
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/address"
|
||||
* allOf:
|
||||
* - $ref: "#/components/schemas/address_fields"
|
||||
* - type: object
|
||||
* required:
|
||||
* - first_name
|
||||
* - last_name
|
||||
* - address_1
|
||||
* - city
|
||||
* - country_code
|
||||
* - postal_code
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -18,7 +18,7 @@ import { EntityManager } from "typeorm"
|
||||
* application/json:
|
||||
* schema:
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/address"
|
||||
* - $ref: "#/components/schemas/address_fields"
|
||||
* x-codeSamples:
|
||||
* - lang: JavaScript
|
||||
* label: JS Client
|
||||
|
||||
@@ -27,7 +27,7 @@ import { EntityManager } from "typeorm"
|
||||
* billing_address:
|
||||
* description: "The Address to be used for billing purposes."
|
||||
* anyOf:
|
||||
* - $ref: "#/components/schemas/address"
|
||||
* - $ref: "#/components/schemas/address_fields"
|
||||
* description: The full billing address object
|
||||
* - type: string
|
||||
* description: The ID of an existing billing address
|
||||
|
||||
@@ -51,7 +51,16 @@ import { validator } from "../../../../utils/validator"
|
||||
* schema:
|
||||
* properties:
|
||||
* 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":
|
||||
* $ref: "#/components/responses/400_error"
|
||||
* "404":
|
||||
|
||||
@@ -141,7 +141,16 @@ import { IsType } from "../../../../utils/validators/is-type"
|
||||
* products:
|
||||
* type: array
|
||||
* 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:
|
||||
* type: integer
|
||||
* description: The total number of items available
|
||||
|
||||
@@ -43,7 +43,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* schema:
|
||||
* properties:
|
||||
* variant:
|
||||
* $ref: "#/components/schemas/product_variant"
|
||||
* allOf:
|
||||
* - $ref: "#/components/schemas/product_variant"
|
||||
* - $ref: "#/components/schemas/product_variant_prices_fields"
|
||||
* "400":
|
||||
* $ref: "#/components/responses/400_error"
|
||||
* "404":
|
||||
|
||||
@@ -77,7 +77,9 @@ import { validator } from "../../../../utils/validator"
|
||||
* variants:
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: "#/components/schemas/product_variant"
|
||||
* allOf:
|
||||
* - $ref: "#/components/schemas/product_variant"
|
||||
* - $ref: "#/components/schemas/product_variant_prices_fields"
|
||||
* "400":
|
||||
* $ref: "#/components/responses/400_error"
|
||||
* "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
|
||||
* title: "Address"
|
||||
@@ -80,72 +203,4 @@
|
||||
* type: object
|
||||
* description: An optional key-value map with additional details
|
||||
* 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
|
||||
* 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