schema.graphql 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  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: Bytes!
  34. "Member's root account id"
  35. rootAccount: Bytes!
  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. }
  116. "Owner type for storage object"
  117. enum AssetOwner {
  118. MEMBER
  119. CHANNEL
  120. DAO
  121. COUNCIL
  122. WORKING_GROUP
  123. }
  124. """
  125. This type is to keep which entity belongs to which class. This type will be used
  126. by EntityCreated event. When a new schema support added to an Entity we will get the
  127. class name from this table.
  128. We need this because we can't create a database row (Channel, Video etc) without
  129. with empty fields.
  130. """
  131. type ClassEntity @entity {
  132. "Runtime entity identifier (EntityId)"
  133. id: ID!
  134. "The class id of this entity"
  135. classId: Int!
  136. happenedIn: Block!
  137. }
  138. "Keep track of the next entity id"
  139. type NextEntityId @entity {
  140. "Constant field is set to '1'"
  141. id: ID!
  142. nextId: Int!
  143. }
  144. #### High Level Derivative Entities ####
  145. type Language @entity {
  146. "Runtime entity identifier (EntityId)"
  147. id: ID!
  148. "Language identifier ISO 639-1"
  149. iso: String!
  150. happenedIn: Block!
  151. }
  152. type Channel @entity {
  153. "Runtime entity identifier (EntityId)"
  154. id: ID!
  155. # "Owner of the channel" Commenting out this field: 'owner' can be curator_group, lead
  156. # or a member. We are not handling events related to curator group so we will not set this field
  157. # owner: Member!
  158. category: ChannelCategory
  159. "The title of the Channel"
  160. title: String @fulltext(query: "search")
  161. "The description of a Channel"
  162. description: String
  163. "Channel's cover (background) photo. Recommended ratio: 16:9."
  164. coverPhoto: Asset
  165. "Channel's avatar photo."
  166. avatarPhoto: Asset
  167. "Flag signaling whether a channel is public."
  168. isPublic: Boolean
  169. "Flag signaling whether a channel is censored."
  170. isCensored: Boolean!
  171. "The primary langauge of the channel's content"
  172. language: Language
  173. videos: [Video!] @derivedFrom(field: "channel")
  174. happenedIn: Block!
  175. }
  176. type VideoCategory @entity {
  177. "Runtime entity identifier (EntityId)"
  178. id: ID!
  179. "The name of the category"
  180. name: String @fulltext(query: "videoCategoriesByName")
  181. videos: [Video!] @derivedFrom(field: "category")
  182. happenedIn: Block!
  183. }
  184. type KnownLicenseEntity @entity {
  185. "Runtime entity identifier (EntityId)"
  186. id: ID!
  187. "Short, commonly recognized code of the licence (ie. CC_BY_SA)"
  188. code: String! @unique
  189. "Full, descriptive name of the license (ie. Creative Commons - Attribution-NonCommercial-NoDerivs)"
  190. name: String
  191. "Short description of the license conditions"
  192. description: String
  193. "An url pointing to full license content"
  194. url: String
  195. happenedIn: Block!
  196. }
  197. type UserDefinedLicenseEntity @entity {
  198. "Runtime entity identifier (EntityId)"
  199. id: ID!
  200. "Custom license content"
  201. content: String!
  202. happenedIn: Block!
  203. }
  204. type Video @entity {
  205. "Runtime entity identifier (EntityId)"
  206. id: ID!
  207. "Reference to member's channel"
  208. channel: Channel!
  209. "Reference to a video category"
  210. category: VideoCategory
  211. "The title of the video"
  212. title: String @fulltext(query: "search")
  213. "The description of the Video"
  214. description: String
  215. "Video duration in seconds"
  216. duration: Int
  217. "Video thumbnail (recommended ratio: 16:9)"
  218. thumbnail: Asset
  219. "Video's main langauge"
  220. language: Language
  221. "Whether or not Video contains marketing"
  222. hasMarketing: Boolean
  223. "If the Video was published on other platform before beeing published on Joystream - the original publication date"
  224. publishedBeforeJoystream: DateTime
  225. "Whether the Video is supposed to be publically displayed"
  226. isPublic: Boolean
  227. "Flag signaling whether a video is censored."
  228. isCensored: Boolean!
  229. "Whether the Video contains explicit material."
  230. isExplicit: Boolean
  231. license: License
  232. "Encoding of the video media object"
  233. codecName: String
  234. "Media container format"
  235. container: String
  236. "Content MIME type"
  237. mimeMediaType: String
  238. "Video media width in pixels"
  239. pixelWidth: Int
  240. "Video media height in pixels"
  241. pixelHeight: Int
  242. "Video media size in bytes"
  243. size: Int
  244. "Reference to video asset"
  245. media: Asset
  246. happenedIn: Block!
  247. "Is video featured or not"
  248. isFeatured: Boolean!
  249. featured: FeaturedVideo @derivedFrom(field: "video")
  250. }
  251. type License @entity {
  252. "Runtime entity identifier (EntityId)"
  253. id: ID!
  254. "License code defined by Joystream"
  255. code: Int
  256. "Attribution (if required by the license)"
  257. attribution: String
  258. "Custom license content"
  259. custom_text: String
  260. }
  261. type FeaturedVideo @entity {
  262. "Runtime entity identifier (EntityId)"
  263. id: ID!
  264. "Reference to a video"
  265. video: Video!
  266. }