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);
|
|
|
|
|
};
|
2023-03-30 15:46:40 -04:00
|
|
|
|
|
|
|
|
Groups.getPending = async (req, res) => {
|
|
|
|
|
const pending = await api.groups.getPending(req, req.params);
|
|
|
|
|
helpers.formatApiResponse(200, res, { pending });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Groups.accept = async (req, res) => {
|
|
|
|
|
await api.groups.accept(req, req.params);
|
|
|
|
|
helpers.formatApiResponse(200, res);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Groups.reject = async (req, res) => {
|
|
|
|
|
await api.groups.reject(req, req.params);
|
|
|
|
|
helpers.formatApiResponse(200, res);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Groups.getInvites = async (req, res) => {
|
|
|
|
|
const invites = await api.groups.getInvites(req, req.params);
|
|
|
|
|
helpers.formatApiResponse(200, res, { invites });
|
|
|
|
|
};
|
2023-03-31 15:37:13 -04:00
|
|
|
|
|
|
|
|
Groups.issueInvite = async (req, res) => {
|
|
|
|
|
await api.groups.issueInvite(req, req.params);
|
|
|
|
|
helpers.formatApiResponse(200, res);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Groups.acceptInvite = async (req, res) => {
|
|
|
|
|
await api.groups.acceptInvite(req, req.params);
|
|
|
|
|
helpers.formatApiResponse(200, res);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Groups.rejectInvite = async (req, res) => {
|
|
|
|
|
await api.groups.rejectInvite(req, req.params);
|
|
|
|
|
helpers.formatApiResponse(200, res);
|
|
|
|
|
};
|