Fixed default value for ordering correctly (#6372)
parent
9cb9ce2e42
commit
6c5ae0b4d9
|
@ -38,7 +38,7 @@ async function leastRecentlyBookedUser<T extends Pick<User, "id">>({
|
||||||
|
|
||||||
const userIdAndAtCreatedPair = usersWithLastCreated.reduce(
|
const userIdAndAtCreatedPair = usersWithLastCreated.reduce(
|
||||||
(keyValuePair: { [key: number]: Date }, user) => {
|
(keyValuePair: { [key: number]: Date }, user) => {
|
||||||
keyValuePair[user.id] = user.bookings[0]?.createdAt;
|
keyValuePair[user.id] = user.bookings[0]?.createdAt || new Date(0);
|
||||||
return keyValuePair;
|
return keyValuePair;
|
||||||
},
|
},
|
||||||
{}
|
{}
|
||||||
|
|
Loading…
Reference in New Issue