74 lines
2.7 KiB
JavaScript
74 lines
2.7 KiB
JavaScript
const Joi = require('joi');
|
|
const controller = require('../controllers/websiteSettings.controller');
|
|
const { WEBSITE_SECTION_TYPES } = require('../config/constants');
|
|
|
|
const mongoId = Joi.string().length(24).hex().required();
|
|
const optionalMongoId = Joi.string().length(24).hex().allow('', null);
|
|
|
|
const websiteSettingsPayload = Joi.object({
|
|
enabled: Joi.boolean(),
|
|
folder: Joi.string().allow('', null),
|
|
logo: Joi.string().allow('', null),
|
|
banners: Joi.array().items(Joi.string()),
|
|
favicon: Joi.string().allow('', null),
|
|
title: Joi.string().allow('', null),
|
|
description: Joi.string().allow('', null),
|
|
keywords: Joi.array().items(Joi.string()),
|
|
templateId: Joi.string().allow('', null),
|
|
layoutTemplate: Joi.string().valid('conference'),
|
|
seoDescription: Joi.string().allow('', null),
|
|
micrositeSections: Joi.array().items(Joi.string().valid(...WEBSITE_SECTION_TYPES)),
|
|
primaryColor: Joi.string().max(32).allow('', null),
|
|
accentColor: Joi.string().max(32).allow('', null),
|
|
fontPair: Joi.string().allow('', null),
|
|
registrationUrl: Joi.string().max(2048).allow('', null),
|
|
registrationFormId: optionalMongoId,
|
|
micrositeHtml: Joi.string().allow('').max(2000000),
|
|
});
|
|
|
|
module.exports = [
|
|
{ method: 'GET', path: '/api/events/{eventId}/website-settings', options: { validate: { params: Joi.object({ eventId: mongoId }) }, handler: controller.get } },
|
|
{
|
|
method: 'GET',
|
|
path: '/api/events/{eventId}/website-settings/microsite-preview-html',
|
|
options: {
|
|
validate: {
|
|
params: Joi.object({ eventId: mongoId }),
|
|
query: Joi.object({
|
|
micrositeId: Joi.string().length(24).hex().allow('', null),
|
|
}),
|
|
},
|
|
handler: controller.previewMicrositeHtml,
|
|
},
|
|
},
|
|
{ method: 'PUT', path: '/api/events/{eventId}/website-settings', options: { validate: { params: Joi.object({ eventId: mongoId }), payload: websiteSettingsPayload }, handler: controller.update } },
|
|
{
|
|
method: 'GET',
|
|
path: '/api/events/{eventId}/website-settings/check-folder',
|
|
options: {
|
|
validate: {
|
|
params: Joi.object({ eventId: mongoId }),
|
|
query: Joi.object({
|
|
folder: Joi.string().required(),
|
|
micrositeId: Joi.string().length(24).hex().allow('', null),
|
|
}),
|
|
},
|
|
handler: controller.checkFolder,
|
|
},
|
|
},
|
|
{
|
|
method: 'POST',
|
|
path: '/api/events/{eventId}/website/publish-microsite',
|
|
options: {
|
|
validate: {
|
|
params: Joi.object({ eventId: mongoId }),
|
|
payload: Joi.object({
|
|
targets: Joi.string().valid('draft', 'live', 'both'),
|
|
micrositeId: Joi.string().length(24).hex().allow('', null),
|
|
}),
|
|
},
|
|
handler: controller.publishMicrosite,
|
|
},
|
|
},
|
|
];
|