schema.graphql 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. # temporary type used before `DateTime` type is working
  2. type DateTime @entity {
  3. timestamp: BigInt!
  4. }
  5. enum Network {
  6. BABYLON
  7. ALEXANDRIA
  8. ROME
  9. }
  10. type Block @entity {
  11. "Block number as a string"
  12. id: ID!
  13. block: Int!
  14. executedAt: DateTime!
  15. network: Network!
  16. }
  17. enum MembershipEntryMethod {
  18. PAID
  19. SCREENING
  20. GENESIS
  21. }
  22. "Stored information about a registered user"
  23. type Membership @entity {
  24. "MemberId: runtime identifier for a user"
  25. id: ID!
  26. "The unique handle chosen by member"
  27. handle: String! @unique @fulltext(query: "membersByHandle")
  28. "A Url to member's Avatar image"
  29. avatarUri: String
  30. "Short text chosen by member to share information about themselves"
  31. about: String
  32. "Member's controller account id"
  33. controllerAccount: String!
  34. "Member's root account id"
  35. rootAccount: String!
  36. "Blocknumber when member was registered"
  37. registeredAtBlock: Block!
  38. "Timestamp when member was registered"
  39. registeredAtTime: DateTime!
  40. "How the member was registered"
  41. entry: MembershipEntryMethod!
  42. "The type of subscription the member has purchased if any."
  43. subscription: BigInt
  44. }
  45. "Category of media channel"
  46. type ChannelCategory @entity {
  47. id: ID!
  48. "The name of the category"
  49. name: String @fulltext(query: "channelCategoriesByName")
  50. channels: [Channel!] @derivedFrom(field: "category")
  51. happenedIn: Block!
  52. }
  53. "Storage asset"
  54. union Asset = AssetUrl | AssetStorage
  55. "Asset stored at an external source"
  56. type AssetUrl @variant {
  57. id: ID!
  58. "The http url pointing to the media"
  59. url: String!
  60. }
  61. "Asset was never fully uploaded."
  62. type AssetNeverProvided @variant {
  63. happenedIn: Block!
  64. }
  65. "Asset was deleted and is no longer available."
  66. type AssetDeleted @variant {
  67. happenedIn: Block!
  68. }
  69. "Status of an asset upload"
  70. type AssetUploadStatus @variant {
  71. """
  72. Data object in upload life-cycle.
  73. If this is deleted, then set oldDataObject in its place if it is set and not rejected, otherwise union goes to Deleted.
  74. """
  75. dataObject: AssetDataObject!
  76. """
  77. Possible prior data object which was in some stage of upload life-cycle when new one was initiated.
  78. If accepted, then apps may chose to use old in place of new before it is accepted.
  79. If this is deleted, then set to null.
  80. """
  81. oldDataObject: AssetDataObject
  82. happenedIn: Block!
  83. }
  84. union AssetStorageUploadStatus = AssetNeverProvided | AssetDeleted | AssetUploadStatus
  85. type AssetStorage @variant {
  86. id: ID!
  87. "Upload to content directory status"
  88. uploadStatus: AssetStorageUploadStatus!
  89. }
  90. "The decision of the storage provider when it acts as liaison"
  91. enum LiaisonJudgement {
  92. "Content awaits for a judgment"
  93. PENDING,
  94. "Content accepted"
  95. ACCEPTED,
  96. "Content rejected"
  97. REJECTED,
  98. }
  99. "Manages content ids, type and storage provider decision about it"
  100. type AssetDataObject @entity {
  101. "Content owner"
  102. owner: AssetOwner!
  103. "Content added at"
  104. addedAt: Block!
  105. "Content type id"
  106. typeId: Int!
  107. "Content size in bytes"
  108. size: BigInt!
  109. "Storage provider id of the liaison"
  110. liaisonId: BigInt!
  111. "Storage provider as liaison judgment"
  112. liaisonJudgement: LiaisonJudgement!
  113. "IPFS content id"
  114. ipfsContentId: String!
  115. "Joystream runtime content"
  116. joystreamContentId: String!
  117. }
  118. "Owner type for storage object"
  119. union AssetOwner = AssetOwnerMember | AssetOwnerChannel | AssetOwnerDao | AssetOwnerCouncil | AssetOwnerWorkingGroup
  120. "Asset owned by a member"
  121. type AssetOwnerMember @variant {
  122. "Member identifier"
  123. memberId: BigInt!
  124. }
  125. "Asset owned by a channel"
  126. type AssetOwnerChannel @variant {
  127. "Channel identifier"
  128. channel: Channel!
  129. }
  130. "Asset owned by a DAO"
  131. type AssetOwnerDao @variant {
  132. "DAO identifier"
  133. daoId: BigInt!
  134. }
  135. "Asset owned by the Council"
  136. type AssetOwnerCouncil @variant {
  137. "Variant needs to have at least one property. This value is not used."
  138. dummy: Int!
  139. }
  140. "Asset owned by a WorkingGroup"
  141. type AssetOwnerWorkingGroup @variant {
  142. "Working group identifier"
  143. workingGroupId: BigInt!
  144. }
  145. #### High Level Derivative Entities ####
  146. type Language @entity {
  147. "Runtime entity identifier (EntityId)"
  148. id: ID!
  149. "Language identifier ISO 639-1"
  150. iso: String!
  151. happenedIn: Block!
  152. }
  153. type Channel @entity {
  154. "Runtime entity identifier (EntityId)"
  155. id: ID!
  156. # "Owner of the channel" Commenting out this field: 'owner' can be curator_group, lead
  157. # or a member. We are not handling events related to curator group so we will not set this field
  158. # owner: Member!
  159. category: ChannelCategory
  160. "Reward account where revenue is sent if set."
  161. rewardAccount: String
  162. "The title of the Channel"
  163. title: String @fulltext(query: "search")
  164. "The description of a Channel"
  165. description: String
  166. "Channel's cover (background) photo. Recommended ratio: 16:9."
  167. coverPhoto: Asset
  168. "Channel's avatar photo."
  169. avatarPhoto: Asset
  170. "Flag signaling whether a channel is public."
  171. isPublic: Boolean
  172. "Flag signaling whether a channel is censored."
  173. isCensored: Boolean!
  174. "The primary langauge of the channel's content"
  175. language: Language
  176. videos: [Video!] @derivedFrom(field: "channel")
  177. happenedIn: Block!
  178. }
  179. type VideoCategory @entity {
  180. "Runtime entity identifier (EntityId)"
  181. id: ID!
  182. "The name of the category"
  183. name: String @fulltext(query: "videoCategoriesByName")
  184. videos: [Video!] @derivedFrom(field: "category")
  185. happenedIn: Block!
  186. }
  187. type Video @entity {
  188. "Runtime entity identifier (EntityId)"
  189. id: ID!
  190. "Reference to member's channel"
  191. channel: Channel!
  192. "Reference to a video category"
  193. category: VideoCategory
  194. "The title of the video"
  195. title: String @fulltext(query: "search")
  196. "The description of the Video"
  197. description: String
  198. "Video duration in seconds"
  199. duration: Int
  200. "Video thumbnail (recommended ratio: 16:9)"
  201. thumbnail: Asset
  202. "Video's main langauge"
  203. language: Language
  204. "Whether or not Video contains marketing"
  205. hasMarketing: Boolean
  206. "If the Video was published on other platform before beeing published on Joystream - the original publication date"
  207. publishedBeforeJoystream: DateTime
  208. "Whether the Video is supposed to be publically displayed"
  209. isPublic: Boolean
  210. "Flag signaling whether a video is censored."
  211. isCensored: Boolean!
  212. "Whether the Video contains explicit material."
  213. isExplicit: Boolean
  214. "License under the video is published"
  215. license: License
  216. "Reference to video asset"
  217. media: Asset
  218. "Video file metadata"
  219. mediaMetadata: VideoMediaMetadata
  220. happenedIn: Block!
  221. "Is video featured or not"
  222. isFeatured: Boolean!
  223. featured: FeaturedVideo @derivedFrom(field: "video")
  224. }
  225. type VideoMediaMetadata @entity {
  226. "Runtime entity identifier (EntityId)"
  227. id: ID!
  228. "Encoding of the video media object"
  229. encoding: VideoMediaEncoding
  230. "Video media width in pixels"
  231. pixelWidth: Int
  232. "Video media height in pixels"
  233. pixelHeight: Int
  234. "Video media size in bytes"
  235. size: Int
  236. video: Video @derivedFrom(field: "mediaMetadata")
  237. happenedIn: Block!
  238. }
  239. type VideoMediaEncoding @entity {
  240. "Encoding of the video media object"
  241. codecName: String
  242. "Media container format"
  243. container: String
  244. "Content MIME type"
  245. mimeMediaType: String
  246. }
  247. type License @entity {
  248. "Runtime entity identifier (EntityId)"
  249. id: ID!
  250. "License code defined by Joystream"
  251. code: Int
  252. "Attribution (if required by the license)"
  253. attribution: String
  254. "Custom license content"
  255. custom_text: String
  256. }
  257. type FeaturedVideo @entity {
  258. "Runtime entity identifier (EntityId)"
  259. id: ID!
  260. "Reference to a video"
  261. video: Video!
  262. }