Adds publish/subscribe pattern to allow plugins and projects to hook into events (#55)

Also adds CLI to ease development.
This commit is contained in:
Sebastian Rindom authored and GitHub committed 2020-05-07 13:47:27 +02:00
1 parent 6a78df1ecd
commit 4c2aec2838
39 files changed
+6974 -444

No files matched your search

+2 -2
View File
@@ -312,9 +312,9 @@ export const carts = {
}
export const CartModelMock = {
create: jest.fn().mockReturnValue(Promise.resolve()),
create: jest.fn().mockImplementation(data => Promise.resolve(data)),
updateOne: jest.fn().mockImplementation((query, update) => {
return Promise.resolve()
return Promise.resolve(update)
}),
deleteOne: jest.fn().mockReturnValue(Promise.resolve()),
findOne: jest.fn().mockImplementation(query => {
+3 -3
View File
@@ -15,15 +15,15 @@ class CartModel extends BaseModel {
static schema = {
email: { type: String },
billing_address: { type: AddressSchema, default: {} },
shipping_address: { type: AddressSchema, default: {} },
billing_address: { type: AddressSchema },
shipping_address: { type: AddressSchema },
items: { type: [LineItemSchema], default: [] },
region_id: { type: String, required: true },
discounts: { type: [DiscountModel.schema], default: [] },
customer_id: { type: String, default: "" },
payment_sessions: { type: [PaymentMethodSchema], default: [] },
shipping_options: { type: [ShippingMethodSchema], default: [] },
payment_method: { type: PaymentMethodSchema, default: {} },
payment_method: { type: PaymentMethodSchema },
shipping_methods: { type: [ShippingMethodSchema], default: [] },
metadata: { type: mongoose.Schema.Types.Mixed, default: {} },
}