| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- 'use strict'
-
- const Joi = require('joi')
-
- const pluginConfig = {
- handlerType: 'grouping',
- docs: {
- description: 'leave',
- notes: 'Leave a grouping by creating a membership record',
- },
- }
-
- const validators = {
- leave: {
- payload: Joi.object(),
- },
- }
-
- module.exports = {
- method: 'POST',
- path: '/leave',
- options: {
- ...pluginConfig.docs,
- tags: ['api'],
- auth: false,
- handler: async function (request, h) {
- try {
- return {
- ok: true,
- handler: pluginConfig.handlerType,
- data: { foo: 'bar' },
- }
- } catch (err) {
- return {
- ok: false,
- handler: pluginConfig.handlerType,
- data: { error: `${err}` },
- }
- }
- },
- validate: validators.leave,
- response: {
- schema: Joi.object({
- ok: Joi.bool(),
- handler: Joi.string(),
- data: validators.leave,
- }),
- failAction: 'log',
- },
- },
- }
|