workingGroups.graphql 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. type WorkerStatusActive @variant {
  2. # No additional information needed
  3. _phantom: Int
  4. }
  5. type WorkerStatusLeaving @variant {
  6. "Related event emitted on leaving initialization"
  7. workerStartedLeavingEvent: WorkerStartedLeavingEvent!
  8. }
  9. type WorkerStatusLeft @variant {
  10. "Related event emitted on leaving initialization"
  11. workerStartedLeavingEvent: WorkerStartedLeavingEvent!
  12. "Related event emitted once the worker has exited the role (after the unstaking period)"
  13. workerExitedEvent: WorkerExitedEvent!
  14. }
  15. type WorkerStatusTerminated @variant {
  16. "Related event emitted on worker termination"
  17. terminatedWorkerEvent: TerminatedWorkerEvent!
  18. }
  19. union WorkerStatus = WorkerStatusActive | WorkerStatusLeaving | WorkerStatusLeft | WorkerStatusTerminated
  20. # Working Groups
  21. type Worker @entity {
  22. "Worker id ({workingGroupName}-{workerId})"
  23. id: ID!
  24. "WorkerId in specific working group module"
  25. runtimeId: Int!
  26. "The group that the worker belongs to"
  27. group: WorkingGroup!
  28. # This exposes internal Hydra value related to `group`. It will be internally set and updated by Hydra.
  29. # See https://github.com/Joystream/joystream/pull/3043 for more info.
  30. "The id the group that the worker belongs to"
  31. groupId: ID!
  32. "Worker membership"
  33. membership: Membership!
  34. "Worker's role account"
  35. roleAccount: String!
  36. "Worker's reward account"
  37. rewardAccount: String!
  38. "Worker's staking account"
  39. stakeAccount: String!
  40. "Current worker status"
  41. status: WorkerStatus!
  42. "Whether the worker is also the working group lead"
  43. isLead: Boolean!
  44. "Whether the worker is currently active"
  45. isActive: Boolean!
  46. "Current role stake (in JOY)"
  47. stake: BigInt!
  48. "Current reward per block"
  49. rewardPerBlock: BigInt!
  50. "The reward amount the worker is currently missing (due to empty working group budget)"
  51. missingRewardAmount: BigInt
  52. "All related reward payouts"
  53. payouts: [RewardPaidEvent!] @derivedFrom(field: "worker")
  54. "All related stake slashes"
  55. slashes: [StakeSlashedEvent!] @derivedFrom(field: "worker")
  56. "The event that caused the worker to be hired"
  57. entry: OpeningFilledEvent!
  58. "Related worker entry application"
  59. application: WorkingGroupApplication!
  60. "Worker's storage data"
  61. storage: String
  62. "Forum categories managed by the worker (required for many-to-many relationship with ForumCategory)"
  63. managedForumCategories: [ForumCategory!] @derivedFrom(field: "moderators")
  64. }
  65. type WorkingGroupMetadata @entity {
  66. "Working group status"
  67. status: String
  68. "Working group status message"
  69. statusMessage: String
  70. "Working group about text"
  71. about: String
  72. "Working group description text"
  73. description: String
  74. "Event the working group metadata was set in"
  75. setInEvent: StatusTextChangedEvent!
  76. "Related group"
  77. group: WorkingGroup!
  78. }
  79. type WorkingGroup @entity {
  80. "Working group id (currently === name)"
  81. id: ID!
  82. "Working group name"
  83. name: String! @unique
  84. "Working group current metadata"
  85. metadata: WorkingGroupMetadata
  86. "Current working group leader"
  87. leader: Worker
  88. "Workers that currently belong to the group or belonged to the group in the past"
  89. workers: [Worker!] @derivedFrom(field: "group")
  90. "All openings related to this group"
  91. openings: [WorkingGroupOpening!] @derivedFrom(field: "group")
  92. "Current working group budget (JOY)"
  93. budget: BigInt!
  94. }
  95. type OpeningStatusCancelled @variant {
  96. "Related event emitted on opening cancellation"
  97. openingCanceledEvent: OpeningCanceledEvent!
  98. }
  99. type OpeningStatusOpen @variant {
  100. # No additional information needed
  101. _phantom: Int
  102. }
  103. type OpeningStatusFilled @variant {
  104. "Related event emitted after filling the opening"
  105. openingFilledEvent: OpeningFilledEvent!
  106. }
  107. union WorkingGroupOpeningStatus = OpeningStatusOpen | OpeningStatusFilled | OpeningStatusCancelled
  108. enum WorkingGroupOpeningType {
  109. REGULAR
  110. LEADER
  111. }
  112. type WorkingGroupOpeningMetadata @entity {
  113. "Whether the originally provided metadata was valid"
  114. originallyValid: Boolean!
  115. "Opening short description"
  116. shortDescription: String
  117. "Opening description (md-formatted)"
  118. description: String
  119. "Expected max. number of applicants that will be hired"
  120. hiringLimit: Int
  121. "Expected time when the opening will close"
  122. expectedEnding: DateTime
  123. "Md-formatted text explaining the application process"
  124. applicationDetails: String
  125. "List of questions that should be answered during application"
  126. applicationFormQuestions: [ApplicationFormQuestion!] @derivedFrom(field: "openingMetadata")
  127. }
  128. type WorkingGroupOpening @entity {
  129. "Opening id ({workingGroupName}-{openingId})"
  130. id: ID!
  131. "OpeningId in specific working group module"
  132. runtimeId: Int!
  133. "Related working group"
  134. group: WorkingGroup!
  135. "List of opening applications"
  136. applications: [WorkingGroupApplication!] @derivedFrom(field: "opening")
  137. "Type of the opening (Leader/Regular)"
  138. type: WorkingGroupOpeningType!
  139. "Current opening status"
  140. status: WorkingGroupOpeningStatus!
  141. "Opening metadata"
  142. metadata: WorkingGroupOpeningMetadata!
  143. "Min. application/role stake amount"
  144. stakeAmount: BigInt!
  145. "Role stake unstaking period in blocks"
  146. unstakingPeriod: Int!
  147. "Initial workers' reward per block"
  148. rewardPerBlock: BigInt!
  149. "Event the opening was created in"
  150. createdInEvent: OpeningAddedEvent! @derivedFrom(field: "opening")
  151. "Time of opening creation"
  152. createdAt: DateTime!
  153. }
  154. type UpcomingWorkingGroupOpening @entity {
  155. "Event the upcoming opening was created in"
  156. createdInEvent: StatusTextChangedEvent!
  157. "Related working group"
  158. group: WorkingGroup!
  159. "Expected opening start time"
  160. expectedStart: DateTime
  161. "Expected min. application/role stake amount"
  162. stakeAmount: BigInt
  163. "Expected reward per block"
  164. rewardPerBlock: BigInt
  165. "Opening metadata"
  166. metadata: WorkingGroupOpeningMetadata!
  167. }
  168. type ApplicationStatusPending @variant {
  169. # No additional information needed
  170. _phantom: Int
  171. }
  172. type ApplicationStatusAccepted @variant {
  173. "Related OpeningFilled event"
  174. openingFilledEvent: OpeningFilledEvent!
  175. }
  176. type ApplicationStatusRejected @variant {
  177. "Related OpeningFilled event"
  178. openingFilledEvent: OpeningFilledEvent!
  179. }
  180. type ApplicationStatusCancelled @variant {
  181. "Related OpeningCanceled event"
  182. openingCanceledEvent: OpeningCanceledEvent!
  183. }
  184. type ApplicationStatusWithdrawn @variant {
  185. "Related ApplicationWithdrawn event"
  186. applicationWithdrawnEvent: ApplicationWithdrawnEvent!
  187. }
  188. union WorkingGroupApplicationStatus =
  189. ApplicationStatusPending
  190. | ApplicationStatusAccepted
  191. | ApplicationStatusRejected
  192. | ApplicationStatusWithdrawn
  193. | ApplicationStatusCancelled
  194. type WorkingGroupApplication @entity {
  195. "Application id ({workingGroupName}-{applicationId})"
  196. id: ID!
  197. "ApplicationId in specific working group module"
  198. runtimeId: Int!
  199. "Related working group opening"
  200. opening: WorkingGroupOpening!
  201. "Applicant's membership"
  202. applicant: Membership!
  203. "Application stake"
  204. stake: BigInt!
  205. "Applicant's initial role account"
  206. roleAccount: String!
  207. "Applicant's initial reward account"
  208. rewardAccount: String!
  209. "Applicant's initial staking account"
  210. stakingAccount: String!
  211. "Answers to application form questions"
  212. answers: [ApplicationFormQuestionAnswer!] @derivedFrom(field: "application")
  213. "Current application status"
  214. status: WorkingGroupApplicationStatus!
  215. "Event the application was created in"
  216. createdInEvent: AppliedOnOpeningEvent! @derivedFrom(field: "application")
  217. }
  218. type ApplicationFormQuestionAnswer @entity {
  219. "Related application"
  220. application: WorkingGroupApplication!
  221. "The question beeing answered"
  222. question: ApplicationFormQuestion!
  223. "Applicant's answer"
  224. answer: String!
  225. }
  226. enum ApplicationFormQuestionType {
  227. TEXT
  228. TEXTAREA
  229. }
  230. type ApplicationFormQuestion @entity {
  231. "Related opening metadata"
  232. openingMetadata: WorkingGroupOpeningMetadata!
  233. "The question itself"
  234. question: String
  235. "Type of the question (UI answer input type)"
  236. type: ApplicationFormQuestionType!
  237. "Index of the question"
  238. index: Int!
  239. }