workingGroups.graphql 7.3 KB

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