FAQ Database Discussion Community


hasMany relation: including from the other direction

node.js,strongloop,loopback
Say I have the next model: user.json: {//... "relations":{ "invoices": { "type": "hasMany", "model": "Invoice", "foreignKey": "receiverId" }, } //... } A.k.a. a user might have many invoices. This code adds the field receiverId to the invoice model. Now I want to get a list of invoices including their receivers....

Getting joined data from strongloop/loopback

node.js,loopbackjs,loopback
How can I get data from two joined tables? Suppose, there are two models called Category (CategoryId, CategoryName) and Product(ProductId, ProductName, CategoryId), Is there a way to get a result like:(ProductId, ProductName, CategoryId, CategoryName)

Strongloop: how to fetch a related model using code (not REST API)

node.js,strongloop,loopback
Having trouble getting a related model on a User object. Users have a to-many relation with Customers. Can I not just say User.customers to grab the customers associated with a User? I have tried User.find({include:'customers'}, function(err, user) { //now what? //user.customers does not work; there is no Customer array returned....

Issues with GCM Push Notifications

android,push-notification,android-gcm,loopback
for my first question on StackOverflow I'm gonna ask about Google Cloud Messaging service, and in particular Loopback's implementation. So, I'm developing an app and started to work on a different branch to introduce Loopback's push notification handling and it's various tools for REST Api. Even if this topic is...

Android 127.0.0.1 (loopback) connection: Works on WiFi, fails with 3G/4G

android,networking,mobile-webkit,loopback,3g-network
My application embeds a local http server that can be accessed through the loopback device at URL: http://127.0.0.1:8080/ It works fine with WiFi enabled, it also works fine with no external network (no WiFi, no 3G) but it fails when WiFi is disabled and 3G enabled. Connecting through adb shell...

ACL on certain records instead of API URLs

loopbackjs,strongloop,loopback
I'm stuck with a scenario where a logged in user can create blog posts in a CMS like system. So he creates these posts in a backend system. When that user is on the Blog page in the admin panel in then an API request like this is sent: /api/blogs?filter={'userid':...

StrongLoop: mutual Model Relations

javascript,loopbackjs,strongloop,loopback
I have this app with 3 Models: Users, Events and Venues. An user can create events that take places in a venue, This are the relations: User: hasMany Event Venue: hasMany Event Event: belongsTo User But I'm not sure if Event must also belongsTo Venue? (as the Venue is not...

Loopback Angular SDK response code 401 intercept

angularjs,authentication,loopback
I'm using the Angular Loopback SDK and am trying to implement a 401 handler that automatically detects when the user needs to authenticate. Loopback responds to a data request with a 401 and I use that to invoke a login dialog. Basically using the strategy described here - http://docs.strongloop.com/display/public/LB/AngularJS+JavaScript+SDK#AngularJSJavaScriptSDK-Handling401Unauthorized However,...