2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-08-30 13:47:54 +00:00

Added groups store

This commit is contained in:
GingerPlusPlus
2017-09-22 17:12:39 +02:00
parent 19fffbd80d
commit 8c9457cd8c

28
stores/groups.js Normal file
View File

@@ -0,0 +1,28 @@
'use strict';
const Datastore = require('nedb-promise');
const groups = new Datastore({
autoload: true,
filename: 'data/groups.db',
});
groups.ensureIndex({
fieldName: 'id',
unique: true,
});
const addGroup = group =>
groups.insert(group);
const listGroups = () =>
groups.find({});
const managesGroup = group =>
groups.findOne({ id: group.id });
module.exports = {
addGroup,
listGroups,
managesGroup,
};