moved to a DummySync for all models

We want to implement Syncable, for the destroy() and toJSON() methods,
and that requires we add a Sync to use them (else destroy() will throw an
error trying to find the sync to use).

We also don't want to currently use the ServerSync, since the new API isn't
in place. So Dummy it is!
This commit is contained in:
Sean McArthur 2011-10-28 11:09:44 -05:00
Родитель c4ed7c21db
Коммит ed8b399d5c
5 изменённых файлов: 16 добавлений и 11 удалений

Просмотреть файл

@ -1,6 +1,6 @@
var Class = require('shipyard/class/Class'), var Class = require('shipyard/class/Class'),
fields = require('shipyard/model/fields'), fields = require('shipyard/model/fields'),
ServerSync = require('shipyard/sync/Server'), DummySync = require('shipyard/sync/Dummy'),
File = require('./File'); File = require('./File');
@ -11,8 +11,7 @@ module.exports = new Class({
Sync: { Sync: {
'default': { 'default': {
driver: ServerSync, driver: DummySync
route: '/api/0/attachments'
} }
}, },

Просмотреть файл

@ -2,6 +2,7 @@ var Class = require('shipyard/class/Class'),
Model = require('shipyard/model/Model'), Model = require('shipyard/model/Model'),
fields = require('shipyard/model/fields'), fields = require('shipyard/model/fields'),
Syncable = require('shipyard/sync/Syncable'), Syncable = require('shipyard/sync/Syncable'),
DummySync = require('shipyard/sync/Dummy'),
string = require('shipyard/utils/string'); string = require('shipyard/utils/string');
var Folder = module.exports = new Class({ var Folder = module.exports = new Class({
@ -10,7 +11,14 @@ var Folder = module.exports = new Class({
Implements: Syncable, Implements: Syncable,
Sync: {
'default': {
driver: DummySync
}
},
fields: { fields: {
id: fields.NumberField(),
name: fields.TextField({ required: true }), name: fields.TextField({ required: true }),
root_dir: fields.TextField({ required: true }) //ChoiceField root_dir: fields.TextField({ required: true }) //ChoiceField
}, },

Просмотреть файл

@ -1,7 +1,7 @@
var Class = require('shipyard/class/Class'), var Class = require('shipyard/class/Class'),
File = require('./File'), File = require('./File'),
fields = require('shipyard/model/fields'), fields = require('shipyard/model/fields'),
ServerSync = require('shipyard/sync/Server'), DummySync = require('shipyard/sync/Dummy'),
Request = require('shipyard/http/Request'); Request = require('shipyard/http/Request');
module.exports = new Class({ module.exports = new Class({
@ -10,7 +10,7 @@ module.exports = new Class({
Sync: { Sync: {
'default': { 'default': {
driver: ServerSync, driver: DummySync,
route: '/api/0/modules' route: '/api/0/modules'
} }
}, },

Просмотреть файл

@ -2,7 +2,7 @@ var Class = require('shipyard/class/Class'),
Model = require('shipyard/model/Model'), Model = require('shipyard/model/Model'),
fields = require('shipyard/model/fields'), fields = require('shipyard/model/fields'),
Syncable = require('shipyard/sync/Syncable'), Syncable = require('shipyard/sync/Syncable'),
ServerSync = require('shipyard/sync/Server'); DummySync = require('shipyard/sync/Dummy');
var Package = module.exports = new Class({ var Package = module.exports = new Class({
@ -12,8 +12,7 @@ var Package = module.exports = new Class({
Sync: { Sync: {
'default': { 'default': {
driver: ServerSync, driver: DummySync
route: '/api/0/packages'
} }
}, },

Просмотреть файл

@ -2,7 +2,7 @@ var Class = require('shipyard/class/Class'),
Model = require('shipyard/model/Model'), Model = require('shipyard/model/Model'),
fields = require('shipyard/model/fields'), fields = require('shipyard/model/fields'),
Syncable = require('shipyard/sync/Syncable'), Syncable = require('shipyard/sync/Syncable'),
ServerSync = require('shipyard/sync/Server'); DummySync = require('shipyard/sync/Dummy');
module.exports = new Class({ module.exports = new Class({
@ -12,8 +12,7 @@ module.exports = new Class({
Sync: { Sync: {
'default': { 'default': {
driver: ServerSync, driver: DummySync
route: '/api/0/packagerevisions'
} }
}, },