lint
This commit is contained in:
@@ -12,14 +12,14 @@ exports = module.exports = {
|
|||||||
|
|
||||||
const assert = require('assert'),
|
const assert = require('assert'),
|
||||||
apps = require('./apps.js'),
|
apps = require('./apps.js'),
|
||||||
database = require('./database.js'),
|
|
||||||
BoxError = require('./boxerror.js'),
|
BoxError = require('./boxerror.js'),
|
||||||
uuid = require('uuid'),
|
database = require('./database.js'),
|
||||||
|
debug = require('debug')('box:applinks'),
|
||||||
|
jsdom = require('jsdom'),
|
||||||
safe = require('safetydance'),
|
safe = require('safetydance'),
|
||||||
superagent = require('superagent'),
|
superagent = require('superagent'),
|
||||||
validator = require('validator'),
|
uuid = require('uuid'),
|
||||||
jsdom = require('jsdom'),
|
validator = require('validator');
|
||||||
debug = require('debug')('box:applinks');
|
|
||||||
|
|
||||||
const APPLINKS_FIELDS= [ 'id', 'accessRestrictionJson', 'creationTime', 'updateTime', 'ts', 'label', 'tagsJson', 'icon', 'upstreamUri' ].join(',');
|
const APPLINKS_FIELDS= [ 'id', 'accessRestrictionJson', 'creationTime', 'updateTime', 'ts', 'label', 'tagsJson', 'icon', 'upstreamUri' ].join(',');
|
||||||
|
|
||||||
@@ -144,8 +144,6 @@ async function update(applinkId, applink) {
|
|||||||
assert.strictEqual(typeof applink, 'object');
|
assert.strictEqual(typeof applink, 'object');
|
||||||
assert.strictEqual(typeof applink.upstreamUri, 'string');
|
assert.strictEqual(typeof applink.upstreamUri, 'string');
|
||||||
|
|
||||||
debug(`update: ${applinkId} ${applink.upstreamUri}`, applink);
|
|
||||||
|
|
||||||
if (applink.icon) {
|
if (applink.icon) {
|
||||||
if (!validator.isBase64(applink.icon)) throw new BoxError(BoxError.BAD_FIELD, 'icon is not base64');
|
if (!validator.isBase64(applink.icon)) throw new BoxError(BoxError.BAD_FIELD, 'icon is not base64');
|
||||||
applink.icon = Buffer.from(applink.icon, 'base64');
|
applink.icon = Buffer.from(applink.icon, 'base64');
|
||||||
@@ -163,9 +161,7 @@ async function update(applinkId, applink) {
|
|||||||
async function remove(applinkId) {
|
async function remove(applinkId) {
|
||||||
assert.strictEqual(typeof applinkId, 'string');
|
assert.strictEqual(typeof applinkId, 'string');
|
||||||
|
|
||||||
debug(`remove: ${applinkId}`);
|
const result = await database.query('DELETE FROM applinks WHERE id = ?', [ applinkId ]);
|
||||||
|
|
||||||
const result = await database.query(`DELETE FROM applinks WHERE id = ?`, [ applinkId ]);
|
|
||||||
if (result.affectedRows !== 1) throw new BoxError(BoxError.NOT_FOUND, 'Applink not found');
|
if (result.affectedRows !== 1) throw new BoxError(BoxError.NOT_FOUND, 'Applink not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user