@ordinatio/scheduling 0.2.0 → 0.2.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 +9 -0
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +22 -2
- package/dist/index.mjs +22 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
- **Upcoming bookings on the dashboard.** `getAppointmentDashboard` now also returns `upcoming` (bookings after
|
|
6
|
+
the current week, soonest first, at most 50) and `upcomingTotal` (how many there are in all, so a capped list
|
|
7
|
+
can say so). Cancelled bookings are left out and calendar visibility still applies. Before, a booking next
|
|
8
|
+
week was in no list at all.
|
|
9
|
+
- **Error reference.** `SCHED_704` now points at the file where the check lives.
|
|
10
|
+
- **README** examples are checked by a script.
|
|
11
|
+
|
|
3
12
|
## 0.2.0
|
|
4
13
|
|
|
5
14
|
The first release on npm.
|
package/dist/index.d.mts
CHANGED
|
@@ -285,6 +285,10 @@ interface AppointmentDashboardStats {
|
|
|
285
285
|
interface AppointmentDashboardData {
|
|
286
286
|
today: AppointmentDashboardItem[];
|
|
287
287
|
week: AppointmentDashboardItem[];
|
|
288
|
+
/** Bookings after the current week, soonest first, capped. */
|
|
289
|
+
upcoming: AppointmentDashboardItem[];
|
|
290
|
+
/** All upcoming bookings the viewer may see, including those past the list cap. */
|
|
291
|
+
upcomingTotal: number;
|
|
288
292
|
history: AppointmentDashboardItem[];
|
|
289
293
|
stats: AppointmentDashboardStats;
|
|
290
294
|
historyTotal: number;
|
|
@@ -1303,13 +1307,15 @@ interface DashboardQuery {
|
|
|
1303
1307
|
/**
|
|
1304
1308
|
* Fetch all data needed for the appointments dashboard in one call.
|
|
1305
1309
|
*
|
|
1306
|
-
* Runs
|
|
1310
|
+
* Runs 10 parallel queries:
|
|
1307
1311
|
* - Today's appointments (chronological, excluding cancelled)
|
|
1308
1312
|
* - This week's remaining appointments
|
|
1309
1313
|
* - Today stats (total + cancelled)
|
|
1310
1314
|
* - Week stats (total + cancelled)
|
|
1311
1315
|
* - History (paginated, searchable, filterable)
|
|
1312
1316
|
* - History count
|
|
1317
|
+
* - Upcoming (after this week, soonest first, capped)
|
|
1318
|
+
* - Upcoming count (all of them, so a capped list can say so)
|
|
1313
1319
|
*/
|
|
1314
1320
|
declare function getAppointmentDashboard(db: SchedulingDb, query?: DashboardQuery): Promise<AppointmentDashboardData>;
|
|
1315
1321
|
interface AppointmentsForRangeResult {
|
package/dist/index.d.ts
CHANGED
|
@@ -285,6 +285,10 @@ interface AppointmentDashboardStats {
|
|
|
285
285
|
interface AppointmentDashboardData {
|
|
286
286
|
today: AppointmentDashboardItem[];
|
|
287
287
|
week: AppointmentDashboardItem[];
|
|
288
|
+
/** Bookings after the current week, soonest first, capped. */
|
|
289
|
+
upcoming: AppointmentDashboardItem[];
|
|
290
|
+
/** All upcoming bookings the viewer may see, including those past the list cap. */
|
|
291
|
+
upcomingTotal: number;
|
|
288
292
|
history: AppointmentDashboardItem[];
|
|
289
293
|
stats: AppointmentDashboardStats;
|
|
290
294
|
historyTotal: number;
|
|
@@ -1303,13 +1307,15 @@ interface DashboardQuery {
|
|
|
1303
1307
|
/**
|
|
1304
1308
|
* Fetch all data needed for the appointments dashboard in one call.
|
|
1305
1309
|
*
|
|
1306
|
-
* Runs
|
|
1310
|
+
* Runs 10 parallel queries:
|
|
1307
1311
|
* - Today's appointments (chronological, excluding cancelled)
|
|
1308
1312
|
* - This week's remaining appointments
|
|
1309
1313
|
* - Today stats (total + cancelled)
|
|
1310
1314
|
* - Week stats (total + cancelled)
|
|
1311
1315
|
* - History (paginated, searchable, filterable)
|
|
1312
1316
|
* - History count
|
|
1317
|
+
* - Upcoming (after this week, soonest first, capped)
|
|
1318
|
+
* - Upcoming count (all of them, so a capped list can say so)
|
|
1313
1319
|
*/
|
|
1314
1320
|
declare function getAppointmentDashboard(db: SchedulingDb, query?: DashboardQuery): Promise<AppointmentDashboardData>;
|
|
1315
1321
|
interface AppointmentsForRangeResult {
|
package/dist/index.js
CHANGED
|
@@ -3119,6 +3119,7 @@ var DASHBOARD_INCLUDE = {
|
|
|
3119
3119
|
calendar: { select: { name: true, staffName: true } }
|
|
3120
3120
|
};
|
|
3121
3121
|
var PAGE_SIZE = 20;
|
|
3122
|
+
var UPCOMING_LIMIT = 50;
|
|
3122
3123
|
var DEFAULT_DASHBOARD_TIMEZONE = "America/Detroit";
|
|
3123
3124
|
function preciseDayEnd(truncatedEnd) {
|
|
3124
3125
|
return new Date(truncatedEnd.getTime() + 59e3);
|
|
@@ -3169,7 +3170,9 @@ async function getAppointmentDashboard(db, query = {}) {
|
|
|
3169
3170
|
weekTotal,
|
|
3170
3171
|
weekCancelled,
|
|
3171
3172
|
historyAppointments,
|
|
3172
|
-
historyTotal
|
|
3173
|
+
historyTotal,
|
|
3174
|
+
upcomingAppointments,
|
|
3175
|
+
upcomingTotal
|
|
3173
3176
|
] = await Promise.all([
|
|
3174
3177
|
db.appointment.findMany({
|
|
3175
3178
|
where: withCalendarVisibility({
|
|
@@ -3206,12 +3209,29 @@ async function getAppointmentDashboard(db, query = {}) {
|
|
|
3206
3209
|
skip: (page - 1) * pageSize,
|
|
3207
3210
|
take: pageSize
|
|
3208
3211
|
}),
|
|
3209
|
-
db.appointment.count({ where: scopedHistoryWhere })
|
|
3212
|
+
db.appointment.count({ where: scopedHistoryWhere }),
|
|
3213
|
+
db.appointment.findMany({
|
|
3214
|
+
where: withCalendarVisibility({
|
|
3215
|
+
startTime: { gt: weekEnd },
|
|
3216
|
+
status: { not: "CANCELLED" }
|
|
3217
|
+
}, visibleCalendarIds),
|
|
3218
|
+
include: DASHBOARD_INCLUDE,
|
|
3219
|
+
orderBy: { startTime: "asc" },
|
|
3220
|
+
take: UPCOMING_LIMIT
|
|
3221
|
+
}),
|
|
3222
|
+
db.appointment.count({
|
|
3223
|
+
where: withCalendarVisibility({
|
|
3224
|
+
startTime: { gt: weekEnd },
|
|
3225
|
+
status: { not: "CANCELLED" }
|
|
3226
|
+
}, visibleCalendarIds)
|
|
3227
|
+
})
|
|
3210
3228
|
]);
|
|
3211
3229
|
return {
|
|
3212
3230
|
today: todayAppointments.map(mapToDashboardItem),
|
|
3213
3231
|
week: weekAppointments.map(mapToDashboardItem),
|
|
3214
3232
|
history: historyAppointments.map(mapToDashboardItem),
|
|
3233
|
+
upcoming: upcomingAppointments.map(mapToDashboardItem),
|
|
3234
|
+
upcomingTotal,
|
|
3215
3235
|
stats: {
|
|
3216
3236
|
todayTotal,
|
|
3217
3237
|
todayConfirmed: todayTotal - todayCancelled,
|
package/dist/index.mjs
CHANGED
|
@@ -3027,6 +3027,7 @@ var DASHBOARD_INCLUDE = {
|
|
|
3027
3027
|
calendar: { select: { name: true, staffName: true } }
|
|
3028
3028
|
};
|
|
3029
3029
|
var PAGE_SIZE = 20;
|
|
3030
|
+
var UPCOMING_LIMIT = 50;
|
|
3030
3031
|
var DEFAULT_DASHBOARD_TIMEZONE = "America/Detroit";
|
|
3031
3032
|
function preciseDayEnd(truncatedEnd) {
|
|
3032
3033
|
return new Date(truncatedEnd.getTime() + 59e3);
|
|
@@ -3077,7 +3078,9 @@ async function getAppointmentDashboard(db, query = {}) {
|
|
|
3077
3078
|
weekTotal,
|
|
3078
3079
|
weekCancelled,
|
|
3079
3080
|
historyAppointments,
|
|
3080
|
-
historyTotal
|
|
3081
|
+
historyTotal,
|
|
3082
|
+
upcomingAppointments,
|
|
3083
|
+
upcomingTotal
|
|
3081
3084
|
] = await Promise.all([
|
|
3082
3085
|
db.appointment.findMany({
|
|
3083
3086
|
where: withCalendarVisibility({
|
|
@@ -3114,12 +3117,29 @@ async function getAppointmentDashboard(db, query = {}) {
|
|
|
3114
3117
|
skip: (page - 1) * pageSize,
|
|
3115
3118
|
take: pageSize
|
|
3116
3119
|
}),
|
|
3117
|
-
db.appointment.count({ where: scopedHistoryWhere })
|
|
3120
|
+
db.appointment.count({ where: scopedHistoryWhere }),
|
|
3121
|
+
db.appointment.findMany({
|
|
3122
|
+
where: withCalendarVisibility({
|
|
3123
|
+
startTime: { gt: weekEnd },
|
|
3124
|
+
status: { not: "CANCELLED" }
|
|
3125
|
+
}, visibleCalendarIds),
|
|
3126
|
+
include: DASHBOARD_INCLUDE,
|
|
3127
|
+
orderBy: { startTime: "asc" },
|
|
3128
|
+
take: UPCOMING_LIMIT
|
|
3129
|
+
}),
|
|
3130
|
+
db.appointment.count({
|
|
3131
|
+
where: withCalendarVisibility({
|
|
3132
|
+
startTime: { gt: weekEnd },
|
|
3133
|
+
status: { not: "CANCELLED" }
|
|
3134
|
+
}, visibleCalendarIds)
|
|
3135
|
+
})
|
|
3118
3136
|
]);
|
|
3119
3137
|
return {
|
|
3120
3138
|
today: todayAppointments.map(mapToDashboardItem),
|
|
3121
3139
|
week: weekAppointments.map(mapToDashboardItem),
|
|
3122
3140
|
history: historyAppointments.map(mapToDashboardItem),
|
|
3141
|
+
upcoming: upcomingAppointments.map(mapToDashboardItem),
|
|
3142
|
+
upcomingTotal,
|
|
3123
3143
|
stats: {
|
|
3124
3144
|
todayTotal,
|
|
3125
3145
|
todayConfirmed: todayTotal - todayCancelled,
|