@@ -8,12 +8,14 @@ import { FeedTable, FollowsTable } from '../../drizzle/schema';
88const statement = getDatabase ( )
99 . select ( )
1010 . from ( FeedTable )
11- . where ( and (
12- eq ( FeedTable . author , sql . placeholder ( 'author' ) ) ,
13- isNull ( FeedTable . removed_at ) ,
14- isNull ( FeedTable . post_hash ) , // Do not return replies
15- gte ( sql `CAST(${ FeedTable . quantity } AS NUMERIC)` , sql `CAST(${ sql . placeholder ( 'minQuantity' ) } AS NUMERIC)` ) ,
16- ) )
11+ . where (
12+ and (
13+ eq ( FeedTable . author , sql . placeholder ( 'author' ) ) ,
14+ isNull ( FeedTable . removed_at ) ,
15+ isNull ( FeedTable . post_hash ) , // Do not return replies
16+ gte ( sql `CAST(${ FeedTable . quantity } AS NUMERIC)` , sql `CAST(${ sql . placeholder ( 'minQuantity' ) } AS NUMERIC)` ) ,
17+ ) ,
18+ )
1719 . limit ( sql . placeholder ( 'limit' ) )
1820 . offset ( sql . placeholder ( 'offset' ) )
1921 . orderBy ( desc ( FeedTable . timestamp ) )
@@ -48,15 +50,17 @@ export async function Posts(query: Gets.PostsQuery) {
4850const followingPostsStatement = getDatabase ( )
4951 . select ( )
5052 . from ( FeedTable )
51- . where ( and (
52- inArray ( FeedTable . author , getDatabase ( )
53- . select ( { following : FollowsTable . following } )
54- . from ( FollowsTable )
55- . where ( and ( eq ( FollowsTable . follower , sql . placeholder ( 'address' ) ) , isNull ( FollowsTable . removed_at ) ) ) ) ,
56- isNull ( FeedTable . post_hash ) ,
57- isNull ( FeedTable . removed_at ) ,
58- gte ( sql `CAST(${ FeedTable . quantity } AS NUMERIC)` , sql `CAST(${ sql . placeholder ( 'minQuantity' ) } AS NUMERIC)` ) ,
59- ) )
53+ . where (
54+ and (
55+ inArray ( FeedTable . author , getDatabase ( )
56+ . select ( { following : FollowsTable . following } )
57+ . from ( FollowsTable )
58+ . where ( and ( eq ( FollowsTable . follower , sql . placeholder ( 'address' ) ) , isNull ( FollowsTable . removed_at ) ) ) ) ,
59+ isNull ( FeedTable . post_hash ) ,
60+ isNull ( FeedTable . removed_at ) ,
61+ gte ( sql `CAST(${ FeedTable . quantity } AS NUMERIC)` , sql `CAST(${ sql . placeholder ( 'minQuantity' ) } AS NUMERIC)` ) ,
62+ ) ,
63+ )
6064 . orderBy ( desc ( FeedTable . timestamp ) )
6165 . limit ( sql . placeholder ( 'limit' ) )
6266 . offset ( sql . placeholder ( 'offset' ) )
0 commit comments