From 3b29289dcb904aa75783cba3e009c572ffb7cdbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20Mare=C5=A1?= Date: Wed, 7 May 2025 17:58:33 +0200 Subject: [PATCH] feat: add database query filters and sorts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Vojtěch Mareš --- src/main.mts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main.mts b/src/main.mts index fb8638a..92d8290 100644 --- a/src/main.mts +++ b/src/main.mts @@ -76,6 +76,29 @@ async function queryDatabase(notion: Client, databaseID: string) { const { results, next_cursor } = await notion.databases.query({ database_id: databaseID, start_cursor: cursor, + page_size: 50, + filter: { + and: [ + { + property: "Status", + status: { + does_not_equal: "Done", + }, + }, + { + property: "Status", + status: { + does_not_equal: "Cancelled", + }, + }, + ], + }, + sorts: [ + { + property: "Date", + direction: "ascending", + }, + ], }); pages.push(...results as never[]);