@ordinatio/scheduling-api 0.5.0 → 0.5.1
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/CHANGELOG.md +13 -0
- package/dist/agent/index.js +7 -5
- package/dist/agent/index.mjs +7 -5
- package/dist/index.js +20 -6
- package/dist/index.mjs +20 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.1 (prepared 2026-11-12)
|
|
4
|
+
|
|
5
|
+
- **Security fix: staff answers no longer include the client's private manage token.** Five staff routes answered with the stored appointment,
|
|
6
|
+
including `manageToken`, the secret in the client's cancel and reschedule links: reassign (`PATCH /appointments/[id]/reassign`), cancel,
|
|
7
|
+
reschedule, no-show, and approve or reject (both answers). Staff do not need it, and these answers end up in logs, browser tools and agent
|
|
8
|
+
transcripts. All five now leave it out and every other field is unchanged. The agent tools for cancel, reschedule, no-show and reassign no
|
|
9
|
+
longer list it in their answers. The public booking route still returns it to the person who just booked, who is its rightful holder.
|
|
10
|
+
If you read `manageToken` from one of these staff answers, read it from the appointment record instead.
|
|
11
|
+
- **Fix: renaming a calendar to a name another active calendar already has is now refused with 409.** `PUT /admin/calendars/[id]` accepted it, so two
|
|
12
|
+
calendars could share one name in every staff picker, while `POST /admin/calendars` already refused a taken name. Capital letters are ignored, the
|
|
13
|
+
calendar's own name never counts, archived calendars are ignored, and the check only runs when the name actually changes. The web address
|
|
14
|
+
(slug) is still never changed by a rename. The update agent tool's text says so.
|
|
15
|
+
|
|
3
16
|
## 0.5.0 (prepared 2026-11-10)
|
|
4
17
|
|
|
5
18
|
- **New agent tools for the waitlist, data export and erasure, and booking analytics (6 more), which completes the agent tools.** Every staff-facing
|
package/dist/agent/index.js
CHANGED
|
@@ -29,6 +29,7 @@ module.exports = __toCommonJS(agent_exports);
|
|
|
29
29
|
|
|
30
30
|
// src/agent/appointment-tools.ts
|
|
31
31
|
var APPOINTMENT_FIELDS = "id, calendarId, calendarName, staffName, typeId, typeName, startTime, endTime, duration, timezone, status, clientName, clientEmail, clientPhone, intakeResponses, staffNotes, location, paymentId, paymentStatus, paymentAmount, depositAmount, paymentProvider, couponCode, discountAmount, isGroup, manageToken, createdAt";
|
|
32
|
+
var STAFF_APPOINTMENT_FIELDS = "id, calendarId, calendarName, staffName, typeId, typeName, startTime, endTime, duration, timezone, status, clientName, clientEmail, clientPhone, intakeResponses, staffNotes, location, paymentId, paymentStatus, paymentAmount, depositAmount, paymentProvider, couponCode, discountAmount, isGroup, createdAt";
|
|
32
33
|
var ID = { name: "id", type: "string", required: true, description: "Appointment id" };
|
|
33
34
|
var APPOINTMENT_TOOLS = [
|
|
34
35
|
{
|
|
@@ -207,7 +208,7 @@ var APPOINTMENT_TOOLS = [
|
|
|
207
208
|
description: "Cancel an appointment as staff. The calendar entry is removed, the staff member is notified and a paid booking is flagged for refund review. This route does not message the client itself; the host may send a notice when it hears the appointment.cancelled event.",
|
|
208
209
|
params: [ID, { name: "reason", type: "string", required: false, description: "Why, up to 500 characters; stored as the cancellation reason" }],
|
|
209
210
|
example: { id: "appt_1", reason: "Staff member is unwell" },
|
|
210
|
-
responseShape: `{ ${
|
|
211
|
+
responseShape: `{ ${STAFF_APPOINTMENT_FIELDS} } with status "CANCELLED"`,
|
|
211
212
|
pitfalls: ["Staff can cancel even after the type's client cancellation deadline; those limits apply only to the client's own link. Refused with 409 only when the appointment is no longer pending or confirmed."],
|
|
212
213
|
whenToUse: "When staff, not the client, ends the booking.",
|
|
213
214
|
dataSensitivity: "sensitive",
|
|
@@ -227,7 +228,7 @@ var APPOINTMENT_TOOLS = [
|
|
|
227
228
|
description: "Move an appointment to a new start time on the same calendar. The client is sent a reschedule notice and their reminders are redone for the new time.",
|
|
228
229
|
params: [ID, { name: "newStartTime", type: "string", required: true, description: "New start in UTC, ending in Z; a time with no zone is read in the server's own zone and lands in the wrong place" }],
|
|
229
230
|
example: { id: "appt_1", newStartTime: "2026-11-04T16:00:00Z" },
|
|
230
|
-
responseShape: `{ ${
|
|
231
|
+
responseShape: `{ ${STAFF_APPOINTMENT_FIELDS} }`,
|
|
231
232
|
whenToUse: "When a time change was asked for. Check availability for the new time first.",
|
|
232
233
|
pitfalls: ["A time that is taken, a time in the past, an appointment that has already started, a type that does not allow moving, or a change made at the same moment by someone else, is refused."],
|
|
233
234
|
dataSensitivity: "sensitive",
|
|
@@ -271,9 +272,9 @@ var APPOINTMENT_TOOLS = [
|
|
|
271
272
|
description: "Hand an appointment to a different calendar, which means a different staff member, at the same time.",
|
|
272
273
|
params: [ID, { name: "calendarId", type: "string", required: true, description: "Calendar to move it to" }],
|
|
273
274
|
example: { id: "appt_1", calendarId: "cal_2" },
|
|
274
|
-
responseShape: "{ id, calendarId, typeId, startTime, endTime, duration, timezone, clientName, clientEmail, clientPhone, status, staffNotes, location, paymentStatus,
|
|
275
|
+
responseShape: "{ id, calendarId, typeId, startTime, endTime, duration, timezone, clientName, clientEmail, clientPhone, status, staffNotes, location, paymentStatus, createdAt, updatedAt } (the stored record without the client's private manage token)",
|
|
275
276
|
whenToUse: "When a different person should take the appointment.",
|
|
276
|
-
pitfalls: ["
|
|
277
|
+
pitfalls: ["Admin roles only. Only pending or confirmed appointments, and not group sessions. The new calendar must be in the appointment type's team and free at that time; otherwise it is refused."],
|
|
277
278
|
dataSensitivity: "sensitive",
|
|
278
279
|
risk: "act",
|
|
279
280
|
requiresApproval: {
|
|
@@ -291,7 +292,7 @@ var APPOINTMENT_TOOLS = [
|
|
|
291
292
|
description: "Record that the client did not come.",
|
|
292
293
|
params: [ID],
|
|
293
294
|
example: { id: "appt_1" },
|
|
294
|
-
responseShape: `{ ${
|
|
295
|
+
responseShape: `{ ${STAFF_APPOINTMENT_FIELDS} } with status "NO_SHOW"`,
|
|
295
296
|
whenToUse: "After the start time has passed and the client did not arrive.",
|
|
296
297
|
pitfalls: ["Refused with 409 unless the appointment is pending or confirmed and its start time has passed."],
|
|
297
298
|
dataSensitivity: "sensitive",
|
|
@@ -1011,6 +1012,7 @@ var CALENDAR_TOOLS = [
|
|
|
1011
1012
|
whenToUse: "To rename a calendar, change its time zone or slot size, link it to a person, or switch it off or on.",
|
|
1012
1013
|
pitfalls: [
|
|
1013
1014
|
"Changing the time zone changes what the opening hours mean in real time.",
|
|
1015
|
+
"Renaming a calendar to the name of another active calendar, ignoring capital letters, is refused with 409. A name that only gives the same web address is not checked on rename, because renaming never changes the web address.",
|
|
1014
1016
|
"Switching off the last active calendar is refused with 409, as archiving is. If the other changes in the same request then fail to save, the calendar is switched back on.",
|
|
1015
1017
|
"Linking a calendar to a person (userId) changes who can see it when staff are limited to their groups.",
|
|
1016
1018
|
"Switching a calendar back on (isActive true) does not give back its short booking address; only the organization-qualified address works until it is registered again."
|
package/dist/agent/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/agent/appointment-tools.ts
|
|
2
2
|
var APPOINTMENT_FIELDS = "id, calendarId, calendarName, staffName, typeId, typeName, startTime, endTime, duration, timezone, status, clientName, clientEmail, clientPhone, intakeResponses, staffNotes, location, paymentId, paymentStatus, paymentAmount, depositAmount, paymentProvider, couponCode, discountAmount, isGroup, manageToken, createdAt";
|
|
3
|
+
var STAFF_APPOINTMENT_FIELDS = "id, calendarId, calendarName, staffName, typeId, typeName, startTime, endTime, duration, timezone, status, clientName, clientEmail, clientPhone, intakeResponses, staffNotes, location, paymentId, paymentStatus, paymentAmount, depositAmount, paymentProvider, couponCode, discountAmount, isGroup, createdAt";
|
|
3
4
|
var ID = { name: "id", type: "string", required: true, description: "Appointment id" };
|
|
4
5
|
var APPOINTMENT_TOOLS = [
|
|
5
6
|
{
|
|
@@ -178,7 +179,7 @@ var APPOINTMENT_TOOLS = [
|
|
|
178
179
|
description: "Cancel an appointment as staff. The calendar entry is removed, the staff member is notified and a paid booking is flagged for refund review. This route does not message the client itself; the host may send a notice when it hears the appointment.cancelled event.",
|
|
179
180
|
params: [ID, { name: "reason", type: "string", required: false, description: "Why, up to 500 characters; stored as the cancellation reason" }],
|
|
180
181
|
example: { id: "appt_1", reason: "Staff member is unwell" },
|
|
181
|
-
responseShape: `{ ${
|
|
182
|
+
responseShape: `{ ${STAFF_APPOINTMENT_FIELDS} } with status "CANCELLED"`,
|
|
182
183
|
pitfalls: ["Staff can cancel even after the type's client cancellation deadline; those limits apply only to the client's own link. Refused with 409 only when the appointment is no longer pending or confirmed."],
|
|
183
184
|
whenToUse: "When staff, not the client, ends the booking.",
|
|
184
185
|
dataSensitivity: "sensitive",
|
|
@@ -198,7 +199,7 @@ var APPOINTMENT_TOOLS = [
|
|
|
198
199
|
description: "Move an appointment to a new start time on the same calendar. The client is sent a reschedule notice and their reminders are redone for the new time.",
|
|
199
200
|
params: [ID, { name: "newStartTime", type: "string", required: true, description: "New start in UTC, ending in Z; a time with no zone is read in the server's own zone and lands in the wrong place" }],
|
|
200
201
|
example: { id: "appt_1", newStartTime: "2026-11-04T16:00:00Z" },
|
|
201
|
-
responseShape: `{ ${
|
|
202
|
+
responseShape: `{ ${STAFF_APPOINTMENT_FIELDS} }`,
|
|
202
203
|
whenToUse: "When a time change was asked for. Check availability for the new time first.",
|
|
203
204
|
pitfalls: ["A time that is taken, a time in the past, an appointment that has already started, a type that does not allow moving, or a change made at the same moment by someone else, is refused."],
|
|
204
205
|
dataSensitivity: "sensitive",
|
|
@@ -242,9 +243,9 @@ var APPOINTMENT_TOOLS = [
|
|
|
242
243
|
description: "Hand an appointment to a different calendar, which means a different staff member, at the same time.",
|
|
243
244
|
params: [ID, { name: "calendarId", type: "string", required: true, description: "Calendar to move it to" }],
|
|
244
245
|
example: { id: "appt_1", calendarId: "cal_2" },
|
|
245
|
-
responseShape: "{ id, calendarId, typeId, startTime, endTime, duration, timezone, clientName, clientEmail, clientPhone, status, staffNotes, location, paymentStatus,
|
|
246
|
+
responseShape: "{ id, calendarId, typeId, startTime, endTime, duration, timezone, clientName, clientEmail, clientPhone, status, staffNotes, location, paymentStatus, createdAt, updatedAt } (the stored record without the client's private manage token)",
|
|
246
247
|
whenToUse: "When a different person should take the appointment.",
|
|
247
|
-
pitfalls: ["
|
|
248
|
+
pitfalls: ["Admin roles only. Only pending or confirmed appointments, and not group sessions. The new calendar must be in the appointment type's team and free at that time; otherwise it is refused."],
|
|
248
249
|
dataSensitivity: "sensitive",
|
|
249
250
|
risk: "act",
|
|
250
251
|
requiresApproval: {
|
|
@@ -262,7 +263,7 @@ var APPOINTMENT_TOOLS = [
|
|
|
262
263
|
description: "Record that the client did not come.",
|
|
263
264
|
params: [ID],
|
|
264
265
|
example: { id: "appt_1" },
|
|
265
|
-
responseShape: `{ ${
|
|
266
|
+
responseShape: `{ ${STAFF_APPOINTMENT_FIELDS} } with status "NO_SHOW"`,
|
|
266
267
|
whenToUse: "After the start time has passed and the client did not arrive.",
|
|
267
268
|
pitfalls: ["Refused with 409 unless the appointment is pending or confirmed and its start time has passed."],
|
|
268
269
|
dataSensitivity: "sensitive",
|
|
@@ -982,6 +983,7 @@ var CALENDAR_TOOLS = [
|
|
|
982
983
|
whenToUse: "To rename a calendar, change its time zone or slot size, link it to a person, or switch it off or on.",
|
|
983
984
|
pitfalls: [
|
|
984
985
|
"Changing the time zone changes what the opening hours mean in real time.",
|
|
986
|
+
"Renaming a calendar to the name of another active calendar, ignoring capital letters, is refused with 409. A name that only gives the same web address is not checked on rename, because renaming never changes the web address.",
|
|
985
987
|
"Switching off the last active calendar is refused with 409, as archiving is. If the other changes in the same request then fail to save, the calendar is switched back on.",
|
|
986
988
|
"Linking a calendar to a person (userId) changes who can see it when staff are limited to their groups.",
|
|
987
989
|
"Switching a calendar back on (isActive true) does not give back its short booking address; only the organization-qualified address works until it is registered again."
|
package/dist/index.js
CHANGED
|
@@ -1050,6 +1050,13 @@ async function requireAdminStaff(host, request, options) {
|
|
|
1050
1050
|
return staff;
|
|
1051
1051
|
}
|
|
1052
1052
|
|
|
1053
|
+
// src/handlers/staff-appointment.ts
|
|
1054
|
+
function withoutManageToken(appointment) {
|
|
1055
|
+
if (appointment === null || appointment === void 0) return null;
|
|
1056
|
+
const { manageToken: _manageToken, ...rest } = appointment;
|
|
1057
|
+
return rest;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1053
1060
|
// src/handlers/appointment-cancel.ts
|
|
1054
1061
|
async function cancelByStaff(request, { host, params }) {
|
|
1055
1062
|
try {
|
|
@@ -1122,7 +1129,7 @@ async function cancelByStaff(request, { host, params }) {
|
|
|
1122
1129
|
description: `cancelled ${appointment.clientName}'s appointment`,
|
|
1123
1130
|
metadata: { appointmentId: id, clientName: appointment.clientName }
|
|
1124
1131
|
});
|
|
1125
|
-
return Response.json(result);
|
|
1132
|
+
return Response.json(withoutManageToken(result));
|
|
1126
1133
|
} catch (error) {
|
|
1127
1134
|
if (error instanceof import_scheduling13.SchedulingNotFoundError) {
|
|
1128
1135
|
return Response.json({ error: error.message, ref: error.ref }, { status: 404 });
|
|
@@ -1466,7 +1473,7 @@ async function rejectAppointment(host, db, organizationId, appointment, reason)
|
|
|
1466
1473
|
description: `rejected ${appointment.clientName}'s appointment request`,
|
|
1467
1474
|
metadata: { appointmentId: id, clientName: appointment.clientName, reason }
|
|
1468
1475
|
});
|
|
1469
|
-
return Response.json({ success: true, status: "CANCELLED", appointment: result });
|
|
1476
|
+
return Response.json({ success: true, status: "CANCELLED", appointment: withoutManageToken(result) });
|
|
1470
1477
|
}
|
|
1471
1478
|
async function approveOrReject(request, { host, params }) {
|
|
1472
1479
|
try {
|
|
@@ -1522,7 +1529,7 @@ async function approveOrReject(request, { host, params }) {
|
|
|
1522
1529
|
metadata: { appointmentId: id, clientName: appointment.clientName }
|
|
1523
1530
|
});
|
|
1524
1531
|
const confirmedAppointment = await (0, import_scheduling15.getAppointment)(db, id);
|
|
1525
|
-
return Response.json({ success: true, status: "CONFIRMED", appointment: confirmedAppointment });
|
|
1532
|
+
return Response.json({ success: true, status: "CONFIRMED", appointment: withoutManageToken(confirmedAppointment) });
|
|
1526
1533
|
} catch (error) {
|
|
1527
1534
|
if (getErrorCode(error) === "SCHED_306") {
|
|
1528
1535
|
return Response.json({ error: "Appointment was already processed by a concurrent request" }, { status: 409 });
|
|
@@ -1612,7 +1619,7 @@ async function rescheduleByStaff(request, { host, params }) {
|
|
|
1612
1619
|
newTime: newTime.toISOString()
|
|
1613
1620
|
}
|
|
1614
1621
|
});
|
|
1615
|
-
return Response.json(result);
|
|
1622
|
+
return Response.json(withoutManageToken(result));
|
|
1616
1623
|
} catch (error) {
|
|
1617
1624
|
if (error instanceof import_scheduling16.SchedulingValidationError) return Response.json({ error: error.message }, { status: 400 });
|
|
1618
1625
|
if (error instanceof import_scheduling16.SchedulingNotFoundError) return Response.json({ error: error.message }, { status: 404 });
|
|
@@ -1735,7 +1742,7 @@ async function reassignAppointment(request, { host, params }) {
|
|
|
1735
1742
|
err instanceof Error ? err.message : err
|
|
1736
1743
|
);
|
|
1737
1744
|
}
|
|
1738
|
-
return Response.json(updated);
|
|
1745
|
+
return Response.json(withoutManageToken(updated));
|
|
1739
1746
|
} catch (error) {
|
|
1740
1747
|
const ref = getErrorRef(error);
|
|
1741
1748
|
console.error("[reassign]", ref, error instanceof Error ? error.message : error);
|
|
@@ -1894,7 +1901,7 @@ async function markAppointmentNoShow(request, { host, params }) {
|
|
|
1894
1901
|
description: `marked ${appointment.clientName}'s appointment as no-show`,
|
|
1895
1902
|
metadata: { appointmentId: id, clientName: appointment.clientName }
|
|
1896
1903
|
});
|
|
1897
|
-
return Response.json(result);
|
|
1904
|
+
return Response.json(withoutManageToken(result));
|
|
1898
1905
|
} catch (error) {
|
|
1899
1906
|
if (error instanceof import_scheduling18.SchedulingNotFoundError) {
|
|
1900
1907
|
return Response.json({ error: error.message, ref: error.ref }, { status: 404 });
|
|
@@ -4909,6 +4916,13 @@ async function putCalendar(request, { host, params }) {
|
|
|
4909
4916
|
const input = validation.data;
|
|
4910
4917
|
const linkError = input.userId === void 0 ? null : await validateStaffLink(host, input.userId, organizationId);
|
|
4911
4918
|
if (linkError) return linkError;
|
|
4919
|
+
if (input.name !== void 0 && input.name !== existing.name) {
|
|
4920
|
+
const taken = await db.schedulingCalendar.findFirst({
|
|
4921
|
+
where: { organizationId, isActive: true, id: { not: id }, name: { equals: input.name, mode: "insensitive" } },
|
|
4922
|
+
select: { id: true }
|
|
4923
|
+
});
|
|
4924
|
+
if (taken) return Response.json({ error: "A calendar with this name already exists" }, { status: 409 });
|
|
4925
|
+
}
|
|
4912
4926
|
const archiving = input.isActive === false && existing.isActive;
|
|
4913
4927
|
let archived = false;
|
|
4914
4928
|
let updated;
|
package/dist/index.mjs
CHANGED
|
@@ -987,6 +987,13 @@ async function requireAdminStaff(host, request, options) {
|
|
|
987
987
|
return staff;
|
|
988
988
|
}
|
|
989
989
|
|
|
990
|
+
// src/handlers/staff-appointment.ts
|
|
991
|
+
function withoutManageToken(appointment) {
|
|
992
|
+
if (appointment === null || appointment === void 0) return null;
|
|
993
|
+
const { manageToken: _manageToken, ...rest } = appointment;
|
|
994
|
+
return rest;
|
|
995
|
+
}
|
|
996
|
+
|
|
990
997
|
// src/handlers/appointment-cancel.ts
|
|
991
998
|
async function cancelByStaff(request, { host, params }) {
|
|
992
999
|
try {
|
|
@@ -1059,7 +1066,7 @@ async function cancelByStaff(request, { host, params }) {
|
|
|
1059
1066
|
description: `cancelled ${appointment.clientName}'s appointment`,
|
|
1060
1067
|
metadata: { appointmentId: id, clientName: appointment.clientName }
|
|
1061
1068
|
});
|
|
1062
|
-
return Response.json(result);
|
|
1069
|
+
return Response.json(withoutManageToken(result));
|
|
1063
1070
|
} catch (error) {
|
|
1064
1071
|
if (error instanceof SchedulingNotFoundError) {
|
|
1065
1072
|
return Response.json({ error: error.message, ref: error.ref }, { status: 404 });
|
|
@@ -1408,7 +1415,7 @@ async function rejectAppointment(host, db, organizationId, appointment, reason)
|
|
|
1408
1415
|
description: `rejected ${appointment.clientName}'s appointment request`,
|
|
1409
1416
|
metadata: { appointmentId: id, clientName: appointment.clientName, reason }
|
|
1410
1417
|
});
|
|
1411
|
-
return Response.json({ success: true, status: "CANCELLED", appointment: result });
|
|
1418
|
+
return Response.json({ success: true, status: "CANCELLED", appointment: withoutManageToken(result) });
|
|
1412
1419
|
}
|
|
1413
1420
|
async function approveOrReject(request, { host, params }) {
|
|
1414
1421
|
try {
|
|
@@ -1464,7 +1471,7 @@ async function approveOrReject(request, { host, params }) {
|
|
|
1464
1471
|
metadata: { appointmentId: id, clientName: appointment.clientName }
|
|
1465
1472
|
});
|
|
1466
1473
|
const confirmedAppointment = await getAppointment(db, id);
|
|
1467
|
-
return Response.json({ success: true, status: "CONFIRMED", appointment: confirmedAppointment });
|
|
1474
|
+
return Response.json({ success: true, status: "CONFIRMED", appointment: withoutManageToken(confirmedAppointment) });
|
|
1468
1475
|
} catch (error) {
|
|
1469
1476
|
if (getErrorCode(error) === "SCHED_306") {
|
|
1470
1477
|
return Response.json({ error: "Appointment was already processed by a concurrent request" }, { status: 409 });
|
|
@@ -1561,7 +1568,7 @@ async function rescheduleByStaff(request, { host, params }) {
|
|
|
1561
1568
|
newTime: newTime.toISOString()
|
|
1562
1569
|
}
|
|
1563
1570
|
});
|
|
1564
|
-
return Response.json(result);
|
|
1571
|
+
return Response.json(withoutManageToken(result));
|
|
1565
1572
|
} catch (error) {
|
|
1566
1573
|
if (error instanceof SchedulingValidationError2) return Response.json({ error: error.message }, { status: 400 });
|
|
1567
1574
|
if (error instanceof SchedulingNotFoundError3) return Response.json({ error: error.message }, { status: 404 });
|
|
@@ -1684,7 +1691,7 @@ async function reassignAppointment(request, { host, params }) {
|
|
|
1684
1691
|
err instanceof Error ? err.message : err
|
|
1685
1692
|
);
|
|
1686
1693
|
}
|
|
1687
|
-
return Response.json(updated);
|
|
1694
|
+
return Response.json(withoutManageToken(updated));
|
|
1688
1695
|
} catch (error) {
|
|
1689
1696
|
const ref = getErrorRef(error);
|
|
1690
1697
|
console.error("[reassign]", ref, error instanceof Error ? error.message : error);
|
|
@@ -1843,7 +1850,7 @@ async function markAppointmentNoShow(request, { host, params }) {
|
|
|
1843
1850
|
description: `marked ${appointment.clientName}'s appointment as no-show`,
|
|
1844
1851
|
metadata: { appointmentId: id, clientName: appointment.clientName }
|
|
1845
1852
|
});
|
|
1846
|
-
return Response.json(result);
|
|
1853
|
+
return Response.json(withoutManageToken(result));
|
|
1847
1854
|
} catch (error) {
|
|
1848
1855
|
if (error instanceof SchedulingNotFoundError4) {
|
|
1849
1856
|
return Response.json({ error: error.message, ref: error.ref }, { status: 404 });
|
|
@@ -4432,6 +4439,13 @@ async function putCalendar(request, { host, params }) {
|
|
|
4432
4439
|
const input = validation.data;
|
|
4433
4440
|
const linkError = input.userId === void 0 ? null : await validateStaffLink(host, input.userId, organizationId);
|
|
4434
4441
|
if (linkError) return linkError;
|
|
4442
|
+
if (input.name !== void 0 && input.name !== existing.name) {
|
|
4443
|
+
const taken = await db.schedulingCalendar.findFirst({
|
|
4444
|
+
where: { organizationId, isActive: true, id: { not: id }, name: { equals: input.name, mode: "insensitive" } },
|
|
4445
|
+
select: { id: true }
|
|
4446
|
+
});
|
|
4447
|
+
if (taken) return Response.json({ error: "A calendar with this name already exists" }, { status: 409 });
|
|
4448
|
+
}
|
|
4435
4449
|
const archiving = input.isActive === false && existing.isActive;
|
|
4436
4450
|
let archived = false;
|
|
4437
4451
|
let updated;
|
package/package.json
CHANGED