mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 01:35:39 -04:00
feat: add upcoming episodes and movies timeline (#17)
This commit is contained in:
@@ -2,6 +2,7 @@ import {
|
||||
getContinueWatchingFeed,
|
||||
getLibraryFeed,
|
||||
getRecommendationsFeed,
|
||||
getUpcomingFeed,
|
||||
getUserStats,
|
||||
getWatchCount,
|
||||
getWatchHistory,
|
||||
@@ -87,6 +88,27 @@ export const recommendations = os.dashboard.recommendations.use(authed).handler(
|
||||
return { items };
|
||||
});
|
||||
|
||||
export const upcoming = os.dashboard.upcoming.use(authed).handler(({ input, context }) => {
|
||||
const result = getUpcomingFeed(context.user.id, {
|
||||
days: input.days,
|
||||
limit: input.limit,
|
||||
cursor: input.cursor,
|
||||
});
|
||||
return {
|
||||
items: result.items.map((item) => ({
|
||||
...item,
|
||||
posterPath: tmdbImageUrl(item.posterPath, "posters"),
|
||||
streamingProvider: item.streamingProvider
|
||||
? {
|
||||
...item.streamingProvider,
|
||||
logoPath: tmdbImageUrl(item.streamingProvider.logoPath, "logos"),
|
||||
}
|
||||
: null,
|
||||
})),
|
||||
nextCursor: result.nextCursor,
|
||||
};
|
||||
});
|
||||
|
||||
export const watchHistory = os.dashboard.watchHistory.use(authed).handler(({ input, context }) => {
|
||||
const coreType = watchHistoryTypeMap[input.type];
|
||||
const count = getWatchCount(context.user.id, coreType, input.period);
|
||||
|
||||
@@ -40,6 +40,7 @@ export const implementedRouter = {
|
||||
dashboard: {
|
||||
stats: dashboard.stats,
|
||||
continueWatching: dashboard.continueWatching,
|
||||
upcoming: dashboard.upcoming,
|
||||
library: dashboard.library,
|
||||
recommendations: dashboard.recommendations,
|
||||
watchHistory: dashboard.watchHistory,
|
||||
|
||||
Reference in New Issue
Block a user