workingGroups.graphql 7.7 KB

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