Commit Graph

397 Commits

Author SHA1 Message Date
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
dgsan cba174b4ff This fixes the apparent scope and comparison issues when calling a foreign key relation. 2013-02-01 10:15:03 -07:00
Anatoliy Chakkaev cdd328c902 Revert validatable fix 2013-01-30 23:08:52 +07:00
Anatoliy Chakkaev 9f0dfeb58a Add attr param to custom validator, closes #200 2013-01-30 22:30:31 +07:00
Anatoliy Chakkaev 5b33c2a0f1 Removed unused experimental stuff 2013-01-29 18:47:03 +07:00
Anatoliy Chakkaev 707fb01713 Make pathTo available in db/schema 2013-01-23 06:31:02 +07:00
Anatoliy Chakkaev 59e80e8454 Fix uniqueness validation (mongo ids) 2013-01-23 03:22:48 +07:00
Anatoliy Chakkaev d03dbfcb99 Throw error when model is not configured for webservice 2013-01-23 03:22:31 +07:00
Anatoliy Chakkaev cefd79dbf6 Return null when findOne could not find record, closes #128 2013-01-22 23:47:14 +07:00
Anatoliy Chakkaev 8cfa00a1b2 Work with cs-compound 2013-01-22 23:27:49 +07:00
Anatoliy Chakkaev 0f592d4bf5 Implement schema.extendModel, closes #157 2013-01-22 01:48:04 +07:00
Anatoliy Chakkaev 91fee1d565 Make memory adapter async 2013-01-22 01:21:43 +07:00
Anatoliy Chakkaev 9dbc8fa50b Implement findOrCreate, requested in #190 2013-01-22 01:21:31 +07:00
Anatoliy Chakkaev 4d47d8348d Revert hasMany change 2013-01-21 23:08:13 +07:00
Anatoliy Chakkaev 1010d5d64d Merge pull request #192 from robblovell/hasmany
Hasmany
2013-01-21 07:42:01 -08:00
Anatoliy Chakkaev d5758ec8be Added schema::model::set for railway 2013-01-21 20:29:41 +07:00
Anatoliy Chakkaev 02b7f707ff Added http (WebService) adapter 2013-01-20 23:05:45 +07:00
Anatoliy Chakkaev e9b7e89ee9 Accept adapter as first argument of Schema constructor 2013-01-19 20:50:53 +07:00
Erin Noe-Payne d4043d715f fix lost callback 2013-01-18 12:31:49 -05:00
Robb Lovell 6f9c495720 added 'all' method to hasMany in abstract-class.js to correctly support a 'many' collection. added .idea to .gitignore to ignore WebStorm projects. 2013-01-17 11:16:52 -08:00
Asp3ctus 4f7ffb903e fix typo :) 2013-01-08 15:37:58 +06:00
Asp3ctus c78a4de375 app.enable('autoupdate') option support 2013-01-08 15:34:59 +06:00
Anatoliy Chakkaev c7409be559 Fix for reading yml files 2012-12-24 22:17:23 +04:00
Anatoliy Chakkaev e8ef71c431 Only update id if it does not present in resulting dataset 2012-12-24 00:31:32 +04:00
Anatoliy Chakkaev 05a6d686aa Strict adapter checking 2012-12-21 18:26:21 +04:00
Anatoliy Chakkaev 3dc24b8f51 Merge branch 'master' of github.com:1602/jugglingdb 2012-12-21 12:56:45 +04:00
Anatoliy Chakkaev 3038eb33fd Do not throw on missing adapter, just display warning 2012-12-21 12:56:16 +04:00
Sascha Gehlich 7ec8ab55d1 updateAttributes data defaults to {} 2012-12-19 19:29:14 +01:00
Anatoliy Chakkaev 0d433c1c5d merge 2012-12-19 19:00:00 +04:00
Anatoliy Chakkaev acc0a71bde Update railwayjs name, add ability to skip tests 2012-12-19 18:57:21 +04:00
Anatoliy Chakkaev 3c4fd78014 Merge pull request #177 from saschagehlich/js_config
allow database.js config
2012-12-17 01:30:21 -08:00
Sascha Gehlich 252a067df7 allow database.js config 2012-12-17 10:25:27 +01:00
Sébastien Drouyer 519d6cf7fb Merge github.com:1602/jugglingdb 2012-12-16 23:58:53 +01:00
Sébastien Drouyer fbe04233cc added some documentation for include and all function 2012-12-16 19:44:14 +01:00
Sébastien Drouyer 6db1a003d4 cleaned some old comments 2012-12-16 19:19:53 +01:00
Anatoliy Chakkaev bc250b1bb2 Merge pull request #169 from saschagehlich/schema_wait_connect
let the adapter decide when to load the schema
2012-12-16 10:10:04 -08:00
Sébastien Drouyer 708265df22 merged + removed preprocessdata callback as it seems it isn't usefull 2012-12-16 18:58:52 +01:00
Sébastien Drouyer 175ad3141d small fix on relations 2012-12-16 18:20:39 +01:00
Sébastien Drouyer c6bddf170a added include functionnality to abstract class and mysql 2012-12-16 18:05:36 +01:00
Sascha Gehlich 53e2dcf30b add additional types stored in Schema.types to schema context 2012-12-16 14:29:53 +01:00
Sascha Gehlich ed8ff0ca36 let the adapter decide when to load the schema 2012-12-16 14:08:51 +01:00
Anatoliy Chakkaev 5208298a67 Fix broken yml config, closes #159 2012-12-15 16:05:32 +04:00
Sébastien Drouyer 24ccb0ffc2 added relations key 2012-12-14 16:28:29 +01:00
Anatoliy Chakkaev 100b5322c6 Remove sql adapters and tests 2012-12-14 19:25:32 +04:00
Anatoliy Chakkaev 91c90ef3ad Remove sqlite3 adapter 2012-12-14 17:12:13 +04:00
Anatoliy Chakkaev a62aab180d Removed nosql adapters (moved to own repos) 2012-12-14 01:50:02 +04:00
Tim Griesser fe4f19106a allow socketPath for mysql config 2012-12-12 15:16:23 -05:00
Anatoliy Chakkaev 91cde064a6 Merge branch 'master' of github.com:1602/jugglingdb 2012-12-10 17:48:55 +04:00
Anatoliy Chakkaev f929272fa3 Fix cradle+railwayjs 2012-12-10 17:48:22 +04:00
Nicholas Westlake 85535dc955 added nano adapter 2012-12-09 03:13:09 -06:00
Dominik Krejcik 035c42eb9d Log Redis connection errors instead of crashing 2012-11-29 01:33:19 +00:00
Anatoliy Chakkaev c252926f34 Docs and style in lib/list 2012-11-20 18:37:04 +07:00
Anatoliy Chakkaev b3ce33805c Namespace adapters 2012-11-14 11:29:29 +07:00
Muneeb Samuels fa50e0e5e8 when using cradle if we don't wait for the schema to be connected, the models fails to load correctly. 2012-11-10 20:14:13 +02:00
Anatoliy Chakkaev cb9f0c3d16 Better docs, no warning 2012-11-10 09:28:07 +04:00
Nathan Cartwright 596cd3d461 update mongodb adapter 2012-11-08 14:54:36 -06:00
Anatoliy Chakkaev 3731447787 Merge branch 'master' of github.com:1602/jugglingdb 2012-11-06 19:53:04 +04:00
Anatoliy Chakkaev 47d72ce14e Cast id to string before creation, fix #145 2012-11-06 19:52:37 +04:00
Anatoliy Chakkaev fb075fdd97 Merge pull request #144 from muneebs/master
update cradle.js
2012-11-05 09:09:39 -08:00
taiyoh 30e9983abf remove commentouted source 2012-11-05 22:30:57 +09:00
taiyoh 885e9188f8 fixed type check strictly 2012-11-05 22:22:47 +09:00
Anatoliy Chakkaev e10c42ed1b Fix id:null issue #98 2012-11-05 08:08:32 +04:00
Muneeb Samuels 75c96bdaa9 - fixed typo in updateOrCreate method. 2012-11-04 22:24:15 +02:00
Muneeb Samuels d248de7f9d - added views to do .all queries, it speeds up the query. 2012-11-04 22:22:00 +02:00
Muneeb Samuels 53272e6fd6 Merge remote-tracking branch 'origin/master'
Conflicts:
	lib/adapters/cradle.js
2012-11-04 21:30:42 +02:00
Muneeb Samuels a3f30a112a - fixed typo in updateOrCreate method.
- added views to do .all queries, it speeds up the query.
2012-11-04 21:30:08 +02:00
Anatoliy Chakkaev 0c24dfa035 Merge pull request #141 from sdrdis/master
Added caching in relationships (+ test cases) (enhanced)
2012-11-02 19:20:09 -07:00
Sébastien Drouyer 8f41fdf90d fixed indentation + adapted to markdown syntax 2012-11-03 02:05:27 +01:00
Sébastien Drouyer 5aa0efd818 corrected indentation issues 2012-11-03 01:56:53 +01:00
Sébastien Drouyer fe8ed86301 small sentence fixes + added usage examples in belongsTo comments 2012-11-03 01:39:35 +01:00
Sébastien Drouyer 46b7747c87 fixed and enhanced caching in getters and setters in abstract-class 2012-11-01 01:13:16 +01:00
Muneeb Samuels 6f973f9fa5 cradle adapter update
using views speeds up the query by only fetching the documents for the model being queried.
2012-10-31 01:34:39 +02:00
Muneeb Samuels 2cc1896864 using views speeds up the query by only fetching the documents for the model being queried. 2012-10-31 01:30:55 +02:00
Anatoliy Chakkaev 83695513f9 Globally published models for railway 1.0 2012-10-30 03:41:45 +04:00
Sébastien Drouyer 0633737ac7 added caching functionnality 2012-10-30 00:37:19 +01:00
Anatoliy Chakkaev e0f5f18774 Models publishing for both railway stable and unstable 2012-10-29 22:22:40 +04:00