apps: add icon and appStoreIcon to database

This commit is contained in:
Girish Ramakrishnan
2021-04-30 13:18:15 -07:00
parent 64414eb932
commit 0062e6d9fe
7 changed files with 99 additions and 81 deletions

View File

@@ -93,10 +93,10 @@ function getApps(req, res, next) {
function getAppIcon(req, res, next) {
assert.strictEqual(typeof req.resource, 'object');
apps.getIconPath(req.resource, { original: req.query.original }, function (error, iconPath) {
apps.getIcon(req.resource, { original: req.query.original }, function (error, icon) {
if (error) return next(BoxError.toHttpError(error));
res.sendFile(iconPath);
res.send(icon);
});
}
@@ -214,7 +214,7 @@ function setIcon(req, res, next) {
if (req.body.icon !== null && typeof req.body.icon !== 'string') return next(new HttpError(400, 'icon is null or a base-64 image string'));
apps.setIcon(req.resource, req.body.icon, auditSource.fromRequest(req), function (error) {
apps.setIcon(req.resource, req.body.icon || null /* empty string means null */, auditSource.fromRequest(req), function (error) {
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, {}));