Преглед на файлове

Adjust orion queries arguments

Rafal Pawlow преди 3 години
родител
ревизия
be05cb2a65

+ 3 - 10
src/api/queries/__generated__/baseTypes.generated.ts

@@ -282,8 +282,6 @@ export type Query = {
   mostFollowedChannels: Array<ChannelFollowsInfo>
   /** Get list of most followed channels of all time */
   mostFollowedChannelsAllTime?: Maybe<Array<ChannelFollowsInfo>>
-  /** Get most viewed list of categories */
-  mostViewedCategories?: Maybe<Array<EntityViewsInfo>>
   /** Get list of channels with most views in given period */
   mostViewedChannels?: Maybe<Array<EntityViewsInfo>>
   /** Get list of channels with most views of all time */
@@ -351,21 +349,16 @@ export type QueryMembershipsArgs = {
 
 export type QueryMostFollowedChannelsArgs = {
   limit?: Maybe<Scalars['Int']>
-  period: Scalars['Int']
+  timePeriodDays: Scalars['Int']
 }
 
 export type QueryMostFollowedChannelsAllTimeArgs = {
   limit: Scalars['Int']
 }
 
-export type QueryMostViewedCategoriesArgs = {
-  limit?: Maybe<Scalars['Int']>
-  period: Scalars['Int']
-}
-
 export type QueryMostViewedChannelsArgs = {
   limit?: Maybe<Scalars['Int']>
-  period: Scalars['Int']
+  timePeriodDays: Scalars['Int']
 }
 
 export type QueryMostViewedChannelsAllTimeArgs = {
@@ -374,7 +367,7 @@ export type QueryMostViewedChannelsAllTimeArgs = {
 
 export type QueryMostViewedVideosArgs = {
   limit?: Maybe<Scalars['Int']>
-  period: Scalars['Int']
+  timePeriodDays: Scalars['Int']
 }
 
 export type QueryMostViewedVideosAllTimeArgs = {

+ 8 - 8
src/api/queries/__generated__/channels.generated.tsx

@@ -143,7 +143,7 @@ export type UnfollowChannelMutation = {
 }
 
 export type GetMostViewedChannelsQueryVariables = Types.Exact<{
-  viewedWithinDays: Types.Scalars['Int']
+  timePeriodDays: Types.Scalars['Int']
   limit?: Types.Maybe<Types.Scalars['Int']>
 }>
 
@@ -162,7 +162,7 @@ export type GetMostViewedChannelsAllTimeQuery = {
 }
 
 export type GetMostFollowedChannelsQueryVariables = Types.Exact<{
-  followedWithinDays: Types.Scalars['Int']
+  timePeriodDays: Types.Scalars['Int']
   limit?: Types.Maybe<Types.Scalars['Int']>
 }>
 
@@ -694,8 +694,8 @@ export type UnfollowChannelMutationOptions = Apollo.BaseMutationOptions<
   UnfollowChannelMutationVariables
 >
 export const GetMostViewedChannelsDocument = gql`
-  query GetMostViewedChannels($viewedWithinDays: Int!, $limit: Int) {
-    mostViewedChannels(period: $viewedWithinDays, limit: $limit) {
+  query GetMostViewedChannels($timePeriodDays: Int!, $limit: Int) {
+    mostViewedChannels(timePeriodDays: $timePeriodDays, limit: $limit) {
       id
       views
     }
@@ -714,7 +714,7 @@ export const GetMostViewedChannelsDocument = gql`
  * @example
  * const { data, loading, error } = useGetMostViewedChannelsQuery({
  *   variables: {
- *      viewedWithinDays: // value for 'viewedWithinDays'
+ *      timePeriodDays: // value for 'timePeriodDays'
  *      limit: // value for 'limit'
  *   },
  * });
@@ -794,8 +794,8 @@ export type GetMostViewedChannelsAllTimeQueryResult = Apollo.QueryResult<
   GetMostViewedChannelsAllTimeQueryVariables
 >
 export const GetMostFollowedChannelsDocument = gql`
-  query GetMostFollowedChannels($followedWithinDays: Int!, $limit: Int) {
-    mostFollowedChannels(period: $followedWithinDays, limit: $limit) {
+  query GetMostFollowedChannels($timePeriodDays: Int!, $limit: Int) {
+    mostFollowedChannels(timePeriodDays: $timePeriodDays, limit: $limit) {
       id
       follows
     }
@@ -814,7 +814,7 @@ export const GetMostFollowedChannelsDocument = gql`
  * @example
  * const { data, loading, error } = useGetMostFollowedChannelsQuery({
  *   variables: {
- *      followedWithinDays: // value for 'followedWithinDays'
+ *      timePeriodDays: // value for 'timePeriodDays'
  *      limit: // value for 'limit'
  *   },
  * });

+ 4 - 4
src/api/queries/__generated__/videos.generated.tsx

@@ -124,7 +124,7 @@ export type GetBatchedVideoViewsQuery = {
 }
 
 export type GetMostViewedVideosQueryVariables = Types.Exact<{
-  viewedWithinDays: Types.Scalars['Int']
+  timePeriodDays: Types.Scalars['Int']
   limit?: Types.Maybe<Types.Scalars['Int']>
 }>
 
@@ -487,8 +487,8 @@ export type GetBatchedVideoViewsQueryResult = Apollo.QueryResult<
   GetBatchedVideoViewsQueryVariables
 >
 export const GetMostViewedVideosDocument = gql`
-  query GetMostViewedVideos($viewedWithinDays: Int!, $limit: Int) {
-    mostViewedVideos(period: $viewedWithinDays, limit: $limit) {
+  query GetMostViewedVideos($timePeriodDays: Int!, $limit: Int) {
+    mostViewedVideos(timePeriodDays: $timePeriodDays, limit: $limit) {
       id
       views
     }
@@ -507,7 +507,7 @@ export const GetMostViewedVideosDocument = gql`
  * @example
  * const { data, loading, error } = useGetMostViewedVideosQuery({
  *   variables: {
- *      viewedWithinDays: // value for 'viewedWithinDays'
+ *      timePeriodDays: // value for 'timePeriodDays'
  *      limit: // value for 'limit'
  *   },
  * });

+ 4 - 4
src/api/queries/channels.graphql

@@ -124,8 +124,8 @@ mutation UnfollowChannel($channelId: ID!) {
   }
 }
 
-query GetMostViewedChannels($viewedWithinDays: Int!, $limit: Int) {
-  mostViewedChannels(period: $viewedWithinDays, limit: $limit) {
+query GetMostViewedChannels($timePeriodDays: Int!, $limit: Int) {
+  mostViewedChannels(timePeriodDays: $timePeriodDays, limit: $limit) {
     id
     views
   }
@@ -138,8 +138,8 @@ query GetMostViewedChannelsAllTime($limit: Int!) {
   }
 }
 
-query GetMostFollowedChannels($followedWithinDays: Int!, $limit: Int) {
-  mostFollowedChannels(period: $followedWithinDays, limit: $limit) {
+query GetMostFollowedChannels($timePeriodDays: Int!, $limit: Int) {
+  mostFollowedChannels(timePeriodDays: $timePeriodDays, limit: $limit) {
     id
     follows
   }

+ 2 - 2
src/api/queries/videos.graphql

@@ -118,8 +118,8 @@ query GetBatchedVideoViews($videoIdList: [ID!]!) {
   }
 }
 
-query GetMostViewedVideos($viewedWithinDays: Int!, $limit: Int) {
-  mostViewedVideos(period: $viewedWithinDays, limit: $limit) {
+query GetMostViewedVideos($timePeriodDays: Int!, $limit: Int) {
+  mostViewedVideos(timePeriodDays: $timePeriodDays, limit: $limit) {
     id
     views
   }

+ 4 - 9
src/api/schemas/orion.graphql

@@ -17,7 +17,7 @@ type Mutation {
   """
   Add a single view to the target video's count
   """
-  addVideoView(categoryId: ID, channelId: ID!, videoId: ID!, categoryId: ID): EntityViewsInfo!
+  addVideoView(categoryId: ID, channelId: ID!, videoId: ID!): EntityViewsInfo!
 
   """
   Add a single follow to the target channel
@@ -59,22 +59,17 @@ type Query {
   """
   Get list of most followed channels
   """
-  mostFollowedChannels(limit: Int, period: Int!): [ChannelFollowsInfo!]!
+  mostFollowedChannels(limit: Int, timePeriodDays: Int!): [ChannelFollowsInfo!]!
 
   """
   Get list of most followed channels of all time
   """
   mostFollowedChannelsAllTime(limit: Int!): [ChannelFollowsInfo!]
 
-  """
-  Get most viewed list of categories
-  """
-  mostViewedCategories(limit: Int, period: Int!): [EntityViewsInfo!]
-
   """
   Get list of channels with most views in given period
   """
-  mostViewedChannels(limit: Int, period: Int!): [EntityViewsInfo!]
+  mostViewedChannels(limit: Int, timePeriodDays: Int!): [EntityViewsInfo!]
 
   """
   Get list of channels with most views of all time
@@ -84,7 +79,7 @@ type Query {
   """
   Get most viewed list of videos
   """
-  mostViewedVideos(limit: Int, period: Int!): [EntityViewsInfo!]
+  mostViewedVideos(limit: Int, timePeriodDays: Int!): [EntityViewsInfo!]
 
   """
   Get most viewed list of videos of all time

+ 1 - 1
src/components/TopTenThisWeek.tsx

@@ -4,7 +4,7 @@ import { useMostViewedVideos } from '@/api/hooks'
 import { VideoGallery } from '@/components'
 
 export const TopTenThisWeek = () => {
-  const { videos, loading } = useMostViewedVideos({ limit: 10, viewedWithinDays: 7 })
+  const { videos, loading } = useMostViewedVideos({ limit: 10, timePeriodDays: 7 })
 
   return (
     <section>

+ 1 - 1
src/views/viewer/HomeView.tsx

@@ -26,7 +26,7 @@ export const HomeView: React.FC = () => {
 
   const { mostViewedVideos, loading: mostViewedVideosLoading, error: mostViewedVideosError } = useMostViewedVideosIds({
     limit: 200,
-    viewedWithinDays: 30,
+    timePeriodDays: 30,
   })
   const mostViewedVideosIds = mostViewedVideos?.map((item) => item.id)
 

+ 1 - 1
src/views/viewer/PopularView/PopularView.tsx

@@ -21,7 +21,7 @@ export const PopularView: FC = () => {
   const mostViewedVideosIds = mostViewedVideosAllTime?.map((item) => item.id)
   const { mostViewedChannelsAllTime } = useMostViewedChannelsAllTimeIds({ limit: 15 })
   const mostViewedChannelsAllTimeIds = mostViewedChannelsAllTime?.map((item) => item.id)
-  const { videos, loading } = useMostViewedVideos({ viewedWithinDays: 30, limit: 10 })
+  const { videos, loading } = useMostViewedVideos({ timePeriodDays: 30, limit: 10 })
 
   if (mostViewedVideosError) {
     throw mostViewedVideosError