2016-05-24 15:06:59 +03:00
|
|
|
import ApplicationAdapter from 'ghost-admin/adapters/application';
|
|
|
|
import SlugUrl from 'ghost-admin/mixins/slug-url';
|
2014-08-06 20:48:18 +04:00
|
|
|
|
2015-11-23 16:48:08 +03:00
|
|
|
export default ApplicationAdapter.extend(SlugUrl, {
|
2015-10-28 14:36:45 +03:00
|
|
|
find(store, type, id) {
|
|
|
|
return this.findQuery(store, type, {id, status: 'all'});
|
2015-09-03 14:06:50 +03:00
|
|
|
},
|
|
|
|
|
2015-10-15 14:43:04 +03:00
|
|
|
// TODO: This is needed because the API currently expects you to know the
|
|
|
|
// status of the record before retrieving by ID. Quick fix is to always
|
|
|
|
// include status=all in the query
|
2015-10-28 14:36:45 +03:00
|
|
|
findRecord(store, type, id, snapshot) {
|
2015-10-15 14:43:04 +03:00
|
|
|
let url = this.buildIncludeURL(store, type.modelName, id, snapshot, 'findRecord');
|
|
|
|
|
|
|
|
url += '&status=all';
|
|
|
|
|
|
|
|
return this.ajax(url, 'GET');
|
|
|
|
},
|
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
findAll(store, type, id) {
|
|
|
|
return this.query(store, type, {id, status: 'all'});
|
2017-01-14 00:14:54 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
queryRecord(store, type, query) {
|
|
|
|
if (!query || query.id !== 'me') {
|
|
|
|
return this._super(...arguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
let url = this.buildURL(type.modelName, 'me', null, 'findRecord');
|
|
|
|
|
|
|
|
return this.ajax(url, 'GET', {data: {include: 'roles'}});
|
2014-07-21 01:48:24 +04:00
|
|
|
}
|
|
|
|
});
|