@velaro/cli 1.4.227 → 1.4.229
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commands/booking.js +141 -0
- package/package.json +1 -1
package/lib/commands/booking.js
CHANGED
|
@@ -380,5 +380,146 @@ export const bookingCommand = {
|
|
|
380
380
|
})
|
|
381
381
|
.demandCommand(1, 'Specify an appointment action: list | get | cancel'),
|
|
382
382
|
})
|
|
383
|
+
// -- floor + no-show + deposits + analytics (messaging FloorController / BookingsController) --
|
|
384
|
+
.command({
|
|
385
|
+
command: 'floor <action>',
|
|
386
|
+
describe: 'Scheduler floor -- waitlist, walk-ins, settings, tables, meeting links',
|
|
387
|
+
builder: y => y
|
|
388
|
+
.command({
|
|
389
|
+
command: 'waitlist',
|
|
390
|
+
describe: 'List the current waitlist and walk-ins',
|
|
391
|
+
handler: runCommand(async () => {
|
|
392
|
+
console.log(JSON.stringify(await messagingGet('/Floor/Waitlist'), null, 2));
|
|
393
|
+
}),
|
|
394
|
+
})
|
|
395
|
+
.command({
|
|
396
|
+
command: 'add',
|
|
397
|
+
describe: 'Add a guest to the waitlist (or record a walk-in with --walk-in)',
|
|
398
|
+
builder: y2 => y2
|
|
399
|
+
.option('name', { type: 'string', demandOption: true, describe: 'Guest name' })
|
|
400
|
+
.option('phone', { type: 'string', demandOption: true, describe: 'Phone for the table-ready text' })
|
|
401
|
+
.option('party-size', { type: 'number', demandOption: true, describe: 'Party size' })
|
|
402
|
+
.option('vip', { type: 'boolean', describe: 'VIP guest' })
|
|
403
|
+
.option('quoted-wait', { type: 'number', describe: 'Quoted wait in minutes' })
|
|
404
|
+
.option('notes', { type: 'string', describe: 'Notes' })
|
|
405
|
+
.option('walk-in', { type: 'boolean', describe: 'Record as a walk-in' }),
|
|
406
|
+
handler: runCommand(async argv => {
|
|
407
|
+
const body = { guestName: argv.name, phone: argv.phone, partySize: argv.partySize, isVip: argv.vip, quotedWaitMinutes: argv.quotedWait, notes: argv.notes };
|
|
408
|
+
console.log(JSON.stringify(await messagingPost(argv.walkIn ? '/Floor/WalkIn' : '/Floor/Waitlist', body), null, 2));
|
|
409
|
+
}),
|
|
410
|
+
})
|
|
411
|
+
.command({
|
|
412
|
+
command: 'entry <id> <verb>',
|
|
413
|
+
describe: 'Act on a waitlist entry: ready | seat | remove | noshow',
|
|
414
|
+
builder: y2 => y2
|
|
415
|
+
.positional('id', { type: 'number', describe: 'Waitlist entry id' })
|
|
416
|
+
.positional('verb', { type: 'string', choices: ['ready', 'seat', 'remove', 'noshow'] })
|
|
417
|
+
.option('resource-id', { type: 'number', describe: 'Table (resource) id, for seat' }),
|
|
418
|
+
handler: runCommand(async argv => {
|
|
419
|
+
const verbs = { ready: 'Ready', seat: 'Seat', remove: 'Remove', noshow: 'NoShow' };
|
|
420
|
+
const body = argv.resourceId != null ? { resourceId: argv.resourceId } : {};
|
|
421
|
+
console.log(JSON.stringify(await messagingPost(`/Floor/Waitlist/${argv.id}/${verbs[argv.verb]}`, body), null, 2));
|
|
422
|
+
}),
|
|
423
|
+
})
|
|
424
|
+
.command({
|
|
425
|
+
command: 'settings',
|
|
426
|
+
describe: 'Show floor settings, or change them with the flags',
|
|
427
|
+
builder: y2 => y2
|
|
428
|
+
.option('turn-minutes', { type: 'number', describe: 'Default turn minutes (5-600)' })
|
|
429
|
+
.option('overbook-percent', { type: 'number', describe: 'Overbook percent (0-50)' })
|
|
430
|
+
.option('seatings-json', { type: 'string', describe: 'Seatings JSON' })
|
|
431
|
+
.option('confirmation-sms', { type: 'boolean', describe: 'Send a booking confirmation SMS' })
|
|
432
|
+
.option('auto-meeting-link', { type: 'boolean', describe: 'Create meeting links automatically' })
|
|
433
|
+
.option('meeting-organizer', { type: 'string', describe: 'Meeting organizer UPN' })
|
|
434
|
+
.option('instructions', { type: 'string', describe: 'Default guest instructions' }),
|
|
435
|
+
handler: runCommand(async argv => {
|
|
436
|
+
const map = { defaultTurnMinutes: argv.turnMinutes, overbookPercent: argv.overbookPercent, seatingsJson: argv.seatingsJson, sendBookingConfirmationSms: argv.confirmationSms, autoCreateMeetingLink: argv.autoMeetingLink, meetingOrganizerUpn: argv.meetingOrganizer, defaultInstructions: argv.instructions };
|
|
437
|
+
const body = {}; for (const [k, v] of Object.entries(map)) if (v !== undefined) body[k] = v;
|
|
438
|
+
const result = Object.keys(body).length ? await messagingPut('/Floor/Settings', body) : await messagingGet('/Floor/Settings');
|
|
439
|
+
console.log(JSON.stringify(result, null, 2));
|
|
440
|
+
}),
|
|
441
|
+
})
|
|
442
|
+
.command({
|
|
443
|
+
command: 'table <resource-id>',
|
|
444
|
+
describe: 'Update a table (empty --combine-group clears it)',
|
|
445
|
+
builder: y2 => y2
|
|
446
|
+
.positional('resource-id', { type: 'number', describe: 'Table (resource) id' })
|
|
447
|
+
.option('min-party', { type: 'number' })
|
|
448
|
+
.option('max-party', { type: 'number' })
|
|
449
|
+
.option('turn-minutes', { type: 'number' })
|
|
450
|
+
.option('combine-group', { type: 'string' }),
|
|
451
|
+
handler: runCommand(async argv => {
|
|
452
|
+
const map = { minParty: argv.minParty, maxParty: argv.maxParty, turnMinutes: argv.turnMinutes, combineGroup: argv.combineGroup };
|
|
453
|
+
const body = {}; for (const [k, v] of Object.entries(map)) if (v !== undefined) body[k] = v;
|
|
454
|
+
console.log(JSON.stringify(await messagingPut(`/Floor/Tables/${argv.resourceId}`, body), null, 2));
|
|
455
|
+
}),
|
|
456
|
+
})
|
|
457
|
+
.command({
|
|
458
|
+
command: 'send-meeting-link <booking-id>',
|
|
459
|
+
describe: 'Send the meeting link for a booking now',
|
|
460
|
+
builder: y2 => y2
|
|
461
|
+
.positional('booking-id', { type: 'number' })
|
|
462
|
+
.option('channel', { type: 'string', choices: ['sms', 'email'], default: 'sms' }),
|
|
463
|
+
handler: runCommand(async argv => {
|
|
464
|
+
console.log(JSON.stringify(await messagingPost(`/Floor/Bookings/${argv.bookingId}/SendMeetingLink`, { channel: argv.channel }), null, 2));
|
|
465
|
+
}),
|
|
466
|
+
})
|
|
467
|
+
.demandCommand(1, 'Specify a floor action: waitlist | add | entry | settings | table | send-meeting-link'),
|
|
468
|
+
})
|
|
469
|
+
.command({
|
|
470
|
+
command: 'no-show <id>',
|
|
471
|
+
describe: 'Mark a booking as a no-show',
|
|
472
|
+
builder: y => y.positional('id', { type: 'number', describe: 'Booking id' }),
|
|
473
|
+
handler: runCommand(async argv => {
|
|
474
|
+
console.log(JSON.stringify(await messagingPost(`/Bookings/${argv.id}/no-show`, {}), null, 2));
|
|
475
|
+
}),
|
|
476
|
+
})
|
|
477
|
+
.command({
|
|
478
|
+
command: 'deposit <action>',
|
|
479
|
+
describe: 'Booking deposits -- set | link | status',
|
|
480
|
+
builder: y => y
|
|
481
|
+
.command({
|
|
482
|
+
command: 'set <id>',
|
|
483
|
+
describe: 'Require or clear a deposit on a booking',
|
|
484
|
+
builder: y2 => y2
|
|
485
|
+
.positional('id', { type: 'number', describe: 'Booking id' })
|
|
486
|
+
.option('required', { type: 'boolean', demandOption: true, describe: 'Whether a deposit is required' })
|
|
487
|
+
.option('amount', { type: 'number', describe: 'Deposit amount' }),
|
|
488
|
+
handler: runCommand(async argv => {
|
|
489
|
+
const body = { required: argv.required }; if (argv.amount != null) body.amount = argv.amount;
|
|
490
|
+
console.log(JSON.stringify(await messagingPut(`/Bookings/${argv.id}/deposit`, body), null, 2));
|
|
491
|
+
}),
|
|
492
|
+
})
|
|
493
|
+
.command({
|
|
494
|
+
command: 'link <id>',
|
|
495
|
+
describe: 'Create a deposit payment link',
|
|
496
|
+
builder: y2 => y2.positional('id', { type: 'number', describe: 'Booking id' }),
|
|
497
|
+
handler: runCommand(async argv => {
|
|
498
|
+
console.log(JSON.stringify(await messagingPost(`/Bookings/${argv.id}/deposit/link`, {}), null, 2));
|
|
499
|
+
}),
|
|
500
|
+
})
|
|
501
|
+
.command({
|
|
502
|
+
command: 'status <payment-id>',
|
|
503
|
+
describe: 'Check a deposit payment',
|
|
504
|
+
builder: y2 => y2.positional('payment-id', { type: 'string' }),
|
|
505
|
+
handler: runCommand(async argv => {
|
|
506
|
+
console.log(JSON.stringify(await messagingGet(`/Bookings/deposit/status?paymentId=${encodeURIComponent(argv.paymentId)}`), null, 2));
|
|
507
|
+
}),
|
|
508
|
+
})
|
|
509
|
+
.demandCommand(1, 'Specify a deposit action: set | link | status'),
|
|
510
|
+
})
|
|
511
|
+
.command({
|
|
512
|
+
command: 'analytics',
|
|
513
|
+
describe: 'Booking analytics for a date range',
|
|
514
|
+
builder: y => y
|
|
515
|
+
.option('from', { type: 'string', describe: 'Start, ISO 8601 UTC' })
|
|
516
|
+
.option('to', { type: 'string', describe: 'End, ISO 8601 UTC' }),
|
|
517
|
+
handler: runCommand(async argv => {
|
|
518
|
+
const q = new URLSearchParams();
|
|
519
|
+
if (argv.from) q.set('fromUtc', argv.from);
|
|
520
|
+
if (argv.to) q.set('toUtc', argv.to);
|
|
521
|
+
console.log(JSON.stringify(await messagingGet(`/Bookings/analytics${q.toString() ? '?' + q : ''}`), null, 2));
|
|
522
|
+
}),
|
|
523
|
+
})
|
|
383
524
|
.demandCommand(1, 'Specify a subcommand: resource | service | availability | appointment'),
|
|
384
525
|
};
|
package/package.json
CHANGED