Commit 993760e8 by ivan Lan

Improve order spec

parent 6f9ca3f0
......@@ -206,6 +206,10 @@ RSpec.describe "#{namespace}/orders", type: :request, capture_examples: true, ta
type: :object, properties: {
address: { type: :string },
user_remark: { type: :text },
address: { type: :string },
delivery_way: { type: :string },
delivery_cost: { type: :string },
meta: { type: :object },
incr_snapshot_ids: { type: :array },
},
snapshots: {
......@@ -281,6 +285,10 @@ RSpec.describe "#{namespace}/orders", type: :request, capture_examples: true, ta
type: :object, properties: {
address: { type: :string },
user_remark: { type: :text },
address: { type: :string },
delivery_way: { type: :string },
delivery_cost: { type: :string },
meta: { type: :object },
incr_snapshot_ids: { type: :array },
gone_snapshot_ids: { type: :array },
}
......
json.extract! order, :id, :seq, :address,
:total_price, :total_original_price,
:pay_time, :delivery_time, :receipt_time,
:delivery_way, :delivery_cost,
:merchant_remark, :mark, :customer_remark,
......
json.extract! order, :id, :seq, :address,
:total_price, :total_original_price,
:pay_time, :delivery_time, :receipt_time,
:delivery_way, :delivery_cost,
:merchant_remark, :mark, :customer_remark,
......
json.extract! order, :id, :seq, :status_zh, :address,
json.extract! order, :id, :seq, :total_price, :total_original_price,
:status_zh, :address,
:pay_time, :delivery_time, :receipt_time,
:delivery_way, :delivery_cost, :customer_remark,
:status, :status_zh, :meta
......
json.extract! order, :id, :seq, :address,
json.extract! order, :id, :seq, :address,
:total_price, :total_original_price,
:pay_time, :delivery_time, :receipt_time,
:delivery_way, :delivery_cost, :customer_remark,
:status, :status_zh, :meta
\ No newline at end of file
......@@ -14,7 +14,7 @@ module Shotengai
collection_name = klass.model_name.collection || options[:as]
cart_name = "#{klass.model_name.singular}_cart"
# has many Order
has_many collection_name.to_sym, class_name: klass.name, as: :buyer
has_many collection_name.to_sym, class_name: klass_name, as: :buyer
# has one Cart
has_one cart_name.to_sym, class_name: klass.cart_class.name, as: :buyer
# User.new Cart 相关
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment