style: remove -> del
This commit is contained in:
@@ -23,7 +23,7 @@ mkdir -p ${DATA_DIR}
|
||||
cd ${DATA_DIR}
|
||||
mkdir -p appsdata
|
||||
mkdir -p boxdata/box boxdata/mail boxdata/certs boxdata/mail/dkim/localhost boxdata/mail/dkim/foobar.com
|
||||
mkdir -p platformdata/addons/mail/banner platformdata/nginx/cert platformdata/nginx/applications/dashboard platformdata/collectd/collectd.conf.d platformdata/addons platformdata/logrotate.d platformdata/backup platformdata/logs/tasks platformdata/sftp/ssh platformdata/firewall platformdata/update
|
||||
mkdir -p platformdata/addons/mail/banner platformdata/nginx/cert platformdata/nginx/applications/dashboard platformdata/collectd/collectd.conf.d platformdata/addons platformdata/logrotate.d platformdata/backup platformdata/logs/tasks platformdata/sftp/ssh platformdata/firewall platformdata/update platformdata/diskusage
|
||||
sudo mkdir -p /mnt/cloudron-test-music /media/cloudron-test-music # volume test
|
||||
|
||||
# put cert
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@ exports = module.exports = {
|
||||
add,
|
||||
get,
|
||||
update,
|
||||
remove,
|
||||
del,
|
||||
getIcon
|
||||
};
|
||||
|
||||
@@ -193,7 +193,7 @@ async function update(applinkId, applink) {
|
||||
|
||||
debug(`update: ${applink.upstreamUri}`);
|
||||
|
||||
let error = validateUpstreamUri(applink.upstreamUri);
|
||||
const error = validateUpstreamUri(applink.upstreamUri);
|
||||
if (error) throw error;
|
||||
|
||||
if (applink.icon) {
|
||||
@@ -217,7 +217,7 @@ async function update(applinkId, applink) {
|
||||
if (result.affectedRows !== 1) throw new BoxError(BoxError.NOT_FOUND, 'Applink not found');
|
||||
}
|
||||
|
||||
async function remove(applinkId) {
|
||||
async function del(applinkId) {
|
||||
assert.strictEqual(typeof applinkId, 'string');
|
||||
|
||||
const result = await database.query('DELETE FROM applinks WHERE id = ?', [ applinkId ]);
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
|
||||
exports = module.exports = {
|
||||
add,
|
||||
remove,
|
||||
del,
|
||||
get,
|
||||
getByName,
|
||||
|
||||
@@ -80,11 +80,11 @@ async function add(group) {
|
||||
return { id, name, source };
|
||||
}
|
||||
|
||||
async function remove(id) {
|
||||
async function del(id) {
|
||||
assert.strictEqual(typeof id, 'string');
|
||||
|
||||
// also cleanup the groupMembers table
|
||||
let queries = [];
|
||||
const queries = [];
|
||||
queries.push({ query: 'DELETE FROM groupMembers WHERE groupId = ?', args: [ id ] });
|
||||
queries.push({ query: 'DELETE FROM userGroups WHERE id = ?', args: [ id ] });
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ exports = module.exports = {
|
||||
add,
|
||||
get,
|
||||
update,
|
||||
remove,
|
||||
del,
|
||||
getIcon
|
||||
};
|
||||
|
||||
@@ -71,10 +71,10 @@ async function update(req, res, next) {
|
||||
next(new HttpSuccess(202, {}));
|
||||
}
|
||||
|
||||
async function remove(req, res, next) {
|
||||
async function del(req, res, next) {
|
||||
assert.strictEqual(typeof req.params.id, 'string');
|
||||
|
||||
const [error] = await safe(applinks.remove(req.params.id));
|
||||
const [error] = await safe(applinks.del(req.params.id));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(204));
|
||||
|
||||
@@ -7,7 +7,7 @@ exports = module.exports = {
|
||||
list,
|
||||
add,
|
||||
setName,
|
||||
remove,
|
||||
del,
|
||||
setMembers
|
||||
};
|
||||
|
||||
@@ -78,10 +78,10 @@ async function list(req, res, next) {
|
||||
next(new HttpSuccess(200, { groups: result }));
|
||||
}
|
||||
|
||||
async function remove(req, res, next) {
|
||||
async function del(req, res, next) {
|
||||
assert.strictEqual(typeof req.params.groupId, 'string');
|
||||
|
||||
const [error] = await safe(groups.remove(req.params.groupId));
|
||||
const [error] = await safe(groups.del(req.params.groupId));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(204));
|
||||
|
||||
+2
-2
@@ -211,7 +211,7 @@ async function initializeExpressSync() {
|
||||
router.get ('/api/v1/groups/:groupId', token, authorizeUserManager, routes.groups.load, routes.groups.get);
|
||||
router.put ('/api/v1/groups/:groupId/members', json, token, authorizeUserManager, routes.groups.load, routes.groups.setMembers);
|
||||
router.put ('/api/v1/groups/:groupId/name', json, token, authorizeUserManager, routes.groups.load, routes.groups.setName);
|
||||
router.del ('/api/v1/groups/:groupId', token, authorizeUserManager, routes.groups.load, routes.groups.remove);
|
||||
router.del ('/api/v1/groups/:groupId', token, authorizeUserManager, routes.groups.load, routes.groups.del);
|
||||
|
||||
// User directory
|
||||
router.get ('/api/v1/user_directory/profile_config', token, authorizeAdmin, routes.userDirectory.getProfileConfig);
|
||||
@@ -300,7 +300,7 @@ async function initializeExpressSync() {
|
||||
router.post('/api/v1/applinks', json, token, authorizeAdmin, routes.applinks.add);
|
||||
router.get ('/api/v1/applinks/:id', token, authorizeAdmin, routes.applinks.get);
|
||||
router.post('/api/v1/applinks/:id', json, token, authorizeAdmin, routes.applinks.update);
|
||||
router.del ('/api/v1/applinks/:id', token, authorizeAdmin, routes.applinks.remove);
|
||||
router.del ('/api/v1/applinks/:id', token, authorizeAdmin, routes.applinks.del);
|
||||
router.get ('/api/v1/applinks/:id/icon', token, authorizeUser, routes.applinks.getIcon);
|
||||
|
||||
// branding routes
|
||||
|
||||
@@ -112,14 +112,14 @@ describe('Applinks', function () {
|
||||
expect(result.toString('base64')).to.eql(APPLINK_1.icon);
|
||||
});
|
||||
|
||||
it('cannot remove applink with wrong id', async function () {
|
||||
const [error] = await safe(applinks.remove('doesnotexist'));
|
||||
it('cannot del applink with wrong id', async function () {
|
||||
const [error] = await safe(applinks.del('doesnotexist'));
|
||||
expect(error).to.be.a(BoxError);
|
||||
expect(error.reason).to.eql(BoxError.NOT_FOUND);
|
||||
});
|
||||
|
||||
it('can remove applink', async function () {
|
||||
await applinks.remove(APPLINK_0.id);
|
||||
it('can del applink', async function () {
|
||||
await applinks.del(APPLINK_0.id);
|
||||
|
||||
const result = await applinks.get(APPLINK_0.id);
|
||||
expect(result).to.be(null);
|
||||
|
||||
@@ -172,13 +172,13 @@ describe('Groups', function () {
|
||||
|
||||
describe('delete', function () {
|
||||
it('cannot delete invalid group', async function () {
|
||||
const [error] = await safe(groups.remove('random'));
|
||||
const [error] = await safe(groups.del('random'));
|
||||
expect(error.reason).to.be(BoxError.NOT_FOUND);
|
||||
});
|
||||
|
||||
it('can delete valid group', async function () {
|
||||
await groups.setMembers(group0Object, [ admin.id, user.id ], {}); // ensure group has some members
|
||||
await groups.remove(group0Object.id);
|
||||
await groups.del(group0Object.id);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user