workingGroups.graphql 7.2 KB

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