feat: add database query filters and sorts
Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
This commit is contained in:
parent
fe01054742
commit
3b29289dcb
1 changed files with 23 additions and 0 deletions
23
src/main.mts
23
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[]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue