feat(medusa): Stock location module (#2907)

* feat: stock location module
This commit is contained in:
Carlos R. L. Rodrigues
2023-01-04 13:11:59 -03:00
committed by GitHub
parent cc10c20f35
commit c07ffb6165
50 changed files with 2040 additions and 198 deletions
+1
View File
@@ -60,6 +60,7 @@ export * from "./region"
export * from "./return"
export * from "./return-item"
export * from "./return-reason"
export * from "./sales-channel-location"
export * from "./sales-channel"
export * from "./sales-channel-location"
export * from "./shipping-method"
+8 -8
View File
@@ -108,8 +108,8 @@ export class LineItem extends BaseEntity {
@Column()
title: string
@Column({ nullable: true })
description: string
@Column({ nullable: true, type: "text" })
description: string | null
@Column({ type: "text", nullable: true })
thumbnail: string | null
@@ -126,14 +126,14 @@ export class LineItem extends BaseEntity {
@Column({ default: true })
allow_discounts: boolean
@Column({ nullable: true })
has_shipping: boolean
@Column({ nullable: true, type: "boolean" })
has_shipping: boolean | null
@Column({ type: "int" })
unit_price: number
@Index()
@Column({ nullable: true })
@Column({ nullable: true, type: "text" })
variant_id: string | null
@ManyToOne(() => ProductVariant, { eager: true })
@@ -144,13 +144,13 @@ export class LineItem extends BaseEntity {
quantity: number
@Column({ nullable: true, type: "int" })
fulfilled_quantity: number
fulfilled_quantity: number | null
@Column({ nullable: true, type: "int" })
returned_quantity: number
returned_quantity: number | null
@Column({ nullable: true, type: "int" })
shipped_quantity: number
shipped_quantity: number | null
@DbAwareColumn({ type: "jsonb", nullable: true })
metadata: Record<string, unknown>
+14 -14
View File
@@ -41,24 +41,24 @@ export class Return extends BaseEntity {
items: ReturnItem[]
@Index()
@Column({ nullable: true })
swap_id: string
@Column({ nullable: true, type: "text" })
swap_id: string | null
@OneToOne(() => Swap, (swap) => swap.return_order)
@JoinColumn({ name: "swap_id" })
swap: Swap
@Index()
@Column({ nullable: true })
claim_order_id: string
@Column({ nullable: true, type: "text" })
claim_order_id: string | null
@OneToOne(() => ClaimOrder, (co) => co.return_order)
@JoinColumn({ name: "claim_order_id" })
claim_order: ClaimOrder
@Index()
@Column({ nullable: true })
order_id: string
@Column({ nullable: true, type: "text" })
order_id: string | null
@ManyToOne(() => Order, (o) => o.returns)
@JoinColumn({ name: "order_id" })
@@ -69,13 +69,13 @@ export class Return extends BaseEntity {
})
shipping_method: ShippingMethod
@Index()
@Column({ nullable: true, type: "text" })
location_id: string | null
@DbAwareColumn({ type: "jsonb", nullable: true })
shipping_data: Record<string, unknown>
@Index()
@Column({ nullable: true })
location_id: string
@Column({ type: "int" })
refund_amount: number
@@ -83,13 +83,13 @@ export class Return extends BaseEntity {
received_at: Date
@Column({ type: "boolean", nullable: true })
no_notification: boolean
no_notification: boolean | null
@DbAwareColumn({ type: "jsonb", nullable: true })
metadata: Record<string, unknown>
metadata: Record<string, unknown> | null
@Column({ nullable: true })
idempotency_key: string
@Column({ nullable: true, type: "text" })
idempotency_key: string | null
@BeforeInsert()
private beforeInsert(): void {
@@ -4,6 +4,7 @@ import { FeatureFlagEntity } from "../utils/feature-flag-decorators"
import { BaseEntity } from "../interfaces"
import { generateEntityId } from "../utils"
@FeatureFlagEntity("sales_channels")
export class SalesChannelLocation extends BaseEntity {
@Index()
@Column({ type: "text" })
+9 -9
View File
@@ -45,23 +45,23 @@ export class Store extends BaseEntity {
})
currencies: Currency[]
@Column({ nullable: true })
swap_link_template: string
@Column({ nullable: true, type: "text" })
swap_link_template: string | null
@Column({ nullable: true })
payment_link_template: string
@Column({ nullable: true, type: "text" })
payment_link_template: string | null
@Column({ nullable: true })
invite_link_template: string
@Column({ nullable: true, type: "text" })
invite_link_template: string | null
@Column({ nullable: true })
default_location_id: string
@DbAwareColumn({ type: "jsonb", nullable: true })
metadata: Record<string, unknown>
metadata: Record<string, unknown> | null
@FeatureFlagColumn("sales_channels", { nullable: true })
default_sales_channel_id: string
@FeatureFlagColumn("sales_channels", { nullable: true, type: "text" })
default_sales_channel_id: string | null
@FeatureFlagDecorators("sales_channels", [
OneToOne(() => SalesChannel),