loopbackjs

NodeJs - Loopback : How to upload file on google cloud storage

假装没事ソ 提交于 2019-12-07 15:55:29
In loopback framework, we have a module LoopBack Storage Component. It's support for many clouds except Google Cloud Storage. But I have to use Google Cloud. It should support Google out of the box because it uses pkgcloud lib which has support for Google Cloud. Try simply adding a config entry to the providers.json file. For more info on how to do that check Loopback storage component documentation and also pkgcloud config format for Google Cloud. I'd just try something like this in the providers.json: { "google": { "keyFilename": "/path/to/a/keyfile.json", "projectId": "your-project-id" } }

How can I update hasandbelongstomany relations for multiple models at once in strongloop loopback

断了今生、忘了曾经 提交于 2019-12-07 15:22:22
问题 I have 2 models in a Strongloop Loopback API Products Tags Between those 2 models I have defined a hasAndBelongsToMany-relation . In my CMS I want a bulk-update functionality for my products, in which I can select many Products, and assign many tags, in one action. How can I save those easily to my Mysql-DB, without having to iterate over each product, then iterate over each tag, and link those 2 ? I checked in the docs and found the add and remove functions, but those only connect one model

Intercepting error handling with loopback

烂漫一生 提交于 2019-12-07 14:24:39
问题 Is there somewhere complete, consistent and well documented source of information on error handling in loopback? Things like error codes and their meaning, relation with http statuses. I've already read their docs and have not found anything like this. I would like to translate all the messages to add multi language support to my app. I would also like to add my custom messages, with their code and to use it consistently with other loopback errors. In order to achieve this, I need to

Reset Loopback Password with Access Token

泪湿孤枕 提交于 2019-12-07 11:28:29
问题 I'm working on a project that uses Loopback as a framework, and includes users and authentication. I added a password reset route generated and sent in an email, and everything seemed to be working correctly. Recently, I discovered that the password reset does not appear to be working. The process for resetting the password here is: Call password reset method for user Send email from reset event, including user ID and access token From reset link, set $http.defaults.headers.common

Loopback Filter Based On Related Model Properties

不想你离开。 提交于 2019-12-07 08:37:07
问题 I want to be able to filter based on the properties of related models. For example, I have a Class object with a Building object. I want to get a list of classes that take place in a certain building. This filter { "include":"building", "scope":{ "where":{ "name":"warehouse" } } } returns all classes, but only includes building if its name is "warehouse". What I want is for the where clause on building name to apply to the whole filter so that I only get the class if it's building has that

Loopback 2.4: how to query certain fields of related model via REST API

家住魔仙堡 提交于 2019-12-07 04:03:53
问题 I have User model over relational DB. Each User can hasMany "users" where "chiefId" is FK. "relations": { "users": { "type": "hasMany", "model": "User", "foreignKey": "chiefId" }, } I can query related users for each chief-user like this: GET /users?filter={"include":"users"} But it returns full user objects. How should I query only "name" properties of related users? Also is it possible to count related instances in one request to server? 回答1: A late reply but I just ran into this question

Querying from models with HasManyThrough relations - strongloop api

佐手、 提交于 2019-12-06 16:37:36
This is a follow up to a previous question . Currently, the api can query from the category and game model which share a relation. For example, through this endpoint /Categories/1001/games/mature I can list all games of fighting category that have mature set to true . However, I have included a third model gameInfo from db table game_info . Since, I want to fetch the information from those three tables, i have included a through model named gamesCategoriesBridge from db table games_categories_bridge . I followed the guidelines to set HasManyThrough relations . The issue is that the additional

Loopback hasMany relation doesn't work on mongodb

落爺英雄遲暮 提交于 2019-12-06 15:15:08
I have some strange behavior after moving from RedHat linux to SUSE on AWS. Everything was working fine, before. Here is my relations: Category: { "name": "Category", "plural": "categories", "base": "PersistedModel", "relations": { ... "professions": { "type": "hasMany", "model": "Profession", "foreignKey": "" } } } Profession: { "name": "Profession", "plural": "professions", "base": "PersistedModel", "relations": { ... "category": { "type": "belongsTo", "model": "Category", "foreignKey": "" } } } The problem is that when I update an existing profession with: { "categoryId" : "..." } It doesn

Loopback - GET model using custom String ID from MongoDB

喜你入骨 提交于 2019-12-06 14:55:34
I'm developing an API with loopback, everything worked fine until I decided to change the ids of my documents in the database. Now I don't want them to be auto generated. Now that I'm setting the Id myself. I get an "Unknown id" 404, whenever I hit this endpoint: GET properties/{id} How can I use custom IDs with loopback and mongodb? Whenever I hit this endpoint: http://localhost:5000/api/properties/20020705171616489678000000 I get this error: { "error": { "name": "Error", "status": 404, "message": "Unknown \"Property\" id \"20020705171616489678000000\".", "statusCode": 404, "code": "MODEL_NOT

Loopback custom method call from Android

亡梦爱人 提交于 2019-12-06 08:20:39
问题 I am looking for example where I can call loopback's custom method from Android. To explain more, lets say I have a method on server side with name "greet(name)" that will greet someone. I want to invoke that from Android. Any example, or link is ok. Thanks in advance. Jahid 回答1: In the examples below, I'll assume your model is called Greeter and the static method Greeter.greet is invoked via GET /greeters/greet?name=Alex . First of all, you need to describe the REST mapping of your method.