workingGroups.graphql 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. type WorkerStatusActive @variant {
  2. # No additional information needed
  3. _phantom: Int
  4. }
  5. type WorkerStatusLeft @variant {
  6. # TODO: Variant relationships
  7. workerStartedLeavingEventId: ID!
  8. # Set when the unstaking period is finished
  9. workerExitedEventId: ID
  10. }
  11. type WorkerStatusTerminated @variant {
  12. # TODO: Variant relationship
  13. terminatedWorkerEventId: ID!
  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. "Block the worker was hired at"
  47. hiredAtBlock: Block!
  48. "Time the worker was hired at"
  49. hiredAtTime: DateTime!
  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. }
  57. type WorkingGroupMetadata @entity {
  58. "Working group status"
  59. status: String
  60. "Working group status message"
  61. statusMessage: String
  62. "Working group about text"
  63. about: String
  64. "Working group description text"
  65. description: String
  66. "Block the metadata was set at"
  67. setAtBlock: Block!
  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. # TODO: Variant relationships
  91. openingCancelledEventId: ID!
  92. }
  93. type OpeningStatusOpen @variant {
  94. # No additional information needed
  95. _phantom: Int
  96. }
  97. type OpeningStatusFilled @variant {
  98. # TODO: Variant relationships
  99. openingFilledEventId: ID!
  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. "Block the opening was created at"
  144. createdAtBlock: Block!
  145. "Time of opening creation"
  146. createdAt: DateTime!
  147. }
  148. type UpcomingWorkingGroupOpening @entity {
  149. "Event the upcoming opening was created in"
  150. createdInEvent: StatusTextChangedEvent! @unique
  151. "Block the upcoming opening was added at"
  152. createdAtBlock: Block!
  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. # TODO: Variant relationships
  170. openingFilledEventId: ID!
  171. }
  172. type ApplicationStatusRejected @variant {
  173. # TODO: Variant relationships
  174. openingFilledEventId: ID!
  175. }
  176. type ApplicationStatusCancelled @variant {
  177. openingCancelledEventId: ID!
  178. }
  179. type ApplicationStatusWithdrawn @variant {
  180. # TODO: Variant relationships
  181. applicationWithdrawnEventId: ID!
  182. }
  183. union WorkingGroupApplicationStatus =
  184. ApplicationStatusPending
  185. | ApplicationStatusAccepted
  186. | ApplicationStatusRejected
  187. | ApplicationStatusWithdrawn
  188. | ApplicationStatusCancelled
  189. type WorkingGroupApplication @entity {
  190. "Application id ({workingGroupName}-{applicationId})"
  191. id: ID!
  192. "ApplicationId in specific working group module"
  193. runtimeId: Int!
  194. "Related working group opening"
  195. opening: WorkingGroupOpening!
  196. "Applicant's membership"
  197. applicant: Membership!
  198. "Application stake"
  199. stake: BigInt!
  200. "Applicant's initial role account"
  201. roleAccount: String!
  202. "Applicant's initial reward account"
  203. rewardAccount: String!
  204. "Applicant's initial staking account"
  205. stakingAccount: String!
  206. "Answers to application form questions"
  207. answers: [ApplicationFormQuestionAnswer!] @derivedFrom(field: "application")
  208. "Current application status"
  209. status: WorkingGroupApplicationStatus!
  210. "Block the application was created at"
  211. createdAtBlock: Block!
  212. "Time of application creation"
  213. createdAt: DateTime!
  214. }
  215. type ApplicationFormQuestionAnswer @entity {
  216. "Related application"
  217. application: WorkingGroupApplication!
  218. "The question beeing answered"
  219. question: ApplicationFormQuestion!
  220. "Applicant's answer"
  221. answer: String!
  222. }
  223. enum ApplicationFormQuestionType {
  224. TEXT
  225. TEXTAREA
  226. }
  227. type ApplicationFormQuestion @entity {
  228. "Related opening metadata"
  229. openingMetadata: WorkingGroupOpeningMetadata!
  230. "The question itself"
  231. question: String
  232. "Type of the question (UI answer input type)"
  233. type: ApplicationFormQuestionType!
  234. "Index of the question"
  235. index: Int!
  236. }