workingGroups.graphql 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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 title"
  116. title: String
  117. "Opening short description"
  118. shortDescription: String
  119. "Opening description (md-formatted)"
  120. description: String
  121. "Expected max. number of applicants that will be hired"
  122. hiringLimit: Int
  123. "Expected time when the opening will close"
  124. expectedEnding: DateTime
  125. "Md-formatted text explaining the application process"
  126. applicationDetails: String
  127. "List of questions that should be answered during application"
  128. applicationFormQuestions: [ApplicationFormQuestion!] @derivedFrom(field: "openingMetadata")
  129. }
  130. type WorkingGroupOpening @entity {
  131. "Opening id ({workingGroupName}-{openingId})"
  132. id: ID!
  133. "OpeningId in specific working group module"
  134. runtimeId: Int!
  135. "Related working group"
  136. group: WorkingGroup!
  137. "List of opening applications"
  138. applications: [WorkingGroupApplication!] @derivedFrom(field: "opening")
  139. "Type of the opening (Leader/Regular)"
  140. type: WorkingGroupOpeningType!
  141. "Current opening status"
  142. status: WorkingGroupOpeningStatus!
  143. "Opening metadata"
  144. metadata: WorkingGroupOpeningMetadata!
  145. "Min. application/role stake amount"
  146. stakeAmount: BigInt!
  147. "Role stake unstaking period in blocks"
  148. unstakingPeriod: Int!
  149. "Initial workers' reward per block"
  150. rewardPerBlock: BigInt!
  151. "Event the opening was created in"
  152. createdInEvent: OpeningAddedEvent! @derivedFrom(field: "opening")
  153. "Time of opening creation"
  154. createdAt: DateTime!
  155. }
  156. type UpcomingWorkingGroupOpening @entity {
  157. "Event the upcoming opening was created in"
  158. createdInEvent: StatusTextChangedEvent!
  159. "Related working group"
  160. group: WorkingGroup!
  161. "Expected opening start time"
  162. expectedStart: DateTime
  163. "Expected min. application/role stake amount"
  164. stakeAmount: BigInt
  165. "Expected reward per block"
  166. rewardPerBlock: BigInt
  167. "Opening metadata"
  168. metadata: WorkingGroupOpeningMetadata!
  169. }
  170. type ApplicationStatusPending @variant {
  171. # No additional information needed
  172. _phantom: Int
  173. }
  174. type ApplicationStatusAccepted @variant {
  175. "Related OpeningFilled event"
  176. openingFilledEvent: OpeningFilledEvent!
  177. }
  178. type ApplicationStatusRejected @variant {
  179. "Related OpeningFilled event"
  180. openingFilledEvent: OpeningFilledEvent!
  181. }
  182. type ApplicationStatusCancelled @variant {
  183. "Related OpeningCanceled event"
  184. openingCanceledEvent: OpeningCanceledEvent!
  185. }
  186. type ApplicationStatusWithdrawn @variant {
  187. "Related ApplicationWithdrawn event"
  188. applicationWithdrawnEvent: ApplicationWithdrawnEvent!
  189. }
  190. union WorkingGroupApplicationStatus =
  191. ApplicationStatusPending
  192. | ApplicationStatusAccepted
  193. | ApplicationStatusRejected
  194. | ApplicationStatusWithdrawn
  195. | ApplicationStatusCancelled
  196. type WorkingGroupApplication @entity {
  197. "Application id ({workingGroupName}-{applicationId})"
  198. id: ID!
  199. "ApplicationId in specific working group module"
  200. runtimeId: Int!
  201. "Related working group opening"
  202. opening: WorkingGroupOpening!
  203. "Applicant's membership"
  204. applicant: Membership!
  205. "Application stake"
  206. stake: BigInt!
  207. "Applicant's initial role account"
  208. roleAccount: String!
  209. "Applicant's initial reward account"
  210. rewardAccount: String!
  211. "Applicant's initial staking account"
  212. stakingAccount: String!
  213. "Answers to application form questions"
  214. answers: [ApplicationFormQuestionAnswer!] @derivedFrom(field: "application")
  215. "Current application status"
  216. status: WorkingGroupApplicationStatus!
  217. "Event the application was created in"
  218. createdInEvent: AppliedOnOpeningEvent! @derivedFrom(field: "application")
  219. }
  220. type ApplicationFormQuestionAnswer @entity {
  221. "Related application"
  222. application: WorkingGroupApplication!
  223. "The question beeing answered"
  224. question: ApplicationFormQuestion!
  225. "Applicant's answer"
  226. answer: String!
  227. }
  228. enum ApplicationFormQuestionType {
  229. TEXT
  230. TEXTAREA
  231. }
  232. type ApplicationFormQuestion @entity {
  233. "Related opening metadata"
  234. openingMetadata: WorkingGroupOpeningMetadata!
  235. "The question itself"
  236. question: String
  237. "Type of the question (UI answer input type)"
  238. type: ApplicationFormQuestionType!
  239. "Index of the question"
  240. index: Int!
  241. }