Skip to content

Commit

Permalink
Bugfix: fetchLabels (#1862)
Browse files Browse the repository at this point in the history
* fix fetch labels

* tidy

* update cast to parseInt
  • Loading branch information
dholms authored Nov 16, 2023
1 parent b05130d commit e6fb39d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/bsky/src/api/com/atproto/temp/fetchLabels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ export default function (server: Server, ctx: AppContext) {
const db = ctx.db.getReplica()
const since =
params.since !== undefined ? new Date(params.since).toISOString() : ''
const labels = await db.db
const labelRes = await db.db
.selectFrom('label')
.selectAll()
.orderBy('label.cts', 'asc')
.where('cts', '>', since)
.limit(limit)
.execute()

const labels = labelRes.map((l) => ({
...l,
cid: l.cid === '' ? undefined : l.cid,
}))

return {
encoding: 'application/json',
body: {
Expand Down
2 changes: 1 addition & 1 deletion packages/xrpc-server/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function decodeQueryParam(
if (type === 'float') {
return Number(String(value))
} else if (type === 'integer') {
return Number(String(value)) | 0
return parseInt(String(value), 10) || 0
} else if (type === 'boolean') {
return value === 'true'
}
Expand Down

0 comments on commit e6fb39d

Please sign in to comment.