workingGroups.graphql 7.5 KB

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