mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
add published_at to the score api request
This commit is contained in:
parent
88c25844b4
commit
87ad71fbe9
2 changed files with 12 additions and 0 deletions
|
|
@ -36,6 +36,7 @@ interface FeedItem {
|
|||
folder?: string
|
||||
subscriptionType: string
|
||||
score?: number
|
||||
publishedAt?: Date
|
||||
subscription: {
|
||||
id: string
|
||||
name: string
|
||||
|
|
@ -60,6 +61,7 @@ const libraryItemToCandidate = (user: User, item: LibraryItem): FeedItem => ({
|
|||
folder: item.folder,
|
||||
subscriptionType: 'library',
|
||||
score: item.score,
|
||||
publishedAt: item.publishedAt || undefined,
|
||||
subscription: {
|
||||
id: user.id,
|
||||
name: user.name,
|
||||
|
|
@ -85,6 +87,7 @@ const publicItemToCandidate = (item: PublicItem): FeedItem => ({
|
|||
broadcastCount: item.stats.broadcastCount,
|
||||
siteIcon: item.siteIcon,
|
||||
subscriptionType: item.type,
|
||||
publishedAt: item.publishedAt,
|
||||
subscription: {
|
||||
id: item.source.id,
|
||||
name: item.source.name,
|
||||
|
|
@ -161,6 +164,7 @@ const rankCandidates = async (
|
|||
subscription_type: item.subscriptionType,
|
||||
author: item.author,
|
||||
word_count: item.wordCount,
|
||||
published_at: item.publishedAt,
|
||||
} as Feature
|
||||
return acc
|
||||
}, {} as Record<string, Feature>),
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ export interface Feature {
|
|||
word_count?: number
|
||||
subscription_type: string
|
||||
folder: string
|
||||
published_at?: Date
|
||||
}
|
||||
|
||||
export interface ScoreApiRequestBody {
|
||||
|
|
@ -44,4 +45,11 @@ export const getScores = async (
|
|||
|
||||
const scores = (await response.json()) as ScoreApiResponse
|
||||
return scores
|
||||
|
||||
// fake random scores
|
||||
// const scores: ScoreApiResponse = {}
|
||||
// for (const itemId of Object.keys(data.item_features)) {
|
||||
// scores[itemId] = Math.random()
|
||||
// }
|
||||
// return Promise.resolve(scores)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue