workingGroups.graphql 7.6 KB

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