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:
parent
0aa687624d
commit
b6082f1216
1 changed files with 22 additions and 7 deletions
29
lib/index.js
29
lib/index.js
|
@ -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,13 +170,27 @@ module.exports = function(config_hash) {
|
|||
}));
|
||||
}
|
||||
|
||||
storage.add_package(name, metadata, function(err) {
|
||||
if (err) return next(err);
|
||||
res.status(201);
|
||||
return res.send({
|
||||
ok: 'created new package'
|
||||
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);
|
||||
return res.send({
|
||||
ok: 'created new package'
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// unpublishing an entire package
|
||||
|
|
Loading…
Reference in a new issue