schema.graphql 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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: "membersByHandle")
  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. handle: String! @fulltext(query: "search")
  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: "categoriesByName")
  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 KnownLicenseEntity @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 UserDefinedLicenseEntity @entity {
  113. "Runtime entity identifier (EntityId)"
  114. id: ID!
  115. "Custom license content"
  116. content: String!
  117. happenedIn: Block!
  118. }
  119. type MediaLocationEntity @entity {
  120. "Runtime entity identifier (EntityId)"
  121. id: ID!
  122. # One of the following field will be non-null
  123. "A reference to HttpMediaLocation"
  124. httpMediaLocation: HttpMediaLocationEntity
  125. "A reference to JoystreamMediaLocation"
  126. joystreamMediaLocation: JoystreamMediaLocationEntity
  127. videoMedia: VideoMedia @derivedFrom(field: "locationEntity")
  128. happenedIn: Block!
  129. }
  130. type JoystreamMediaLocationEntity @entity {
  131. "Runtime entity identifier (EntityId)"
  132. id: ID!
  133. "Id of the data object in the Joystream runtime dataDirectory module"
  134. dataObjectId: String! @unique
  135. happenedIn: Block!
  136. }
  137. type HttpMediaLocationEntity @entity {
  138. "Runtime entity identifier (EntityId)"
  139. id: ID!
  140. "The http url pointing to the media"
  141. url: String!
  142. "The port to use when connecting to the http url (defaults to 80)"
  143. port: Int
  144. happenedIn: Block!
  145. }
  146. type VideoMedia @entity {
  147. "Runtime entity identifier (EntityId)"
  148. id: ID!
  149. "Encoding of the video media object"
  150. encoding: VideoMediaEncoding!
  151. "Video media width in pixels"
  152. pixelWidth: Int!
  153. "Video media height in pixels"
  154. pixelHeight: Int!
  155. "Video media size in bytes"
  156. size: Int
  157. video: Video @derivedFrom(field: "media")
  158. "Location of the video media object"
  159. location: MediaLocation!
  160. locationEntity: MediaLocationEntity
  161. happenedIn: Block!
  162. }
  163. type Video @entity {
  164. "Runtime entity identifier (EntityId)"
  165. id: ID!
  166. "Reference to member's channel"
  167. channel: Channel!
  168. "Reference to a video category"
  169. category: Category!
  170. "The title of the video"
  171. title: String! @fulltext(query: "search")
  172. "The description of the Video"
  173. description: String!
  174. "Video duration in seconds"
  175. duration: Int!
  176. "Video's skippable intro duration in seconds"
  177. skippableIntroDuration: Int
  178. "Video thumbnail url (recommended ratio: 16:9)"
  179. thumbnailUrl: String!
  180. "Video's main langauge"
  181. language: Language
  182. "Reference to VideoMedia"
  183. media: VideoMedia!
  184. "Whether or not Video contains marketing"
  185. hasMarketing: Boolean
  186. "If the Video was published on other platform before beeing published on Joystream - the original publication date"
  187. publishedBeforeJoystream: Int
  188. "Whether the Video is supposed to be publically displayed"
  189. isPublic: Boolean!
  190. "Video curation status set by the Curator"
  191. isCurated: Boolean!
  192. "Whether the Video contains explicit material."
  193. isExplicit: Boolean!
  194. license: LicenseEntity!
  195. happenedIn: Block!
  196. "Is video featured or not"
  197. isFeatured: Boolean!
  198. featured: FeaturedVideo @derivedFrom(field: "video")
  199. }
  200. type JoystreamMediaLocation @variant {
  201. "Id of the data object in the Joystream runtime dataDirectory module"
  202. dataObjectId: String!
  203. }
  204. type HttpMediaLocation @variant {
  205. "The http url pointing to the media"
  206. url: String!
  207. "The port to use when connecting to the http url (defaults to 80)"
  208. port: Int
  209. }
  210. union MediaLocation = HttpMediaLocation | JoystreamMediaLocation
  211. type KnownLicense @variant {
  212. "Short, commonly recognized code of the licence (ie. CC_BY_SA)"
  213. code: String!
  214. "Full, descriptive name of the license (ie. Creative Commons - Attribution-NonCommercial-NoDerivs)"
  215. name: String
  216. "Short description of the license conditions"
  217. description: String
  218. "An url pointing to full license content"
  219. url: String
  220. }
  221. type UserDefinedLicense @variant {
  222. "Custom license content"
  223. content: String!
  224. }
  225. union License = KnownLicense | UserDefinedLicense
  226. type LicenseEntity @entity {
  227. "Runtime entity identifier (EntityId)"
  228. id: ID!
  229. type: License!
  230. "Attribution (if required by the license)"
  231. attribution: String
  232. happenedIn: Block!
  233. }
  234. type FeaturedVideo @entity {
  235. "Runtime entity identifier (EntityId)"
  236. id: ID!
  237. "Reference to a video"
  238. video: Video!
  239. }