0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

some work towards unpublishing packages

This commit is contained in:
Alex Kocharin 2013-10-11 09:32:12 +04:00
parent 0aa687624d
commit b6082f1216

View file

@ -149,7 +149,8 @@ module.exports = function(config_hash) {
});
// publishing a package
app.put('/:package', can('publish'), media('application/json'), expect_json, function(req, res, next) {
app.put('/:package/:_rev?/:revision?', can('publish'), media('application/json'), expect_json, function(req, res, next) {
if (req.params._rev != null && req.params._rev != '-rev') return next('route');
var name = req.params.package;
if (Object.keys(req.body).length == 1 && typeof(req.body.users) === 'object') {
@ -169,6 +170,19 @@ module.exports = function(config_hash) {
}));
}
if (req.params._rev) {
return next(new UError({
status: 404,
msg: 'unimplemented yet, work in progress',
}));
/* storage.change_package(name, metadata, req.params.revision, function(err) {
if (err) return next(err);
res.status(201);
return res.send({
ok: 'package changed'
});
});*/
} else {
storage.add_package(name, metadata, function(err) {
if (err) return next(err);
res.status(201);
@ -176,6 +190,7 @@ module.exports = function(config_hash) {
ok: 'created new package'
});
});
}
});
// unpublishing an entire package