views.ts 993 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { gql } from 'apollo-server-express'
  2. import { EntityViewsInfo } from '../../src/entities/EntityViewsInfo'
  3. export const GET_VIDEO_VIEWS = gql`
  4. query GetVideoViews($videoId: ID!) {
  5. videoViews(videoId: $videoId) {
  6. id
  7. views
  8. }
  9. }
  10. `
  11. export type GetVideoViews = {
  12. videoViews: EntityViewsInfo | null
  13. }
  14. export type GetVideoViewsArgs = {
  15. videoId: string
  16. }
  17. export const GET_CHANNEL_VIEWS = gql`
  18. query GetChannelViews($channelId: ID!) {
  19. channelViews(channelId: $channelId) {
  20. id
  21. views
  22. }
  23. }
  24. `
  25. export type GetChannelViews = {
  26. channelViews: EntityViewsInfo | null
  27. }
  28. export type GetChannelViewsArgs = {
  29. channelId: string
  30. }
  31. export const ADD_VIDEO_VIEW = gql`
  32. mutation AddVideoView($videoId: ID!, $channelId: ID!) {
  33. addVideoView(videoId: $videoId, channelId: $channelId) {
  34. id
  35. views
  36. }
  37. }
  38. `
  39. export type AddVideoView = {
  40. addVideoView: EntityViewsInfo
  41. }
  42. export type AddVideoViewArgs = {
  43. videoId: string
  44. channelId: string
  45. }