Add config page
This commit is contained in:
1 parent
1e41c72d60
commit
498947bc4a
11 files changed
+372
-7
No files matched your search
@@ -5,6 +5,7 @@ import https from "https";
|
||||
import url from "url";
|
||||
import * as config from "../config";
|
||||
import * as db from "./db";
|
||||
import * as cache from "../cache";
|
||||
import * as mongodbFunctions from "./mongodb-functions";
|
||||
|
||||
export function filterToMongoQuery(filter, negate = false, res = {}) {
|
||||
@@ -67,6 +68,18 @@ export function filterToMongoQuery(filter, negate = false, res = {}) {
|
||||
|
||||
export function deleteResource(resource, id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (resource === "config") {
|
||||
db.deleteConfig(id)
|
||||
.then(() => {
|
||||
cache.del("presets_hash", err => {
|
||||
if (err) return void reject(err);
|
||||
resolve();
|
||||
});
|
||||
})
|
||||
.catch(reject);
|
||||
return;
|
||||
}
|
||||
|
||||
const resourceUrl =
|
||||
resource === "virtualParameters" ? "virtual_parameters" : resource;
|
||||
const options = url.parse(
|
||||
@@ -296,6 +309,18 @@ export function ping(host) {
|
||||
|
||||
export function putResource(resource, id, data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (resource === "config") {
|
||||
db.putConfig(id, data)
|
||||
.then(() => {
|
||||
cache.del("presets_hash", err => {
|
||||
if (err) return void reject(err);
|
||||
resolve();
|
||||
});
|
||||
})
|
||||
.catch(reject);
|
||||
return;
|
||||
}
|
||||
|
||||
const resourceUrl =
|
||||
resource === "virtualParameters" ? "virtual_parameters" : resource;
|
||||
const options = url.parse(
|
||||
|
||||
Reference in new issue
Block a user