move sync_dns out of cloudron route into domains

This commit is contained in:
Girish Ramakrishnan
2023-08-04 12:53:11 +05:30
parent a4c3d39cc3
commit a49cb0b080
6 changed files with 27 additions and 25 deletions

View File

@@ -19,7 +19,6 @@ exports = module.exports = {
prepareDashboardDomain,
renewCerts,
getLanguages,
syncDnsRecords,
getSystemGraphs,
getPlatformStatus,
getBlockDevices,
@@ -289,19 +288,6 @@ async function getLanguages(req, res, next) {
next(new HttpSuccess(200, { languages }));
}
async function syncDnsRecords(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
if ('domain' in req.body && typeof req.body.domain !== 'string') return next(new HttpError(400, 'domain must be a string'));
if ('type' in req.body && typeof req.body.type !== 'string') return next(new HttpError(400, 'type must be a string'));
const [error, taskId] = await safe(cloudron.syncDnsRecords(req.body));
if (error && error.reason === BoxError.ACCESS_DENIED) return next(new HttpSuccess(200, { error: { reason: error.reason, message: error.message }}));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(201, { taskId }));
}
async function getSystemGraphs(req, res, next) {
if (!req.query.fromMinutes || !parseInt(req.query.fromMinutes)) return next(new HttpError(400, 'fromMinutes must be a number'));