Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 16:43
    uniconstructor edited #4126
  • Jan 31 2019 16:41
    uniconstructor edited #4126
  • Jan 31 2019 16:41
    uniconstructor opened #4126
  • Jan 31 2019 03:44
    dzungh0ang closed #4123
  • Jan 30 2019 00:25
    techaks closed #4125
  • Jan 30 2019 00:02
    techaks edited #4125
  • Jan 30 2019 00:01
    techaks opened #4125
  • Jan 29 2019 23:33
    jkpulido opened #4124
  • Jan 29 2019 13:32
    nabdelgadir closed #4114
  • Jan 29 2019 09:17

    bajtos on add-node10

    (compare)

  • Jan 29 2019 07:13
    dzungh0ang opened #4123
  • Jan 29 2019 04:25
    dhmlau closed #3881
  • Jan 28 2019 13:14
    bajtos edited #4119
  • Jan 28 2019 12:47
    bajtos labeled #4121
  • Jan 28 2019 12:46
    bajtos labeled #4118
  • Jan 28 2019 12:46
    bajtos labeled #4118
  • Jan 28 2019 12:46
    bajtos labeled #4118
  • Jan 28 2019 12:46
    bajtos assigned #4118
  • Jan 25 2019 19:50
    dhmlau closed #3906
  • Jan 25 2019 19:13
    mschnee synchronize #4119
Arun Kumar
@arunkumar413
@krsubbar The best approach would be to have the authentication an authorization has a middlewares and would be the first middlewares to hit for every request.
if the authentication, authorization middleware fails the conditions, then the subsequent middlewares aren't invoked.
app.use('/authentication', checkAuthentication)
app.use ('/authorization', checkAuthrorization)
app.use('/protectedResource', protectedResourceController)
A-E
@a-edw
hi
Steven Altsman
@manchuwook
Hi - I have a not-really-QQ about generating controllers/models from OpenAPI and an error where I can't pinpoint to troubleshoot:
Request GET /v1/characters failed with status code 500. Error: Invalid type for property Armor
    at Function.ModelClass.registerProperty (S:\dev\runes-law\player-api\node_modules\loopback-datasource-juggler\lib\model-builder.js:557:13)
    at ModelBuilder.defineClass [as define] (S:\dev\runes-law\player-api\node_modules\loopback-datasource-juggler\lib\model-builder.js:642:16)
    at SageMongoDataSource.defineClass (S:\dev\runes-law\player-api\node_modules\loopback-datasource-juggler\lib\datasource.js:837:40)
    at CharacterRepository.definePersistedModel (S:\dev\runes-law\player-api\node_modules\@loopback\repository\src\repositories\legacy-juggler-bridge.ts:205:35)
    at CharacterRepository.ensurePersistedModel (S:\dev\runes-law\player-api\node_modules\@loopback\repository\src\repositories\legacy-juggler-bridge.ts:165:17)
    at CharacterRepository.resolvePropertyType (S:\dev\runes-law\player-api\node_modules\@loopback\repository\src\repositories\legacy-juggler-bridge.ts:224:14)
    at S:\dev\runes-law\player-api\node_modules\@loopback\repository\src\repositories\legacy-juggler-bridge.ts:200:22
    at Array.forEach (<anonymous>)
    at CharacterRepository.definePersistedModel (S:\dev\runes-law\player-api\node_modules\@loopback\repository\src\repositories\legacy-juggler-bridge.ts:190:43)
    at CharacterRepository.ensurePersistedModel (S:\dev\runes-law\player-api\node_modules\@loopback\repository\src\repositories\legacy-juggler-bridge.ts:165:17)
    at new DefaultCrudRepository (S:\dev\runes-law\player-api\node_modules\@loopback\repository\src\repositories\legacy-juggler-bridge.ts:144:28)
    at new CharacterRepository (S:\dev\runes-law\player-api\src\repositories\character.repository.ts:14:5)
    at S:\dev\runes-law\player-api\node_modules\@loopback\context\src\resolver.ts:76:14
    at Object.transformValueOrPromise (S:\dev\runes-law\player-api\node_modules\@loopback\context\src\value-promise.ts:298:12)
    at Object.instantiateClass (S:\dev\runes-law\player-api\node_modules\@loopback\context\src\resolver.ts:69:35)
    at S:\dev\runes-law\player-api\node_modules\@loopback\context\src\binding.ts:883:21
The API passes validation. I have the objects as components+JSON schemas, though I'm fine with moving all of into an API spec document
Steven Altsman
@manchuwook
Is this not a good channel to ask questions?
Rifa Achrinza
@achrinza

Hi @manchuwook, Slack is the recommended platform.

Here’s a copy of my previous message above:

—-

Have a question about LoopBack? Please read this!

Hi everyone, gentle reminder that Slack is the recommended platform for the community and Gitter is not actively monitored by the maintainers. A link can be found on https://loopback.io navbar and strongloop/loopback-next#5048.

hmadala5
@hmadala5
HI is there a way to manage opening and closing of database connections in loopback3
Dharmender Yadav
@dharmender2_gitlab

Hi, I have created a model and trying to cast/validate the post req body. But, loopback is ignoring the model definition.
Model Definition :

import {Entity, model, property} from '@loopback/repository';
import {company, customer} from '../interfaces';
@model()
export class BulkCompany extends Entity {
@property({
type: 'number',
id: true,
generated: true,
})
id?: number;

@property({
type: 'object',
required: true,
})
company: company;

@property({
type: 'object',
required: true,
})
customer: customer;

constructor(data?: Partial<BulkCompany>) {
super(data);
}
}
export interface BulkCompanyRelations {
// describe navigational properties here
}
export type BulkCompanyWithRelations = BulkCompany & BulkCompanyRelations;

Interfaces :

export interface beneficialOwners {
name: string;
title: string;
ownershipPercentage: number;
}
export interface company {
name: string;
state: string;
type: string;
designator: string;
website: string;
description: string;
industry: string;
beneficialOwners: beneficialOwners[];
alternateName: string;
}

export interface customer {
email: string;
name: string;
phone: string;
addressLine1: string;
addressCity: string;
addressState: string;
addressZip: string;
}

Route :

async createBulkCompanies(
@requestBody({
content: {
'application/json': {
schema: {
type: 'array',
additionalProperties: false,
items: getModelSchemaRef(BulkCompany, {
title: 'BulkCompany',
exclude: ['id'],
}),
},
},
},
})
company: [Omit<BulkCompany, 'id'>],
): Promise<any> {}

Problem is i am not getting a validation on company.beneficialOwners

Mathews Mathai
@mathewsmathai1
Getting "Cannot read property 'apply' of undefined" on calling Module. get relatedModel() after overriding Model.findOne().
Posted the same on SO if anybody would like to help: https://stackoverflow.com/questions/68665417/overriding-built-in-crud-methods-cannot-read-property-apply-of-undefined
springdev2022
@springdev2022
which is the best open source reporting tool for java application which has open source designer as well?
mightytyphoon
@mightytyphoon
Hi Everyone ! I am digging the authentication/authorization implementation of JWT proposed by LB team. I think about generating a new TOKEN_SECRET to sign tokens at every server restart and delete all token at every start. I also think about creating a endpoint to manually regenerate the token secret with admin authorization that would also delete all tokens. What do you think about that ? Should I also create a auto regeneration of token secret ? (every 2 weeks for example)
I mean, is it the most secured way ?
mightytyphoon
@mightytyphoon
I think I will go with generating a new TOKEN SECRET everytime, this way there is no possibility of leaking other than going through bindings server side, the secret won't be known from anybody not having access to code + ssh server, this will disconnect user everytime server is restarted, I don't think it's a problem if it ensures security. Everytime a user tries to connect and his token isn't anymore compatible with signature, it will ask for a reconnection with password.
mightytyphoon
@mightytyphoon
jeez, I didn't see last user message date, I guess this chat is dead.
Rifa Achrinza
@achrinza

Hi @mightytyphoon, Slack is the recommended platform.
Here’s a copy of my previous message above:
—-

Have a question about LoopBack? Please read this!

Hi everyone, gentle reminder that Slack is the recommended platform for the community and Gitter is not actively monitored by the maintainers. A link can be found on https://loopback.io navbar and strongloop/loopback-next#5048.

priyadharshini-gopal
@priyadharshini-gopal
need help in implementing the multi strategy middle ware
Implemented the multi tenant strategy as a standalone application from the example, But when importing to another application it fails and the multi tenant middleware context is not called. I am not sure I understand the multitenantactionprovider as I dont see them in the code. Can you please help how to integrate this example in existing application?
Kelden Dradul Dorji
@compressionmonkey

Hi. I am using loopback 3. I have a model location with relationship to

"resident": {
      "type": "belongsTo",
      "polymorphic": true
    },

How do I write the same for relationship to resident in Loopback 4?

koliapp2019
@koliapp2019
Hi, we get this error in middleware - Error: Cannot resolve path "params"
"loopback-kafka-consumer-middleware": {
"params": {
"consumerHandler": "./kafkaEventHandler"
}
}
the file is there under ./server
any help / advice would be highly appreciated.
Bunthon Dev
@bunthondev_gitlab
Hi everyone,
I am new with loopback, i have 2 models, user and asset model
Do loopback provide crud that can insert user and it's assets in one request?
odysseas
@bogdanos_gitlab

Question: by following the todo-list tutorial, in the relational db section, we get the following decorator on the Todo model:

@model({
  settings: {
    foreignKeys: {
      fk_todo_todoListId: {
        name: 'fk_todo_todoListId',
        entity: 'TodoList',
        entityKey: 'id',
        foreignKey: 'todoListId',
      },
    },
  },
})
export class Todo extends Entity { /* ... */ }

But when running npm run migrate I got an error stating that the foreign key property does not exists.

In fact, I checked the queries issued by the migration, I noticed that theTodo.todoListId property is mapped to Todo.todolistid column (notice the lowercase!). By changing the foreignKey: 'todoListId' to foreignKey: 'todolistid' it works.

The problem is that the tutorial doesn't change the generated column name. Did I miss anything? Or is this an issue with the tutorial?

Christofer Huber
@crebuh

Hi Guys, I have a problem with loopback v3 and loopback-connector-mongodb. I have the following method with an Aggregation.

Company.extendedFind = async function(region, search) {
        const companyCollection = Company.getDataSource().connector.collection(Company.app.models.Company.modelName);
        const $and = [
            { 'account.type': 'recruiter' },
            { _isDeleted: { $exists: false }},

        ];
        if (region) {
            $and.push({ 'account.region': region });
        }
        if (search) {
            $and.push({ $or: [{ name: { $regex: search, $options: 'i' }}, { 'account.email': { $regex: search, $options: 'i' }}] });
        }
        return await companyCollection.aggregate([
            { $lookup: { from: 'Account', localField: 'accountId', foreignField: '_id', as: 'account' }},
            { $unwind: '$account' },
            { $match: { $and: $and }},
            { $lookup: { from: 'JobAd', let: { id: '$_id' }, pipeline: [{ $match: { $expr: { $and: [{ $eq: ['$$id', '$companyId'] }, { $eq: ['$status', 'Published'] }] }}}], as: 'jobAds' }},
            { $sort: { name: 1 }},
            { $project: { id: 1, name: 1, createdAt: 1, credits: 1, accountId: 1, 'account.email': 1, 'account.region': 1, numOfJobs: { $size: '$jobAds' }}},
            // { $project: { id: 1, name: 1, createdAt: 1, credits: 1, accountId: 1, 'account.email': 1, 'account.region': 1 }},
        ], { allowDiskUse: true }).toArray();
    };

I have about 1000 company and account records, as well as about 10k JobAd records. On the mongoshell the query takes 1.8 seconds. For whatever reason running this through loopback as api call it takes more then 20 seconds.
The issue is the lookup for the JobAd model, when I remove it then is also very fast through loopback.
Any idea what the issue could be?

Tõnis Ostrat
@tonisostrat
hi. i'm working on a LB4 project that has a service interface with a REST-type datasource. is there a way to add a custom method to that resulting service? if so, what's the preferred/correct way?
doublepithre
@doublepithre
hi all,
We have a legacy loopback3 codebase, just wondering whether loopback-connector-postgresql latest version support loopback3. From the readme it seems so, but I'm not sure
Daniel Szasz
@dany-sb_gitlab
Hello, I am using loopback 4 with Postgres DB. It's working on I am running locally on my computer but when I deploy it to Heroku is not able to connect to DB. not to the "heroku" db and also not to a RDS (AWS) instance. Any idea ? I am getting the "Cannot start the application. Error: Timeout in connecting after 5000 ms"
2 replies
Daniel Szasz
@dany-sb_gitlab
The problem is for sure with the connection code since from the command line is working perfectly. I reallywill be happy for any help