How to load deep nested model on parent route?


#1

I am having deep nested route like this:

 this.route("projects", { path: "/" }, function() {
    this.route('project', { path: ':project_id' }, function() {
         this.route('testcycle', { path: '/testcycle_id' },function(){
           this.route('testsuite', { path: '/:testsuite_id' },function(){
              this.route('testcase',{path: '/:testcase_id'});
          })
       });;
    });
   });

And the models: -> project

export default DS.Model.extend({
    title: DS.attr('string'),
    testcycles: DS.hasMany('testcycle', {
		 async: true
	})
});

-> testcycle

export default DS.Model.extend({
    name: DS.attr('string'),
    project: DS.belongsTo('project', {
		 async: true
	}),
testsuites: hasMany('testsuite', {
		 async: true
	})
});

-> testsuite

export default DS.Model.extend({
    name: DS.attr('string'),
    testcycle: DS.belongsTo('testcycle', {
		 async: true
	}),
testcases: hasMany('testcase', {
		 async: true
	}),
});

-> testcase

export default DS.Model.extend({
    name: DS.attr('string'),
    testsuite: DS.belongsTo('testsuite', {
		 async: true
	})
});

the project route is:

export default Ember.Route.extend({
    model: function(params) {
        return this.store.findRecord('project', params.project_id);
    },

My expectation is displaying the tree (ember-cli-jstree) when user on project/1 page How can I format the json for jstree? I don’t know how to get all children records of testcycles, testsuites, testcases on project page. The data which I am getting now from project page is:

{
	"data": {
		"id": "90",
		"type": "projects",
		"attributes": {
			"name": "Grant, Price and Schneider",
			"description": "Cross-platform full-range process improvement"
		},
		"relationships": {
			"testcycles": {
				"data": [{
						"id": "12",
						"type": "testcycles"
					}, {
						"id": "13",
						"type": "testcycles"
					}
				]
			}
		}
	}
}

There is no any relating record of testsuites/testcases :frowning: Please, help me with this,I am very new with Ember! Thanks so much!