Way to fetch nested model

I have a couple of models.

From the user model is to possible to fetch just the name model?

Basically I want to generate this call in the router.

/users/id/names

i checked a few online references, but couldn’t spot one for this specific case.

appreciate any help!

model abstraction

user model. user has many names

import Model, {hasMany} from '@ember-data/model';
  
export default class UserModel extends Model {
       @hasMany('names') names;
 }

name model

import Model, {belongsTo} from '@ember-data/model';
  
export default class UserModel extends Model {
       @belongsTo('user') user;
 }

Basically I want to generate this call in the router. /users/id/names

Generally the easiest way to do this is to add a “links” object to the record in the user serializer, something along these lines:

  normalize(model, hash, prop) {
    hash.links = {
      names: `/users/${hash.id}/names`
    };
    return this._super(...arguments);
  }

What this tells ember data is that each “user” record should, instead of fetching its relationship to names by ids, fetch it from the provided link instead. I should also note that if you have control over the API the API can (and sometimes should) provide these links instead of doing it in the client.

That helped , Thanks!