chore: regenerate api-report.md

Signed-off-by: Marek Libra <marek.libra@gmail.com>
This commit is contained in:
Marek Libra
2024-02-28 10:55:20 +01:00
parent 6f13cda324
commit 8740058516
4 changed files with 26 additions and 9 deletions
@@ -228,7 +228,7 @@ describe.each(databases.eachSupportedId())(
await insertNotification({
id: id1,
...testNotification,
created: new Date(Date.now() - 1 * 60 * 60 * 1000 /* an hour ago */),
created: new Date(now - 1 * 60 * 60 * 1000 /* an hour ago */),
});
await insertNotification({
id: id2,
@@ -270,7 +270,7 @@ describe.each(databases.eachSupportedId())(
const notifications = await storage.getNotifications({
user,
createdAfter: new Date(Date.now() - 5 * 60 * 1000 /* 5mins */),
createdAfter: new Date(now - 5 * 60 * 1000 /* 5 mins */),
});
expect(notifications.length).toBe(6);
expect(notifications.at(0)?.id).toEqual(id7);
@@ -171,8 +171,7 @@ export class DatabaseNotificationsStore implements NotificationsStore {
countOptions.sort = null;
const notificationQuery = this.getNotificationsBaseQuery(countOptions);
const response = await notificationQuery.count('* as CNT');
const totalCount = Number.parseInt(response[0].CNT.toString(), 10);
return totalCount;
return Number(response[0].CNT);
}
async saveNotification(notification: Notification) {
@@ -212,8 +212,10 @@ export async function createRouter(
opts.createdAfter = new Date(sinceEpoch);
}
const notifications = await store.getNotifications(opts);
const totalCount = await store.getNotificationsCount(opts);
const [notifications, totalCount] = await Promise.all([
store.getNotifications(opts),
store.getNotificationsCount(opts),
]);
res.send({
totalCount,
notifications,