Commit Graph

472 Commits

Author SHA1 Message Date
Raymond Feng 2d62b5ba6a Add support to discover related schemas by foreign keys 2013-05-30 23:13:04 -07:00
Raymond Feng ad14bd9dbc Add more debugging info 2013-05-30 17:23:31 -07:00
Raymond Feng 8912defe8e Enhance support for composite keys 2013-05-30 16:06:04 -07:00
Raymond Feng d9998d8294 Update column type info 2013-05-29 10:03:01 -07:00
Raymond Feng 6255da2ae0 Fix mixin 2013-05-29 07:17:07 -07:00
Raymond Feng 771bf70ec5 Add options including default 2013-05-28 15:40:16 -07:00
Raymond Feng 465a963d2d Adding more tests 2013-05-28 13:50:59 -07:00
Raymond Feng dd8512bc1f Refactor more functions into mixins 2013-05-27 22:20:43 -07:00
Ritchie Martori 50b2036511 Update remoting signatures for dao. 2013-05-24 15:10:34 -07:00
Ritchie 0a8df17135 Merge branch 'master' of github.com:strongloop/jugglingdb 2013-05-24 08:03:11 -07:00
Ritchie ae9cb9a6f2 Add pluralized name to model and remoting method signatures 2013-05-24 08:02:58 -07:00
Raymond Feng 98690a4881 Add docs 2013-05-23 22:40:33 -07:00
Raymond Feng dea07f3a02 Rename adl to be ModelBuilder 2013-05-23 22:20:20 -07:00
Raymond Feng a014fddd8a Add more methods to map column/property names 2013-05-23 21:09:46 -07:00
Ritchie a690f8d8df Add data source attach example 2013-05-23 17:29:03 -07:00
Ritchie 1dee840de5 Add ability to attach data source to an existing model 2013-05-23 16:38:14 -07:00
Raymond Feng 2c2768e929 Fix the mapping 2013-05-23 10:46:01 -07:00
Raymond Feng e51bd2d360 Fix the column mapping 2013-05-22 18:04:05 -07:00
Raymond Feng 31473d3add Fix the id column name 2013-05-22 12:17:14 -07:00
Raymond Feng 5b32141e31 Start to add discoverSchema and name mapping 2013-05-22 10:41:08 -07:00
Raymond Feng aebd7de68c Fix the capitalize 2013-05-21 14:54:14 -07:00
Raymond Feng 0022edb774 Transform the names 2013-05-21 14:43:25 -07:00
Raymond Feng 88f174ee39 Add discoverSchema 2013-05-21 14:25:23 -07:00
Raymond Feng fcdd8c2bca Fix the delegation for discover 2013-05-21 12:00:16 -07:00
Raymond Feng 26230be417 Fix the discover methods 2013-05-21 11:59:16 -07:00
Raymond Feng 184c190223 Bring up the schema loading from json docs 2013-05-20 16:05:59 -07:00
Raymond Feng 347147a36b Remove schema.js 2013-05-17 17:06:40 -07:00
Raymond Feng fca91e3400 Fix the on-demand connection 2013-05-17 16:21:12 -07:00
Raymond Feng 7caaeb2623 Fix the datasource.define 2013-05-17 14:41:04 -07:00
Raymond Feng 8263a6d71b Start to refactor ADL and DataSource 2013-05-17 10:54:14 -07:00
Anatoliy Chakkaev 4c717e4335 Fail uniqueness check in case of db error 2013-05-17 09:01:29 -07:00
Raymond Feng 630b991d1d Refactor the CRUD operations to DataAccessObject 2013-05-17 08:49:57 -07:00
Raymond Feng 3d82fc10b9 Fix the discover keys 2013-05-13 22:10:10 -07:00
Raymond Feng e207628538 Add discover primary/foreign keys 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev c15ff3cad0 Safer include 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev 0f040f7814 Fix Problem with DataType Text, closes #278 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev 06641da2c6 Add context info to validation error 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev ba75af1490 Only save schema props 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev 25db533827 Fix tick 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev 8370538e4e Safe connect call 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev 23004c12c1 Support define fk with class name 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev 8099f7edf2 Fix find with NaN id in base-sql 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev e13149edc5 Added skip/limit to memory adapter 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev ee05ebcca6 Relations passed to belongsTo.add 2013-05-13 22:04:29 -07:00
Anatoliy Chakkaev 504ae56acd Fix injection in ids 2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev 83027f9ead Accept related objects when creating instance #247 2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev eecbd32d07 Allow null properties for headless models 2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev a73f53521e Fix m2m: only add fk when hasMany have no "through" 2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev c9e97744dd Many-to-many relation
- hasMany {through: Class}
- hasAndBelongsToMany
- some specs in relations.test.js
2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev 9facf369b1 Some tests for scope 2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev 136ea91fbf Organize model.js 2013-05-13 22:04:28 -07:00
Anatoliy Chakkaev c4d4b68413 Datatypes casting 2013-05-13 22:04:28 -07:00
Raymond Feng 5620be1d57 Add discover methods for model names and properties 2013-04-19 14:11:52 -07:00
Raymond Feng ad1b2ad7e9 Only call the orginal method once 2013-04-16 22:25:31 -07:00
Raymond Feng 3613f6e22f Set up the connected handler before connect 2013-04-15 16:05:17 -07:00
Raymond Feng 589908a78f The connecting flag should be set to false initially 2013-04-15 16:00:08 -07:00
Anatoliy Chakkaev 3364102771 Do not assign enumerable schema to object #256 2013-04-07 00:21:42 +04:00
Anatoliy Chakkaev 2fd2157d28 Fix dates in memory adapter 2013-04-06 14:50:23 +04:00
Anatoliy Chakkaev 4943feb230 Merge transactions 2013-04-05 02:13:14 +04:00
Anatoliy Chakkaev 43d1cbd39e Merge 2013-04-05 02:12:34 +04:00
Anatoliy Chakkaev 029dfb6f3b Allow database.js to export function(compound) 2013-04-04 22:24:56 +04:00
Anatoliy Chakkaev 3a355851b6 ValidationError instead Error 2013-04-04 19:31:07 +04:00
Anatoliy Chakkaev 704bc965bd Find on hasMany scope method 2013-04-04 00:46:41 +04:00
Anatoliy Chakkaev f56cbaa150 Added map-reduce and find methods to list 2013-04-03 23:52:19 +04:00
Anatoliy Chakkaev be17763eca Return valid in case of sync validations 2013-04-01 20:13:55 +04:00
Anatoliy Chakkaev b0a1ed3bed Fix validation issue 2013-04-01 20:08:22 +04:00
Anatoliy Chakkaev cf5ed5b877 Transactions 2013-04-01 17:49:12 +04:00
Anatoliy Chakkaev 6d1e47ceaf Schemas switching 2013-03-31 16:35:26 +04:00
Anatoliy Chakkaev 76c7fbd6ec Merge branch 'http' of github.com:NiKnight/jugglingdb 2013-03-31 14:08:38 +04:00
Anatoliy Chakkaev 6449f1ca72 Fix validations 2013-03-31 13:41:02 +04:00
Anatoliy Chakkaev 0776c51994 Batch create 2013-03-31 13:40:37 +04:00
Scott Nonnenberg 2ba862f5af afterDestroy not called on adapter error
Similar to afterCreate and afterUpdate, we don't want to run the afterXXXX handlers if the delete failed according to the adapter.
2013-03-30 17:18:47 -07:00
Anatoliy Chakkaev 5b429e8d41 Fix memory adapter: broken upd attrs 2013-03-30 21:07:16 +04:00
Anatoliy Chakkaev 2f048e79c0 Return instance of object when create 2013-03-30 21:06:09 +04:00
Anatoliy Chakkaev 5540750626 Validation amends
- rename event
- pass data to hooks
- always call hooks (even when no validations set up)
2013-03-28 15:29:11 +04:00
Anatoliy Chakkaev 1f29064b3d Rewrite save and create for correct hooks order
Validation should be called first, and then all other actions
to allow modify data after validation (for example hash
password after validating length.

Issue #242
2013-03-28 15:26:51 +04:00
Anatoliy Chakkaev 48d78b71f6 Rename validation hooks
Name should be "beforeValidate" and "afterValidate"
to be consistent with other hook hames. This change doesnt break
backward compatibility
2013-03-28 15:23:31 +04:00
Anatoliy Chakkaev e75029ebbf Fix memory adapter and test 2013-03-27 17:10:13 +04:00
Anatoliy Chakkaev 2749a1f7e0 Fixes in belongsTo relation definition syntax 2013-03-27 04:48:26 +04:00
Anatoliy Chakkaev cba87ce339 Query testing: findOne 2013-03-27 00:50:13 +04:00
Anatoliy Chakkaev de28603460 Added short syntax for belongsTo 2013-03-27 00:48:14 +04:00
Anatoliy Chakkaev 58e2349575 Fix memory adapter to support lowercase desc order 2013-03-26 23:33:40 +04:00
Anatoliy Chakkaev d5d07d8806 Make tests importable 2013-03-26 04:41:00 +04:00
Anatoliy Chakkaev f76b56d2fe Another way to define belongsTo 2013-03-26 04:39:47 +04:00
Anatoliy Chakkaev 16c826bd4f Rename files 2013-03-25 01:35:08 +04:00
Anatoliy Chakkaev b59fb01b4a Upd memory adapter to work with undefined in dataset 2013-03-25 01:28:08 +04:00
Anatoliy Chakkaev 2fa07e8e1d Rename essentials 2013-03-25 01:27:36 +04:00
Anatoliy Chakkaev 5ea5da0153 Rewrite hooks API
This commit breaks compatibility, but adds consistent API and allow modify data of update
2013-03-25 01:25:10 +04:00
Anatoliy Chakkaev e0b52c6b7e Settings always set 2013-03-23 22:49:34 +04:00
Anatoliy Chakkaev a90fe8da41 Merge branch 'master' of github1602:1602/jugglingdb 2013-03-19 14:19:39 +04:00
Anatoliy Chakkaev ccffd10a58 Added filter, fix [] as type 2013-03-18 23:45:34 +04:00
Scott Nonnenberg bf3234b9f0 http adapter: pre/postProcess, fix destroy and all
preProcess() ensures that null fields are excluded from the wire. I've experienced jQuery/node/express 3.0 turning nulls into empty strings.

postProcess() ensures that Date fields are actually turned back into dates. JSON, you're annoying sometimes.

destroy() is now implemented.

all() now URL encodes any query filters provided.
2013-03-06 18:05:30 -08:00
dgsan 0503ad3295 This is the smash with blunt object fix for #215, since the more flexible #213 was rejected.
There needs to be something done so that types not in `BASE_TYPES` can be parsed without
throwing an exception and making things go nuts when they aren't JSON.

As noted this is the blunt object solution and will not cover all cases, but something needs to be done.
2013-03-05 12:02:07 -07:00
Anatoliy Chakkaev 358f7b788c FIxes in async validations (in sync case), closes 214 2013-03-01 21:13:04 +07:00
Anatoliy Chakkaev 35571dcd58 Add proper type registration 2013-02-22 01:24:20 +07:00
Anatoliy Chakkaev 56db693454 List support for non-object values 2013-02-19 16:33:09 +08:00
Anatoliy Chakkaev 4d75cb74d7 Add some array methods for List 2013-02-18 16:18:09 +08:00
Anatoliy Chakkaev a4ec751424 Eliminated global leak 2013-02-12 17:25:59 +08:00
Anatoliy Chakkaev 4eda7df7bc Described custom validations 2013-02-12 17:05:04 +08:00
Anatoliy Chakkaev 734ab8abd1 If property is array (List) need to convert it to JSON 2013-02-10 04:53:05 +08:00