schema.graphql 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. enum Network {
  2. BABYLON
  3. ALEXANDRIA
  4. ROME
  5. }
  6. type Block @entity {
  7. "Block number as a string"
  8. id: ID!
  9. block: Int!
  10. timestamp: BigInt!
  11. network: Network!
  12. }
  13. "Stored information about a registered user"
  14. type Member @entity {
  15. "MemberId: runtime identifier for a user"
  16. id: ID!
  17. "The unique handle chosen by member"
  18. handle: String @unique @fulltext(query: "handles")
  19. "A Url to member's Avatar image"
  20. avatarUri: String
  21. "Short text chosen by member to share information about themselves"
  22. about: String
  23. "Blocknumber when member was registered"
  24. registeredAtBlock: Int!
  25. "Member's controller account id"
  26. controllerAccount: Bytes!
  27. "Member's root account id"
  28. rootAccount: Bytes!
  29. happenedIn: Block!
  30. }
  31. """
  32. This type is to keep which entity belongs to which class. This type will be used
  33. by EntityCreated event. When a new schema support added to an Entity we will get the
  34. class name from this table.
  35. We need this because we can't create a database row (Channel, Video etc) without
  36. with empty fields.
  37. """
  38. type ClassEntity @entity {
  39. "Runtime entity identifier (EntityId)"
  40. id: ID!
  41. "The class id of this entity"
  42. classId: Int!
  43. happenedIn: Block!
  44. }
  45. "Keep track of the next entity id"
  46. type NextEntityId @entity {
  47. "Constant field is set to '1'"
  48. id: ID!
  49. nextId: Int!
  50. }
  51. #### High Level Derivative Entities ####
  52. type Language @entity {
  53. "Runtime entity identifier (EntityId)"
  54. id: ID!
  55. name: String!
  56. code: String!
  57. happenedIn: Block!
  58. }
  59. type Channel @entity {
  60. "Runtime entity identifier (EntityId)"
  61. id: ID!
  62. # "Owner of the channel" Commenting out this field: 'owner' can be curator_group, lead
  63. # or a member. We are not handling events related to curator group so we will not set this field
  64. # owner: Member!
  65. "The title of the Channel"
  66. title: String! @fulltext(query: "titles")
  67. "The description of a Channel"
  68. description: String!
  69. "Url for Channel's cover (background) photo. Recommended ratio: 16:9."
  70. coverPhotoURL: String!
  71. "Channel's avatar photo."
  72. avatarPhotoURL: String!
  73. "Flag signaling whether a channel is public."
  74. isPublic: Boolean!
  75. "Flag signaling whether a channel is curated/verified."
  76. isCurated: Boolean!
  77. "The primary langauge of the channel's content"
  78. language: Language!
  79. videos: [Video!] @derivedFrom(field: "channel")
  80. happenedIn: Block!
  81. }
  82. type Category @entity {
  83. "Runtime entity identifier (EntityId)"
  84. id: ID!
  85. "The name of the category"
  86. name: String! @unique @fulltext(query: "names")
  87. "The description of the category"
  88. description: String
  89. videos: [Video!] @derivedFrom(field: "category")
  90. happenedIn: Block!
  91. }
  92. "Encoding and containers"
  93. type VideoMediaEncoding @entity {
  94. "Runtime entity identifier (EntityId)"
  95. id: ID!
  96. name: String!
  97. happenedIn: Block!
  98. }
  99. type KnownLicense @entity {
  100. "Runtime entity identifier (EntityId)"
  101. id: ID!
  102. "Short, commonly recognized code of the licence (ie. CC_BY_SA)"
  103. code: String! @unique
  104. "Full, descriptive name of the license (ie. Creative Commons - Attribution-NonCommercial-NoDerivs)"
  105. name: String
  106. "Short description of the license conditions"
  107. description: String
  108. "An url pointing to full license content"
  109. url: String
  110. happenedIn: Block!
  111. }
  112. type UserDefinedLicense @entity {
  113. "Runtime entity identifier (EntityId)"
  114. id: ID!
  115. "Custom license content"
  116. content: String!
  117. happenedIn: Block!
  118. }
  119. type License @entity {
  120. "Runtime entity identifier (EntityId)"
  121. id: ID!
  122. # One of the following field will be non-null
  123. "Reference to a known license"
  124. knownLicense: KnownLicense
  125. "Reference to user-defined license"
  126. userdefinedLicense: UserDefinedLicense
  127. happenedIn: Block!
  128. }
  129. type MediaLocation @entity {
  130. "Runtime entity identifier (EntityId)"
  131. id: ID!
  132. # One of the following field will be non-null
  133. "A reference to HttpMediaLocation"
  134. httpMediaLocation: HttpMediaLocation
  135. "A reference to JoystreamMediaLocation"
  136. joystreamMediaLocation: JoystreamMediaLocation
  137. videoMedia: VideoMedia @derivedFrom(field: "location")
  138. happenedIn: Block!
  139. }
  140. type JoystreamMediaLocation @entity {
  141. "Runtime entity identifier (EntityId)"
  142. id: ID!
  143. "Id of the data object in the Joystream runtime dataDirectory module"
  144. dataObjectId: String! @unique
  145. happenedIn: Block!
  146. }
  147. type HttpMediaLocation @entity {
  148. "Runtime entity identifier (EntityId)"
  149. id: ID!
  150. "The http url pointing to the media"
  151. url: String!
  152. "The port to use when connecting to the http url (defaults to 80)"
  153. port: Int
  154. happenedIn: Block!
  155. }
  156. type VideoMedia @entity {
  157. "Runtime entity identifier (EntityId)"
  158. id: ID!
  159. "Encoding of the video media object"
  160. encoding: VideoMediaEncoding!
  161. "Video media width in pixels"
  162. pixelWidth: Int!
  163. "Video media height in pixels"
  164. pixelHeight: Int!
  165. "Video media size in bytes"
  166. size: Int
  167. video: Video @derivedFrom(field: "media")
  168. "Location of the video media object"
  169. location: MediaLocation!
  170. happenedIn: Block!
  171. }
  172. type Video @entity {
  173. "Runtime entity identifier (EntityId)"
  174. id: ID!
  175. "Reference to member's channel"
  176. channel: Channel!
  177. "Reference to a video category"
  178. category: Category!
  179. "The title of the video"
  180. title: String! @fulltext(query: "titles")
  181. "The description of the Video"
  182. description: String!
  183. "Video duration in seconds"
  184. duration: Int!
  185. "Video's skippable intro duration in seconds"
  186. skippableIntroDuration: Int
  187. "Video thumbnail url (recommended ratio: 16:9)"
  188. thumbnailURL: String!
  189. "Video's main langauge"
  190. language: Language
  191. "Reference to VideoMedia"
  192. media: VideoMedia!
  193. "Whether or not Video contains marketing"
  194. hasMarketing: Boolean
  195. "If the Video was published on other platform before beeing published on Joystream - the original publication date"
  196. publishedBeforeJoystream: Int
  197. "Whether the Video is supposed to be publically displayed"
  198. isPublic: Boolean!
  199. "Video curation status set by the Curator"
  200. isCurated: Boolean!
  201. "Whether the Video contains explicit material."
  202. isExplicit: Boolean!
  203. license: License!
  204. happenedIn: Block!
  205. }