_defineModel(definition, modelsConfig) {
        const {
            name,
            properties,
            relations,
            http,
            methods,
        } = definition;

        const isPublic = ComponentConfig.modelIsPublic(name, modelsConfig);

        const model = this.dataSource.createModel(name, properties, {
            base: 'PersistedModel',
            http,
            methods,
            relations,
            public: isPublic,
        });

        if (ComponentConfig.modelIsGlobal(name, modelsConfig)) {
            // expose the model on the app to make it shareable
            this.dataSource.app.model(
                model,
                {
                    dataSource: this.dataSource,
                    public: isPublic,
                },
            );
        }

        return model;
    }
/**
     * Hook the model into the app.
     *
     * If the model is configured to be global (via isGlobal property), it is mounted into the
     * application and avialable via app.models.ModelName (Default is true).
     *
     * If the model is configured to be public (via isPublic property), it is declared public
     * and exposed on the api of the consuming service (Default is false).
     *
     * @param {Object} definition
     * @param {Object} [modelsConfig] the models section of the service discovery section
     * @return {Model} - the loopback model
     *
     * @private
     */
Hook the model into the app.
If the model is configured to be global (via isGlobal property), it is mounted into the
application and avialable via app.models.ModelName (Default is true).

If the model is configured to be public (via isPublic property), it is declared public
and exposed on the api of the consuming service (Default is false).

@param {Object} definition
@param {Object} [modelsConfig] the models section of the service discovery section
@return {Model} - the loopback model

@private
Hook the model into the app . If the model is configured to be global ( via isGlobal property ) it is mounted into the application and avialable via app . models . ModelName ( Default is true ) . If the model is configured to be public ( via isPublic property ) it is declared public and exposed on the api of the consuming service ( Default is false ) . @param { Object } definition @param { Object } [ modelsConfig ] the models section of the service discovery section @return { Model } - the loopback model @private
_defineModel(definition, modelsConfig) {
        const {
            name,
            properties,
            relations,
            http,
            methods,
        } = definition;
        const isPublic = ComponentConfig.modelIsPublic(name, modelsConfig);
        const model = this.dataSource.createModel(name, properties, {
            base: 'PersistedModel',
            http,
            methods,
            relations,
            public: isPublic,
        });
        if (ComponentConfig.modelIsGlobal(name, modelsConfig)) {
            this.dataSource.app.model(
                model,
                {
                    dataSource: this.dataSource,
                    public: isPublic,
                },
            );
        }
        return model;
    }
_defineModel ( definition , modelsConfig ) { const { name , properties , relations , http , methods , } = definition ; const isPublic = ComponentConfig . modelIsPublic ( name , modelsConfig ) ; const model = this . dataSource . createModel ( name , properties , { base : 'PersistedModel' , http , methods , relations , public : isPublic , } ) ; if ( ComponentConfig . modelIsGlobal ( name , modelsConfig ) ) { this . dataSource . app . model ( model , { dataSource : this . dataSource , public : isPublic , } , ) ; } return model ; }
Hook the model into the app.
Hook the model into the app .
// expose the model on the app to make it shareable