Skip to content

Commit 259f56b

Browse files
committed
Fix typescript / linting warnings
1 parent 011ad66 commit 259f56b

File tree

4 files changed

+24
-32
lines changed

4 files changed

+24
-32
lines changed

backend/api/src/get-messages-count.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {APIHandler} from './helpers/endpoint'
22
import {createSupabaseDirectClient} from "shared/supabase/init";
33

4-
export const getMessagesCount: APIHandler<'get-messages-count'> = async (_, auth) => {
4+
export const getMessagesCount: APIHandler<'get-messages-count'> = async (_, _auth) => {
55
const pg = createSupabaseDirectClient()
66
const result = await pg.one(
77
`

backend/api/src/search-users.ts

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
1-
import { constructPrefixTsQuery } from 'shared/helpers/search'
2-
import {
3-
from,
4-
join,
5-
limit,
6-
orderBy,
7-
renderSql,
8-
select,
9-
where,
10-
} from 'shared/supabase/sql-builder'
11-
import { type APIHandler } from './helpers/endpoint'
12-
import { convertUser } from 'common/supabase/users'
13-
import { createSupabaseDirectClient } from 'shared/supabase/init'
14-
import { toUserAPIResponse } from 'common/api/user-types'
15-
import { uniqBy } from 'lodash'
1+
import {constructPrefixTsQuery} from 'shared/helpers/search'
2+
import {from, limit, orderBy, renderSql, select, where,} from 'shared/supabase/sql-builder'
3+
import {type APIHandler} from './helpers/endpoint'
4+
import {convertUser} from 'common/supabase/users'
5+
import {createSupabaseDirectClient} from 'shared/supabase/init'
6+
import {toUserAPIResponse} from 'common/api/user-types'
7+
import {uniqBy} from 'lodash'
168

17-
export const searchUsers: APIHandler<'search-users'> = async (props, auth) => {
18-
const { term, page, limit } = props
9+
export const searchUsers: APIHandler<'search-users'> = async (props, _auth) => {
10+
const {term, page, limit} = props
1911

2012
const pg = createSupabaseDirectClient()
2113

2214
const offset = page * limit
2315
// const userId = auth?.uid
2416
// const searchFollowersSQL = getSearchUserSQL({ term, offset, limit, userId })
25-
const searchAllSQL = getSearchUserSQL({ term, offset, limit })
17+
const searchAllSQL = getSearchUserSQL({term, offset, limit})
2618
const [all] = await Promise.all([
2719
// pg.map(searchFollowersSQL, null, convertUser),
2820
pg.map(searchAllSQL, null, convertUser),
@@ -39,7 +31,7 @@ function getSearchUserSQL(props: {
3931
limit: number
4032
userId?: string // search only this user's followers
4133
}) {
42-
const { term } = props
34+
const {term} = props
4335

4436
return renderSql(
4537
// userId
@@ -50,21 +42,21 @@ function getSearchUserSQL(props: {
5042
// where('user_follows.user_id = $1', [userId]),
5143
// ]
5244
// :
53-
[select('*'), from('users')],
45+
[select('*'), from('users')],
5446
term
5547
? [
56-
where(
57-
`name_username_vector @@ websearch_to_tsquery('english', $1)
48+
where(
49+
`name_username_vector @@ websearch_to_tsquery('english', $1)
5850
or name_username_vector @@ to_tsquery('english', $2)`,
59-
[term, constructPrefixTsQuery(term)]
60-
),
51+
[term, constructPrefixTsQuery(term)]
52+
),
6153

62-
orderBy(
63-
`ts_rank(name_username_vector, websearch_to_tsquery($1)) desc,
54+
orderBy(
55+
`ts_rank(name_username_vector, websearch_to_tsquery($1)) desc,
6456
data->>'lastBetTime' desc nulls last`,
65-
[term]
66-
),
67-
]
57+
[term]
58+
),
59+
]
6860
: orderBy(`data->'creatorTraders'->'allTime' desc nulls last`),
6961
limit(props.limit, props.offset)
7062
)

backend/api/src/send-search-notifications.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const sendSearchNotifications = async () => {
5353

5454
for (const row of searches) {
5555
if (typeof row.search_filters !== 'object') continue;
56-
const { orderBy, ...filters } = (row.search_filters ?? {}) as Record<string, any>
56+
const { _orderBy, ...filters } = (row.search_filters ?? {}) as Record<string, any>
5757
const props = {
5858
...filters,
5959
skipId: row.creator_id,

backend/api/src/serve.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ const startupProcess = async () => {
4040

4141
webSocketListen(httpServer, '/ws')
4242
}
43-
startupProcess().then(r => log('Server started successfully'))
43+
startupProcess().then(_r => log('Server started successfully'))

0 commit comments

Comments
 (0)