Skip to content

Commit a40d747

Browse files
committed
update slug lookup
1 parent d2b1197 commit a40d747

1 file changed

Lines changed: 24 additions & 18 deletions

File tree

‎frontend/main/src/services/notion.server.ts‎

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -775,28 +775,17 @@ export const queryPurrfectStreamByScheduled = async (
775775
results: [],
776776
} as unknown as NotionPosts;
777777
}
778-
let filter: any = {
779-
and: [
780-
{
781-
property: 'Status',
782-
select: {
783-
equals: 'Scheduled',
784-
},
785-
},
786-
{
787-
property: 'slug',
788-
url: {
789-
is_not_empty: true,
790-
},
791-
},
792-
],
793-
};
778+
let filter: any;
794779

795780
if (slug) {
796781
filter = {
797782
and: [
798-
...filter.and,
799-
783+
{
784+
property: 'Status',
785+
select: {
786+
equals: 'Scheduled',
787+
},
788+
},
800789
{
801790
property: 'slug',
802791
url: {
@@ -805,6 +794,23 @@ export const queryPurrfectStreamByScheduled = async (
805794
},
806795
],
807796
};
797+
} else {
798+
filter = {
799+
and: [
800+
{
801+
property: 'Status',
802+
select: {
803+
equals: 'Scheduled',
804+
},
805+
},
806+
{
807+
property: 'slug',
808+
url: {
809+
is_not_empty: true,
810+
},
811+
},
812+
],
813+
};
808814
}
809815
console.log(filter);
810816
let raw = await notionClient.databases.query({

0 commit comments

Comments
 (0)