Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

feat: desc order

Nevo David3c625a30a21b
diff --git a/libraries/nestjs-libraries/src/database/prisma/posts/posts.repository.ts b/libraries/nestjs-libraries/src/database/prisma/posts/posts.repository.ts
index 4cd90cc78..2a3b2b205 100644
--- a/libraries/nestjs-libraries/src/database/prisma/posts/posts.repository.ts
+++ b/libraries/nestjs-libraries/src/database/prisma/posts/posts.repository.ts
@@ -255,7 +255,11 @@ export class PostsRepository {
},
],
...stateAndDate,
- publishDate: { gte: dayjs.utc().toDate() },
+ // Published posts were already posted (publishDate in the past), so fetch
+ // all of them; everything else stays upcoming. Ordering handles the rest.
+ ...(stateFilter === 'published'
+ ? {}
+ : { publishDate: { gte: dayjs.utc().toDate() } }),
deletedAt: null as Date | null,
parentPostId: null as string | null,
intervalInDays: null as number | null,