Last active
March 18, 2020 18:50
-
-
Save runspired/9bd8584c1e40a1063437c3944e9b7ce0 to your computer and use it in GitHub Desktop.
Data Bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import JSONAPIAdapter from '@ember-data/adapter/json-api'; | |
import HasManyQueryAdapterMixin from 'ember-data-has-many-query/mixins/rest-adapter'; | |
export default JSONAPIAdapter.extend(HasManyQueryAdapterMixin, { | |
host: 'https://api.eventyay.com', | |
namespace : 'v1' | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Controller from '@ember/controller'; | |
export default class ApplicationController extends Controller { | |
appName = 'Ember Twiddle'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Model, { attr, belongsTo, hasMany } from '@ember-data/model'; | |
import ModelMixin from 'ember-data-has-many-query/mixins/model'; | |
export default Model.extend(ModelMixin, { | |
identifier : attr('string', { readOnly: true }), | |
name : attr('string'), | |
description : attr('string'), | |
speakers : hasMany('speaker') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Model, { attr, belongsTo } from '@ember-data/model'; | |
export default Model.extend({ | |
name: attr('string'), | |
event: belongsTo('event') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Route from '@ember/routing/route'; | |
import { inject as service } from '@ember/service'; | |
export default class IndexRoute extends Route { | |
@service store; | |
async model() { | |
const event = await this.store.findRecord('event', 6); | |
const sortedByName = await event.query('speakers', { sort: 'name' }); | |
debugger; | |
const sortedById = await event.query('speakers', { sort: 'id' }); | |
return { | |
sortedByName, | |
sortedById | |
}; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.17.0", | |
"EmberENV": { | |
"FEATURES": {}, | |
"_TEMPLATE_ONLY_GLIMMER_COMPONENTS": false, | |
"_APPLICATION_TEMPLATE_WRAPPER": true, | |
"_JQUERY_INTEGRATION": true | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
"ember": "3.17.0", | |
"ember-template-compiler": "3.17.0", | |
"ember-testing": "3.17.0" | |
}, | |
"addons": { | |
"@glimmer/component": "1.0.0", | |
"ember-data": "3.15.1", | |
"ember-data-has-many-query": "0.3.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment