hotfix(medusa): Save empty metadata on line-items (#126)
This commit is contained in:
1 parent
a238fad7ea
commit
46dbbdb9fb
1 file changed
+41
-38
@@ -3,42 +3,45 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
import mongoose from "mongoose"
|
import mongoose from "mongoose"
|
||||||
|
|
||||||
export default new mongoose.Schema({
|
export default new mongoose.Schema(
|
||||||
title: { type: String, required: true },
|
{
|
||||||
description: { type: String },
|
title: { type: String, required: true },
|
||||||
thumbnail: { type: String },
|
description: { type: String },
|
||||||
is_giftcard: { type: Boolean, default: false },
|
thumbnail: { type: String },
|
||||||
should_merge: { type: Boolean, default: true },
|
is_giftcard: { type: Boolean, default: false },
|
||||||
has_shipping: { type: Boolean, default: false },
|
should_merge: { type: Boolean, default: true },
|
||||||
|
has_shipping: { type: Boolean, default: false },
|
||||||
|
|
||||||
// mongoose doesn't allow multi-type validation but this field allows both
|
// mongoose doesn't allow multi-type validation but this field allows both
|
||||||
// an object containing:
|
// an object containing:
|
||||||
// {
|
// {
|
||||||
// unit_price: (MoneyAmount),
|
// unit_price: (MoneyAmount),
|
||||||
// variant: (ProductVariantSchema),
|
// variant: (ProductVariantSchema),
|
||||||
// product: (ProductSchema)
|
// product: (ProductSchema)
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// and and array containing:
|
// and and array containing:
|
||||||
// [
|
// [
|
||||||
// {
|
// {
|
||||||
// unit_price: (MoneyAmount),
|
// unit_price: (MoneyAmount),
|
||||||
// quantity: (Number),
|
// quantity: (Number),
|
||||||
// variant: (ProductVariantSchema),
|
// variant: (ProductVariantSchema),
|
||||||
// product: (ProductSchema)
|
// product: (ProductSchema)
|
||||||
// }
|
// }
|
||||||
// ]
|
// ]
|
||||||
// validation is done in the cart service.
|
// validation is done in the cart service.
|
||||||
//
|
//
|
||||||
// The unit_price field can be used to override the default pricing mechanism.
|
// The unit_price field can be used to override the default pricing mechanism.
|
||||||
// By default the price will be set based on the variant(s) in content,
|
// By default the price will be set based on the variant(s) in content,
|
||||||
// however, to allow line items with variable pricing e.g. limited sales, gift
|
// however, to allow line items with variable pricing e.g. limited sales, gift
|
||||||
// cards etc. the unit_price field is provided to give more granular control.
|
// cards etc. the unit_price field is provided to give more granular control.
|
||||||
content: { type: mongoose.Schema.Types.Mixed, required: true },
|
content: { type: mongoose.Schema.Types.Mixed, required: true },
|
||||||
quantity: { type: Number, required: true },
|
quantity: { type: Number, required: true },
|
||||||
returned: { type: Boolean, default: false },
|
returned: { type: Boolean, default: false },
|
||||||
fulfilled: { type: Boolean, default: false },
|
fulfilled: { type: Boolean, default: false },
|
||||||
fulfilled_quantity: { type: Number, default: 0 },
|
fulfilled_quantity: { type: Number, default: 0 },
|
||||||
returned_quantity: { type: Number, default: 0 },
|
returned_quantity: { type: Number, default: 0 },
|
||||||
metadata: { type: mongoose.Schema.Types.Mixed, default: {} },
|
metadata: { type: mongoose.Schema.Types.Mixed, default: {} },
|
||||||
})
|
},
|
||||||
|
{ minimize: false }
|
||||||
|
)
|
||||||
Reference in new issue
Block a user