mirror of
https://github.com/zhigang1992/deployd.git
synced 2026-06-05 06:40:37 +08:00
added collection renaming
This commit is contained in:
@@ -20,6 +20,17 @@ module.exports =
|
||||
, errs = []
|
||||
;
|
||||
|
||||
end(function (req, res, next) {
|
||||
if(!collectionPath) return next();
|
||||
|
||||
console.log('rename to', collectionPath.replace('/', ''));
|
||||
|
||||
collection.use(collectionPath).rename(collectionPath.replace('/', ''), function (err) {
|
||||
next(err);
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
properties && Object.keys(properties).forEach(function (key) {
|
||||
prop = properties[key];
|
||||
rename = prop.$renameFrom;
|
||||
|
||||
@@ -62,6 +62,26 @@ describe('Application Resource Types', function(){
|
||||
})
|
||||
})
|
||||
|
||||
describe('PUT /resources/<ObjectID>', function(){
|
||||
it('should rename the resource collection', function(done) {
|
||||
resources.get(function (e, all) {
|
||||
var res = all[0];
|
||||
res.path = '/tasks';
|
||||
|
||||
todos.post({title: 'foo'}, function () {
|
||||
resources.use('/' + res._id).put(res, function (err, upd) {
|
||||
unauthed.use('/tasks').get(function (ee, r) {
|
||||
expect(r).to.exist;
|
||||
client.use('/tasks').del(function () {
|
||||
done(ee || e || err);
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('PUT /resources/<ObjectID>', function(){
|
||||
it('should rename change properties on any existing data', function(done) {
|
||||
var exTodo = {title: 'feed fido', completed: true};
|
||||
|
||||
Reference in New Issue
Block a user