FAQ Database Discussion Community

hasMany relation: including from the other direction

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....

Loopback Angular SDK response code 401 intercept

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,...

Getting joined data from strongloop/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)

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

My application embeds a local http server that can be accessed through the loopback device at URL: 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...

StrongLoop: mutual Model Relations

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...

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

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....

ACL on certain records instead of API URLs

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':...

Issues with GCM Push Notifications

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...