Commit Graph

243 Commits

Author SHA1 Message Date
Raymond Feng 567e2530d7 Build the email verification url from app context
https://github.com/strongloop/loopback/issues/408
2014-07-26 22:39:42 -07:00
Raymond Feng 5bb4cde593 Update test case to remove usage of deprecated express apis 2014-07-26 14:37:13 -07:00
Raymond Feng af26e09845 Emit a 'modelRemoted' event by app.model()
This event will be listened by loopback-explorer so that models remoted
after the explorer is initiated will be added to the api specs
2014-07-24 17:00:27 -07:00
Raymond Feng ac1428eff5 Fix for email transports 2014-07-23 22:09:24 -07:00
Raymond Feng 13c876c154 Merge pull request #387 from strongloop/feature/fix-base-model
Set up the base model based on the connector types
2014-07-22 10:58:33 -07:00
Raymond Feng 7337f0a0de Enhance the base model assertions 2014-07-22 10:57:42 -07:00
Raymond Feng 335bae4b46 Merge branch 'master' into feature/fix-issue-377 2014-07-22 10:49:20 -07:00
Raymond Feng 21b8609ee2 Report error for User.confirm()
See https://github.com/strongloop/loopback/issues/377
2014-07-22 10:42:22 -07:00
Raymond Feng 643293cc25 Set up the base model based on the connector types 2014-07-22 10:38:14 -07:00
Raymond Feng 74e9ff75e3 Merge pull request #385 from offlinehacker/master
Validate username uniqueness
2014-07-21 15:26:01 -07:00
Raymond Feng 0dae813d5f Merge pull request #375 from strongloop/feature/upgrade-to-nodemailer-1.x
Upgrade to nodemailer 1.0.1
2014-07-21 11:58:17 -07:00
Miroslav Bajtoš eb5ef04b6a Remove `loopback.compat.usePluralNamesForRemoting`
The `usePluralNamesForRemoting` was added in January 2014 for users
upgrading from LoopBack 1.5 or older.
2014-07-21 16:56:46 +02:00
Jaka Hudoklin 90094e5e86 Validate username uniqueness
Signed-off-by: Jaka Hudoklin <jakahudoklin@gmail.com>
2014-07-19 14:18:21 +02:00
Raymond Feng e5b64c6143 Upgrade to nodemailer 1.0.1 2014-07-16 12:40:15 -07:00
Raymond Feng 79f504a3c7 Merge branch 'master' into 2.0 2014-07-16 09:09:07 -07:00
Raymond Feng 7b36196561 Merge pull request #362 from strongloop/feature/remoting-add-remove
Add a test case for hasMany through add/remove remoting
2014-07-15 16:15:27 -07:00
Raymond Feng 54b13f4feb Upgrade to loopback-datasource-juggler@1.7.0 2014-07-15 16:15:02 -07:00
Raymond Feng c5c28aa634 Merge pull request #368 from strongloop/feature/loopback-base-model
Refactor modelBuilder to registry and set up default model
2014-07-15 08:38:43 -07:00
Raymond Feng 3c13ce5a8f Refactor modelBuilder to registry and set up default model 2014-07-15 08:37:59 -07:00
Raymond Feng 76b6dc10d9 Add a test case for credentials/challenges 2014-07-15 08:20:47 -07:00
Miroslav Bajtoš 31ef6394b4 checkpoint: fix `current()`
Fix the query in `Checkpoint.current()` to correctly specify sorting
`seq DESC`. Before this change, the first checkpoint was returned as the
current one.
2014-07-11 17:07:22 +02:00
Raymond Feng 74a39f3fc2 Refactor email verification tests into a new group 2014-07-08 08:54:50 -07:00
Raymond Feng 0c67b1e781 Add an option to honor emailVerified
See https://github.com/strongloop/loopback/pull/215
2014-07-07 14:09:45 -07:00
Raymond Feng f649c92bcf Refine the test cases for relation REST APIs 2014-07-03 11:18:34 -07:00
Miroslav Bajtoš f0cc5f7534 test: add check of Model remote methods
The test ensures that Model has all methods listed in docs:

http://docs.strongloop.com/display/LB/Exposing+models+over+a+REST+API

See also #359.
2014-07-03 08:19:41 +02:00
Raymond Feng 0525f2c896 Adjust the REST mapping for add/remove 2014-07-02 23:06:11 -07:00
Raymond Feng b221714b38 Add a test case for hasMany through add/remove remoting 2014-07-02 18:09:05 -07:00
Raymond Feng 217c9fa348 Fix the typo and add Bearer token support
See https://github.com/strongloop/loopback/issues/333
2014-07-02 09:02:13 -07:00
Miroslav Bajtoš 8ea11ea955 Merge branch 'master' into 2.0
Land the pull request #357
> app: update `url` on `listening` event
2014-07-01 16:18:00 +02:00
Miroslav Bajtoš dfa8d7f49f app: update `url` on `listening` event
Most applications report the URL when started (at least the apps we
are scaffolding using loopback-workspace). Constructing the URL in the
loopback core allows us to simplify the templates and reduce the amount
of repeated code.
2014-07-01 14:27:02 +02:00
Miroslav Bajtoš 50816ebbe3 Fix loopback in PhantomJS, fix karma tests
- Move configuration of Karma unit-tests from `Gruntfile.js` to a
  standalone file (`test/karma.conf.js`).

- Add a new Grunt task `karma:unit-ci` to run Karma unit-tests in
  PhantomJS and produce karma-xunit.xml file that can be consumed
  by the CI server.

- Add grunt-mocha-test, configure it to run unit-tests.

- Add `grunt test` task that runs both karma and mocha tests,
  detects Jenkins to produce XML output on CI server.

- Modify the `test` script in `package.json` to run
  `grunt mocha-and-karma` (an alias for `grunt test`).
  The alias is required to trick `sl-ci-run` to run `npm test`
  instead of calling directly `mocha`.

- Add `es5-shim` module to karma unit-tests in order to provide
  ES5-methods required by LoopBack.

- Fix `mixin(source)` in lib/loopback.js to work in PhantomJS.
  `Object.getOwnPropertyDescriptor()` provided by `es5-shim` does not
  work in the same way as in Node.
2014-06-26 13:30:09 +02:00
Miroslav Bajtoš c896c78db0 Remove `app.boot`
Modify `app.boot` to throw an exception, pointing users to the new
module `loopback-boot`.
2014-06-25 14:09:06 +02:00
Raymond Feng 9eab7d62d3 Merge branch 'master' into 2.0 2014-06-20 23:48:46 -07:00
Raymond Feng b44dac3c62 Merge branch 'master' into 2.0 2014-06-20 23:08:35 -07:00
Raymond Feng 9b5d7417a2 Remove relationNameFor 2014-06-20 21:25:27 -07:00
Raymond Feng d5ed57e60d Merge pull request #254 from strongloop/feature/role-id
Set the role id to be generated
2014-06-17 10:37:06 -07:00
Miroslav Bajtoš 7316048afc lib/registry: `getModel` throws, add `findModel`
Rename `loopback.getModel` to `loopback.findModel`.

Implement `loopback.getModel` as a wrapper around `findModel` that
throws an error when the model as not found.
2014-06-16 16:13:24 +02:00
Miroslav Bajtoš 56c7a6b3c5 Merge branch 'master' into 2.0
Conflicts:
	test/access-token.test.js
2014-06-16 10:20:22 +02:00
Miroslav Bajtoš 8826b6396a Merge pull request #306 from karlmikko/master
Ability to return 401 and 403 response codes #301
2014-06-14 09:44:22 +02:00
Miroslav Bajtoš d2517d8236 Merge branch 'master' into 2.0 2014-06-14 09:40:57 +02:00
Karl Mikkelsen a90a5c7e58 Allow customization of ACL http status
emulate existing error on 404
new tests for model and app settings
Signed-off-by: Karl Mikkelsen <karl@karlmikko.com>
2014-06-14 11:31:15 +10:00
Miroslav Bajtoš c4db83ad43 Expose loopback as `app.loopback`
The primary intention is to allow loopback plugins to determine
the version of the loopback framework from the `app` object.
2014-06-13 10:34:51 +02:00
Miroslav Bajtoš d21669b844 Merge branch 'master' into 2.0
Conflicts:
	docs.json
	lib/application.js
	lib/loopback.js
	lib/models/data-model.js
	lib/models/model.js
	lib/models/user.js
	lib/registry.js
	package.json
	test/app.test.js
2014-06-13 10:09:25 +02:00
Miroslav Bajtoš 362cceb70a Merge createModelFromConfig with createModel
Merge the two methods `loopback.createModel` and
`loopback.createModelFromConfig` into a single method `createModel`.
2014-06-12 10:41:45 +02:00
Miroslav Bajtoš f0ff40d3f7 test: add debug logs
Add debug logs to troubleshoot two unit tests failing
on the CI server only.
2014-06-12 10:41:44 +02:00
Miroslav Bajtoš fc0fad4a9f Add createModelFromConfig and configureModel()
Add new API allowing developers to split the model definition and
configuration into two steps:

 1. Build models from JSON config, export them for re-use:

  ```js
  var Customer = loopback.createModelFromConfig({
    name: 'Customer',
    base: 'User',
    properties: {
      address: 'string'
    }
  });
  ```

 2. Attach existing models to a dataSource and a loopback app,
    modify certain model aspects like relations:

  ```js
  loopback.configureModel(Customer, {
    dataSource: db,
    relations: { /* ... */ }
  });
  ```

Rework `app.model` to use `loopback.configureModel` under the hood.
Here is the new usage:

```js
var Customer = require('./models').Customer;

app.model(Customer, {
  dataSource: 'db',
  relations: { /* ... */ }
});
```

In order to preserve backwards compatibility,
`app.model(name, config)` calls both `createModelFromConfig`
and `configureModel`.
2014-06-12 10:41:44 +02:00
Miroslav Bajtoš 3deadcd180 test: fix ACL integration tests
Change the tests creating new users so that they send valid user data,
in order to prevent 422 "validation failed" responses.

Upgrade loopback-testing to 0.2.0.
2014-06-12 10:33:40 +02:00
Raymond Feng e72ff61d99 Add a test case 2014-06-10 16:39:32 -07:00
Raymond Feng 7769174d58 Tidy up app.model() to remove duplicate & recusrive call 2014-06-09 23:53:01 -07:00
Raymond Feng 815ad53aa4 Register existing model to app.models during app.model() 2014-06-09 16:31:33 -07:00