mirror of
https://github.com/djdevin/recflare.git
synced 2026-09-09 23:21:30 -07:00
[api] update hot avatar custom endpoint
This commit is contained in:
@@ -229,6 +229,26 @@ export async function listFeaturedCustomAvatarItems(
|
||||
return results.map(toDto)
|
||||
}
|
||||
|
||||
/**
|
||||
* The "hot" (trending) feed (`GET /api/customAvatarItems/v1/hot`): every PUBLISHED item —
|
||||
* `Accessibility` 0 is the unpublished state and is the only thing held back. Newest
|
||||
* first, standing in for a trend ranking there is nothing to compute one from yet (no
|
||||
* purchase or wear counts are recorded).
|
||||
*/
|
||||
export async function listHotCustomAvatarItems(
|
||||
db: D1Database,
|
||||
limit = 50
|
||||
): Promise<CustomAvatarItem[]> {
|
||||
const { results } = await db
|
||||
.prepare(
|
||||
`SELECT * FROM custom_avatar_item WHERE accessibility != 0
|
||||
ORDER BY created_at DESC, custom_avatar_item_id LIMIT ?1`
|
||||
)
|
||||
.bind(limit)
|
||||
.all<Row>()
|
||||
return results.map(toDto)
|
||||
}
|
||||
|
||||
/**
|
||||
* What an account has authored (`GET /api/customAvatarItems/v2/fromCreator/:id`), newest
|
||||
* first, with the total for the client's paginated envelope. `includeUnpublished` is for
|
||||
|
||||
Reference in New Issue
Block a user