workingGroups.graphql 7.0 KB

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