move dashboard change routes under dashboard/

This commit is contained in:
Girish Ramakrishnan
2023-08-13 10:06:01 +05:30
parent 7b32cb16f3
commit e723c3c19b
9 changed files with 134 additions and 135 deletions

View File

@@ -3,9 +3,6 @@
exports = module.exports = {
getStatus,
updateDashboardDomain,
prepareDashboardDomain,
listLanguages,
getLanguage,
setLanguage,
@@ -15,7 +12,6 @@ exports = module.exports = {
};
const assert = require('assert'),
AuditSource = require('../auditsource.js'),
BoxError = require('../boxerror.js'),
cloudron = require('../cloudron.js'),
HttpError = require('connect-lastmile').HttpError,
@@ -30,24 +26,6 @@ async function getStatus(req, res, next) {
next(new HttpSuccess(200, status));
}
async function updateDashboardDomain(req, res, next) {
if (!req.body.domain || typeof req.body.domain !== 'string') return next(new HttpError(400, 'domain must be a string'));
const [error] = await safe(cloudron.updateDashboardDomain(req.body.domain, AuditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(204, {}));
}
async function prepareDashboardDomain(req, res, next) {
if (!req.body.domain || typeof req.body.domain !== 'string') return next(new HttpError(400, 'domain must be a string'));
const [error, taskId] = await safe(cloudron.prepareDashboardDomain(req.body.domain, AuditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(202, { taskId }));
}
async function listLanguages(req, res, next) {
const [error, languages] = await safe(translation.listLanguages());
if (error) return next(new BoxError.toHttpError(error));