Update WebCheck-in
This commit is contained in:
parent
debfb30099
commit
11c511bde2
|
|
@ -4,7 +4,7 @@ const EVENT_STATUS = ['draft', 'upcoming', 'live', 'completed'];
|
|||
const PARTICIPANT_STATUS = ['pending', 'confirmed', 'checked_in', 'cancelled'];
|
||||
const SESSION_TYPES = ['keynote', 'workshop', 'panel', 'breakout', 'networking'];
|
||||
const SESSION_STATUS = ['scheduled', 'ongoing', 'completed', 'cancelled'];
|
||||
const FORM_TYPES = ['registration', 'feedback', 'survey', 'custom', 'other'];
|
||||
const FORM_TYPES = ['registration', 'feedback', 'survey', 'custom', 'other', 'web-check-in'];
|
||||
const FIELD_TYPES = ['text', 'textarea', 'email', 'phone', 'select', 'stars', 'radio', 'checkbox', 'checkboxes', 'file'];
|
||||
/** Registration field → Participant property mapping (or `custom` + customMapsKey). */
|
||||
const FORM_FIELD_MAPS_TO = [
|
||||
|
|
|
|||
|
|
@ -671,7 +671,7 @@ const update = async (request, h) => {
|
|||
const tags = payload.tags;
|
||||
delete payload.tags;
|
||||
|
||||
const assignable = ['email', 'firstName', 'lastName', 'phone', 'organization', 'designation', 'notes'];
|
||||
const assignable = ['email', 'firstName', 'lastName', 'phone', 'organization', 'designation', 'accommodation', 'notes'];
|
||||
for (const key of assignable) {
|
||||
if (Object.prototype.hasOwnProperty.call(payload, key) && payload[key] !== undefined) {
|
||||
participant[key] = payload[key];
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ const eventSchema = new mongoose.Schema(
|
|||
registrationDeadline: Date,
|
||||
enableFeedback: { type: Boolean, default: true },
|
||||
enableRatings: { type: Boolean, default: false },
|
||||
webCheckInEnabled: { type: Boolean, default: false },
|
||||
/** otp_email | link_email | none */
|
||||
authenticationType: String,
|
||||
/** name_email | email_only | name_email_phone | anonymous_name | anonymous */
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ const formSchema = new mongoose.Schema(
|
|||
description: { type: String, default: '' },
|
||||
type: {
|
||||
type: String,
|
||||
enum: ['registration', 'feedback', 'survey', 'custom', 'other'],
|
||||
enum: ['registration', 'feedback', 'survey', 'custom', 'other', 'web-check-in'],
|
||||
required: true,
|
||||
},
|
||||
fields: [formFieldSchema],
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ const participantSchema = new mongoose.Schema(
|
|||
/** Employer / company (string). Not the tenant org id. */
|
||||
organization: String,
|
||||
designation: String,
|
||||
accommodation: { type: Boolean, default: false },
|
||||
customFields: { type: Map, of: mongoose.Schema.Types.Mixed },
|
||||
payment: {
|
||||
amount: Number,
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ const rewardRulesPayload = Joi.object({
|
|||
ratingSubmitted: Joi.number().min(0).allow(null),
|
||||
}).allow(null);
|
||||
|
||||
const eventPayload = Joi.object({
|
||||
name: Joi.string().min(3).max(100).required(),
|
||||
const baseEventPayload = {
|
||||
name: Joi.string().min(3).max(100),
|
||||
subtitle: Joi.string().allow('', null),
|
||||
description: Joi.string().allow('', null),
|
||||
type: Joi.string().valid(...EVENT_TYPES).required(),
|
||||
type: Joi.string().valid(...EVENT_TYPES),
|
||||
recordKind: Joi.string().valid('event', 'activity'),
|
||||
activitySubtype: Joi.when('recordKind', {
|
||||
is: 'activity',
|
||||
|
|
@ -48,8 +48,8 @@ const eventPayload = Joi.object({
|
|||
}),
|
||||
status: Joi.string().valid(...EVENT_STATUS),
|
||||
category: Joi.string().allow('', null),
|
||||
startDate: Joi.date().iso().required(),
|
||||
endDate: Joi.date().iso().required(),
|
||||
startDate: Joi.date().iso(),
|
||||
endDate: Joi.date().iso(),
|
||||
location: Joi.string().allow('', null),
|
||||
locationType: Joi.string().valid('physical', 'virtual', 'hybrid'),
|
||||
virtualLink: Joi.string().allow('', null),
|
||||
|
|
@ -66,6 +66,7 @@ const eventPayload = Joi.object({
|
|||
registrationDeadline: Joi.date().iso().allow(null),
|
||||
enableFeedback: Joi.boolean(),
|
||||
enableRatings: Joi.boolean(),
|
||||
webCheckInEnabled: Joi.boolean(),
|
||||
authenticationType: Joi.string().valid(...AUTHENTICATION_TYPES).allow('', null),
|
||||
registrationBaseFields: Joi.string().valid(...REGISTRATION_BASE_FIELDS).allow('', null),
|
||||
inviteCode: Joi.string().allow('', null),
|
||||
|
|
@ -80,7 +81,17 @@ const eventPayload = Joi.object({
|
|||
rewardRules: rewardRulesPayload,
|
||||
/** When true on POST /events (non-activity), server creates default track + opening session (AI-style). */
|
||||
bootstrapAgenda: Joi.boolean().default(false),
|
||||
});
|
||||
};
|
||||
|
||||
const eventPayload = Joi.object({
|
||||
...baseEventPayload,
|
||||
name: baseEventPayload.name.required(),
|
||||
type: baseEventPayload.type.required(),
|
||||
startDate: baseEventPayload.startDate.required(),
|
||||
endDate: baseEventPayload.endDate.required(),
|
||||
}).options({ allowUnknown: true });
|
||||
|
||||
const eventUpdatePayload = Joi.object(baseEventPayload).min(1).options({ allowUnknown: true });
|
||||
|
||||
const generateFromAiPayload = Joi.object({
|
||||
description: Joi.string().min(10).max(8000).required(),
|
||||
|
|
@ -118,7 +129,7 @@ module.exports = [
|
|||
},
|
||||
{ method: 'POST', path: '/api/events', options: { validate: { payload: eventPayload }, handler: controller.create } },
|
||||
{ method: 'GET', path: '/api/events/{id}', options: { handler: controller.get } },
|
||||
{ method: 'PUT', path: '/api/events/{id}', options: { validate: { payload: eventPayload }, handler: controller.update } },
|
||||
{ method: 'PUT', path: '/api/events/{id}', options: { validate: { payload: eventUpdatePayload }, handler: controller.update } },
|
||||
{ method: 'DELETE', path: '/api/events/{id}', options: { handler: controller.remove } },
|
||||
{ method: 'GET', path: '/api/events/{id}/analytics', options: { handler: controller.analytics } },
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ const participantPayload = Joi.object({
|
|||
phone: Joi.string(),
|
||||
organization: Joi.string(),
|
||||
designation: Joi.string(),
|
||||
accommodation: Joi.boolean(),
|
||||
tags: Joi.array().items(Joi.string()),
|
||||
notes: Joi.string(),
|
||||
});
|
||||
|
|
@ -19,6 +20,7 @@ const participantUpdatePayload = Joi.object({
|
|||
phone: Joi.string().allow('', null),
|
||||
organization: Joi.string().allow('', null),
|
||||
designation: Joi.string().allow('', null),
|
||||
accommodation: Joi.boolean(),
|
||||
tags: Joi.array().items(Joi.string()),
|
||||
notes: Joi.string().allow('', null),
|
||||
}).min(1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue