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:
28
stores/groups.js
Normal file
28
stores/groups.js
Normal 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,
|
||||
};
|
Reference in New Issue
Block a user