2020-04-28 12:07:04 -04:00
|
|
|
'use strict';
|
|
|
|
|
|
2020-10-15 12:12:01 -04:00
|
|
|
const api = require('../../api');
|
2020-04-28 12:07:04 -04:00
|
|
|
|
|
|
|
|
const helpers = require('../helpers');
|
|
|
|
|
|
|
|
|
|
const Groups = module.exports;
|
|
|
|
|
|
2020-11-06 12:18:42 -05:00
|
|
|
Groups.exists = async (req, res) => {
|
|
|
|
|
helpers.formatApiResponse(200, res);
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-28 12:07:04 -04:00
|
|
|
Groups.create = async (req, res) => {
|
2020-10-15 12:12:01 -04:00
|
|
|
const groupObj = await api.groups.create(req, req.body);
|
2020-04-28 12:07:04 -04:00
|
|
|
helpers.formatApiResponse(200, res, groupObj);
|
|
|
|
|
};
|
|
|
|
|
|
2020-12-21 22:05:00 -05:00
|
|
|
Groups.update = async (req, res) => {
|
|
|
|
|
const groupObj = await api.groups.update(req, {
|
|
|
|
|
...req.body,
|
|
|
|
|
slug: req.params.slug,
|
|
|
|
|
});
|
|
|
|
|
helpers.formatApiResponse(200, res, groupObj);
|
|
|
|
|
};
|
|
|
|
|
|
2020-10-01 14:11:59 -04:00
|
|
|
Groups.delete = async (req, res) => {
|
2020-10-15 16:36:53 -04:00
|
|
|
await api.groups.delete(req, req.params);
|
2020-10-01 14:11:59 -04:00
|
|
|
helpers.formatApiResponse(200, res);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Groups.join = async (req, res) => {
|
2020-10-15 16:13:19 -04:00
|
|
|
await api.groups.join(req, req.params);
|
2020-10-01 14:11:59 -04:00
|
|
|
helpers.formatApiResponse(200, res);
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-30 21:36:04 -04:00
|
|
|
Groups.leave = async (req, res) => {
|
2020-10-15 17:29:38 -04:00
|
|
|
await api.groups.leave(req, req.params);
|
2020-04-30 21:36:04 -04:00
|
|
|
helpers.formatApiResponse(200, res);
|
|
|
|
|
};
|
2020-12-22 14:26:31 -05:00
|
|
|
|
|
|
|
|
Groups.grant = async (req, res) => {
|
|
|
|
|
await api.groups.grant(req, req.params);
|
|
|
|
|
helpers.formatApiResponse(200, res);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Groups.rescind = async (req, res) => {
|
|
|
|
|
await api.groups.rescind(req, req.params);
|
|
|
|
|
helpers.formatApiResponse(200, res);
|
|
|
|
|
};
|