15 javascript asynchronous node.js exiftool ember.js
我有两个型号:
Event.js:
export default Model.extend({
checked : attr({ defaultValue: false }),
isActive : attr(),
createdAt : attr(),
updatedAt : attr(),
start : attr(),
end : attr(),
menPrice : attr(),
womenPrice : attr(),
information : attr(),
meetingPoint : attr(),
title : attr(),
hiw : attr(),
tip : attr(),
bookings : hasMany('booking', { async: true})
});
Run Code Online (Sandbox Code Playgroud)
和Booking.js:
export default Model.extend({
checked : attr({ defaultValue: false }),
isActive : attr(),
createdAt : attr(),
updatedAt : attr(),
participants : attr(),
email : attr(),
locale : attr(),
name : attr(),
observation : attr(),
phoneNumber : attr(),
event : belongsTo('event')
});
Run Code Online (Sandbox Code Playgroud)
我想在我的活动中建立关于预订的关系,但我无法弄清楚如何!
工作原理:当我在管理仪表板中创建事件时,没有可供参考的预订,这只发生在用户进行预订的网站中.
我使用此代码保存预订(预订)并参考业主活动:
let booking = this.get('store').createRecord('booking', {
event: this.get('event')
});
booking.save();
Run Code Online (Sandbox Code Playgroud)
它正在发挥作用.这就是预订的样子:
这是我的预订JSON:
{
"_id": {
"$oid": "56beb58da080cf2c2d46065b"
},
"relationships": {
"event": {
"data": {
"id": "56baa0cdd79cd63c7a0f0065",
"type": "events"
}
}
},
"type": "bookings",
"attributes": {
"created-at": {
"$date": "2016-02-13T04:48:13.489Z"
},
"gender": "null",
"hostel": "null",
"phone-number": "918918918118",
"observation": "obs",
"name": "Marcelo",
"locale": "es",
"email": "marcelo@pubcrawlsp.com",
"participants": 10,
"value": 0,
"is-active": false,
"vip": []
},
"__v": 0
}
Run Code Online (Sandbox Code Playgroud)
如您所见,这种关系与预订有关.
现在我需要相反,我的意思是..更新事件与预订里面...但我不能,我只是无法搞清楚如何!我至少坚持了3个星期.
我已经尝试了几件事,包括使用嵌入式选项,手动更新,但没有任何作用.
我很感激帮助!
也许我错误地理解了这个问题,但是实际保存所有预订的活动是否有意义?
我的意思是,通常对于像这样的一对多关系,预订将有一个 eventId 指向与其相关的事件,但该事件不包含对预订的引用。保存对事件的更改应自动反映在引用该事件的所有预订中。
归档时间: |
|
查看次数: |
284 次 |
最近记录: |