Skip to content

Issue with related models export #26

Description

@pandaiolo

There is a problem with how relations are dealt with in current impementation of this module.

I feel like relations are not really supported, but if this is the case, they should not be exported.

For example, currently, a related object endpoint will result in lbServices blocks like the following :

    "prototype$__get__products": {
      url: urlBase + "/collections/:id/products",
      method: "GET",
      isArray: true,
    },

This is nice because a collection related products can be pulled out without requiring two separate connections to the API server, using :

Collection.prototype$__get_products({ id: [collection_id] }, function(products) {
    // products are from collection [collection_id]
});

However, there is an issue : prototype$__get_products beeing in the Collection ressource prototype, the resulting objects are considered Collection items by AngularJS !

If I save any of these items, they will be stored in collection database, instead of products....

This feature is seemingly a side effect of raw exporting models API definitions to angular ressources, and is not documented / advised to use.

However, it would be very nice to be able to access related items in the angular services, in a clean and documented way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions