follows.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import { gql } from 'apollo-server-express'
  2. import { ChannelFollowsInfo } from '../../src/entities/ChannelFollowsInfo'
  3. export const GET_CHANNEL_FOLLOWS = gql`
  4. query GetChannelFollows($channelId: ID!) {
  5. channelFollows(channelId: $channelId) {
  6. id
  7. follows
  8. }
  9. }
  10. `
  11. export const GET_MOST_FOLLOWED_CHANNELS = gql`
  12. query GetMostFollowedChannels($timePeriodDays: Int!) {
  13. mostFollowedChannels(timePeriodDays: $timePeriodDays) {
  14. id
  15. follows
  16. }
  17. }
  18. `
  19. export const GET_MOST_FOLLOWED_CHANNELS_ALL_TIME = gql`
  20. query GetMostFollowedChannelsAllTime($limit: Int!) {
  21. mostFollowedChannelsAllTime(limit: $limit) {
  22. id
  23. follows
  24. }
  25. }
  26. `
  27. export type GetChannelFollows = {
  28. channelFollows: ChannelFollowsInfo | null
  29. }
  30. export type GetChannelFollowsArgs = {
  31. channelId: string
  32. }
  33. export type GetMostFollowedChannelsArgs = {
  34. timePeriodDays: number
  35. }
  36. export type GetMostFollowedChannels = {
  37. mostFollowedChannels: ChannelFollowsInfo[]
  38. }
  39. export type GetMostFollowedChannelsAllTime = {
  40. mostFollowedChannelsAllTime: ChannelFollowsInfo[]
  41. }
  42. export type GetMostFollowedChannelsAllTimeArgs = {
  43. limit: number
  44. }
  45. export const FOLLOW_CHANNEL = gql`
  46. mutation FollowChannel($channelId: ID!) {
  47. followChannel(channelId: $channelId) {
  48. id
  49. follows
  50. }
  51. }
  52. `
  53. export const UNFOLLOW_CHANNEL = gql`
  54. mutation FollowChannel($channelId: ID!) {
  55. unfollowChannel(channelId: $channelId) {
  56. id
  57. follows
  58. }
  59. }
  60. `
  61. export type FollowChannel = {
  62. followChannel: ChannelFollowsInfo
  63. }
  64. export type FollowChannelArgs = {
  65. channelId: string
  66. }
  67. export type UnfollowChannel = {
  68. unfollowChannel: ChannelFollowsInfo
  69. }
  70. export type UnfollowChannelArgs = FollowChannelArgs