Add config page
This commit is contained in:
1 parent
1e41c72d60
commit
498947bc4a
11 files changed
+372
-7
No files matched your search
@@ -187,6 +187,38 @@ export function count(resource, filter) {
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteConfig(id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getClient()
|
||||
.then(client => {
|
||||
const collection = client
|
||||
.db()
|
||||
.collection(RESOURCE_COLLECTION["config"] || "config");
|
||||
collection.deleteOne({ _id: id }, err => {
|
||||
if (err) return void reject(err);
|
||||
resolve();
|
||||
});
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
export function putConfig(id, object) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getClient()
|
||||
.then(client => {
|
||||
const collection = client
|
||||
.db()
|
||||
.collection(RESOURCE_COLLECTION["config"] || "config");
|
||||
collection.replaceOne({ _id: id }, object, { upsert: true }, err => {
|
||||
if (err) return void reject(err);
|
||||
resolve();
|
||||
});
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
export function disconnect() {
|
||||
if (_clientPromise) {
|
||||
_clientPromise.then(client => {
|
||||
|
||||
Reference in new issue
Block a user