feat: medusa-source-shopify loader (#563)

* added statuses to product + unit test for updating status

* add update to product model

* added integration tests

* added integration test to validate that updating status to null results in invalid_data error

* removed comment

* update GET /store/products integration test

* fixed unit test with IdMap

* init plugin

* changed dbehaviour on invalid status input on admin list products

* mprices

* updated migration to add status = published on all existing products + added integration test on GET /admin/products when status null is provided

* merged product status

* init ShopifyService

* made requested changes to migration and GET /store/products

* fixed test

* made requested changes to migration

* push progress on source plugin

* add webhook product/create handler

* fixed normalization of variant weight

* removed weight func

* work on events

* finished product hooks (error on new variant needs to be fixed)

* fixed order status

* create fulfillments

* update fulfillment on cancel

* refactored services, handle returns though medusa, helper methods

* order updates

* removed dist

* update gitignore

* emit cahnges to product

* added redis ignore check to prevent update loops

* fixed product-variant.deleted event

* fix more events

* fix test

* fix: order taxes

* added refund with no items

* fixes to hooks

* fixed handling refunds and returns issued from Shopify

* added unit tests to ShopifyProductService and ShopifyCollectionService

* linting fix

* prepared loader PR

* fix: jsDocs

* fix: pager

* fix: build output and babelrc

* chore: linting

* fix: address type

* fix: migration clean up

* fix: update snapshots with ext_ids

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
This commit is contained in:
Kasper Fabricius Kristensen
2021-12-08 10:09:21 +01:00
committed by GitHub
co-authored by Sebastian Rindom
parent f2ba4018fc
commit 577bcc23d4
46 changed files with 7857 additions and 61 deletions
+11 -11
View File
@@ -50,45 +50,45 @@ export class Address {
id: string
@Index()
@Column({ type: "text", nullable: true })
@Column({ type: "varchar", nullable: true })
customer_id: string | null
@ManyToOne(() => Customer)
@JoinColumn({ name: "customer_id" })
customer: Customer | null
@Column({ type: "text", nullable: true })
@Column({ type: "varchar", nullable: true })
company: string | null
@Column({ type: "text", nullable: true })
@Column({ type: "varchar", nullable: true })
first_name: string | null
@Column({ type: "text", nullable: true })
@Column({ type: "varchar", nullable: true })
last_name: string | null
@Column({ type: "text", nullable: true })
@Column({ type: "varchar", nullable: true })
address_1: string | null
@Column({ type: "text", nullable: true })
@Column({ type: "varchar", nullable: true })
address_2: string | null
@Column({ type: "text", nullable: true })
@Column({ type: "varchar", nullable: true })
city: string | null
@Column({ type: "text", nullable: true })
@Column({ type: "varchar", nullable: true })
country_code: string | null
@ManyToOne(() => Country)
@JoinColumn({ name: "country_code", referencedColumnName: "iso_2" })
country: Country | null
@Column({ type: "text", nullable: true })
@Column({ type: "varchar", nullable: true })
province: string | null
@Column({ type: "text", nullable: true })
@Column({ type: "varchar", nullable: true })
postal_code: string | null
@Column({ type: "text", nullable: true })
@Column({ type: "varchar", nullable: true })
phone: string | null
@CreateDateColumn({ type: resolveDbType("timestamptz") })
+12 -9
View File
@@ -175,7 +175,7 @@ export class Order {
@OneToMany(
() => ShippingMethod,
method => method.order,
(method) => method.order,
{
cascade: ["insert"],
}
@@ -184,14 +184,14 @@ export class Order {
@OneToMany(
() => Payment,
payment => payment.order,
(payment) => payment.order,
{ cascade: ["insert"] }
)
payments: Payment[]
@OneToMany(
() => Fulfillment,
fulfillment => fulfillment.order,
(fulfillment) => fulfillment.order,
{
cascade: ["insert"],
}
@@ -200,28 +200,28 @@ export class Order {
@OneToMany(
() => Return,
ret => ret.order,
(ret) => ret.order,
{ cascade: ["insert"] }
)
returns: Return[]
@OneToMany(
() => ClaimOrder,
co => co.order,
(co) => co.order,
{ cascade: ["insert"] }
)
claims: ClaimOrder[]
@OneToMany(
() => Refund,
ref => ref.order,
(ref) => ref.order,
{ cascade: ["insert"] }
)
refunds: Refund[]
@OneToMany(
() => Swap,
swap => swap.order,
(swap) => swap.order,
{ cascade: ["insert"] }
)
swaps: Swap[]
@@ -235,7 +235,7 @@ export class Order {
@OneToMany(
() => LineItem,
lineItem => lineItem.order,
(lineItem) => lineItem.order,
{
cascade: ["insert"],
}
@@ -244,7 +244,7 @@ export class Order {
@OneToMany(
() => GiftCardTransaction,
gc => gc.order
(gc) => gc.order
)
gift_card_transactions: GiftCardTransaction[]
@@ -266,6 +266,9 @@ export class Order {
@Column({ nullable: true })
idempotency_key: string
@Column({ type: "varchar", nullable: true })
external_id: string | null
// Total fields
shipping_total: number
discount_total: number
+3
View File
@@ -150,6 +150,9 @@ export class Product {
@Column({ default: true })
discountable: boolean
@Column({ nullable: true })
external_id: string
@CreateDateColumn({ type: resolveDbType("timestamptz") })
created_at: Date