types.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. import * as BN from 'bn.js'
  2. import { EntityId, SchemaId, ParametrizedClassPropertyValue, ClassId } from '@joystream/types/content-directory'
  3. import { DB } from '../generated/indexer'
  4. export interface BaseJoystreamMember {
  5. memberId: BN
  6. }
  7. export interface JoystreamMember extends BaseJoystreamMember {
  8. handle: string
  9. avatarUri: string
  10. about: string
  11. registeredAtBlock: number
  12. rootAccount: Buffer
  13. controllerAccount: Buffer
  14. }
  15. export interface MemberAboutText extends BaseJoystreamMember {
  16. about: string
  17. }
  18. export interface MemberAvatarURI extends BaseJoystreamMember {
  19. avatarUri: string
  20. }
  21. export interface MemberHandle extends BaseJoystreamMember {
  22. handle: string
  23. }
  24. export interface MemberRootAccount extends BaseJoystreamMember {
  25. rootAccount: Buffer
  26. }
  27. export interface MemberControllerAccount extends BaseJoystreamMember {
  28. controllerAccount: Buffer
  29. }
  30. export interface IChannel {
  31. title: string
  32. description: string
  33. coverPhotoURL: string
  34. avatarPhotoURL: string
  35. isPublic: boolean
  36. isCurated: boolean
  37. language: number
  38. }
  39. export interface ICategory {
  40. name: string
  41. description: string
  42. }
  43. export interface IKnownLicense {
  44. code: string
  45. name?: string
  46. description?: string
  47. url?: string
  48. }
  49. export interface IUserDefinedLicense {
  50. content: string
  51. }
  52. export interface IJoystreamMediaLocation {
  53. dataObjectId: string
  54. }
  55. export interface IHttpMediaLocation {
  56. url: string
  57. port?: number
  58. }
  59. export interface ILanguage {
  60. name: string
  61. code: string
  62. }
  63. export interface IVideoMediaEncoding {
  64. name: string
  65. }
  66. export interface IVideoMedia {
  67. encoding: number
  68. pixelWidth: number
  69. pixelHeight: number
  70. size: number
  71. location: number
  72. }
  73. export interface IVideo {
  74. // referenced entity's id
  75. channel: number
  76. // referenced entity's id
  77. category: number
  78. title: string
  79. description: string
  80. duration: number
  81. skippableIntroDuration?: number
  82. thumbnailURL: string
  83. language: number
  84. // referenced entity's id
  85. media: number
  86. hasMarketing?: boolean
  87. publishedBeforeJoystream?: number
  88. isPublic: boolean
  89. isCurated: boolean
  90. isExplicit: boolean
  91. license: number
  92. }
  93. export enum OperationType {
  94. CreateEntity = 'CreateEntity',
  95. AddSchemaSupportToEntity = 'AddSchemaSupportToEntity',
  96. UpdatePropertyValues = 'UpdatePropertyValues',
  97. }
  98. export interface IAddSchemaSupportToEntity {
  99. entity_id: EntityId
  100. schema_id: SchemaId
  101. parametrized_property_values: ParametrizedClassPropertyValue[]
  102. }
  103. export interface ICreateEntity {
  104. class_id: ClassId
  105. }
  106. export interface IClassEntity {
  107. entityId: number
  108. classId: number
  109. }
  110. export interface IBatchOperation {
  111. createEntityOperations: ICreateEntityOperation[]
  112. addSchemaSupportToEntityOperations: IEntity[]
  113. updatePropertyValuesOperations: IEntity[]
  114. }
  115. export interface IProperty {
  116. [propertyId: string]: any
  117. // propertyId: string;
  118. // value: any;
  119. }
  120. export interface IEntity {
  121. classId?: number
  122. entityId?: number
  123. // if entity is created in the same transaction, this is the entity id which is the index of the create
  124. // entity operation
  125. indexOf?: number
  126. properties: IProperty[]
  127. }
  128. export interface IPropertyIdWithName {
  129. // propertyId - property name
  130. [propertyId: string]: string
  131. }
  132. export interface IWhereCond {
  133. where: { id: string }
  134. }
  135. export interface ICreateEntityOperation {
  136. classId: number
  137. }
  138. // An interface to use in function signature to simplify function parameters
  139. export interface IDBBlockId {
  140. db: DB
  141. block: number
  142. id: string
  143. }