workingGroups.graphql 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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. # Set when the unstaking period is finished
  15. workerExitedEventId: ID
  16. }
  17. union WorkerStatus = WorkerStatusActive | WorkerStatusLeft | WorkerStatusTerminated
  18. # Working Groups
  19. type Worker @entity {
  20. "Worker id ({workingGroupName}-{workerId})"
  21. id: ID!
  22. "WorkerId in specific working group module"
  23. runtimeId: Int!
  24. "The group that the worker belongs to"
  25. group: WorkingGroup!
  26. "Worker membership"
  27. membership: Membership!
  28. "Worker's role account"
  29. roleAccount: String!
  30. "Worker's reward account"
  31. rewardAccount: String!
  32. "Worker's staking account"
  33. stakeAccount: String!
  34. "Current worker status"
  35. status: WorkerStatus!
  36. "Whether the worker is also the working group lead"
  37. isLead: Boolean!
  38. "Current role stake (in JOY)"
  39. stake: BigInt!
  40. "All related reward payouts"
  41. payouts: [RewardPaidEvent!] @derivedFrom(field: "worker")
  42. # TODO: should we use createdAt for consistency / doesn't Hydra actually require us to override this field?
  43. "Blocknumber of the block the worker was hired at"
  44. hiredAtBlock: Int!
  45. "Time the worker was hired at"
  46. hiredAtTime: DateTime!
  47. "The event that caused the worker to be hired"
  48. entry: OpeningFilledEvent!
  49. "Related worker entry application"
  50. application: WorkingGroupApplication!
  51. "Worker's storage data"
  52. storage: String
  53. }
  54. type WorkingGroupMetadata @entity {
  55. "Status name"
  56. name: String!
  57. "Status message"
  58. message: String
  59. "Working group about text"
  60. about: String
  61. "Working group description text"
  62. description: String
  63. "Blocknumber of the block at which status was set"
  64. setAtBlock: Int!
  65. "The time at which status was set"
  66. setAtTime: DateTime!
  67. }
  68. type WorkingGroup @entity {
  69. "Working group name"
  70. name: String!
  71. "Working group current metadata"
  72. status: WorkingGroupMetadata
  73. "Current working group leader"
  74. leader: Worker
  75. "Workers that currently belong to the group or belonged to the group in the past"
  76. workers: [Worker!] @derivedFrom(field: "group")
  77. "All openings related to this group"
  78. openings: [WorkingGroupOpening!] @derivedFrom(field: "group")
  79. "Current working group budget (JOY)"
  80. budget: BigInt!
  81. # ...
  82. }
  83. type OpeningStatusCancelled @variant {
  84. # TODO: Variant relationships
  85. openingCancelledEventId: ID!
  86. }
  87. type OpeningStatusOpen @variant {
  88. # No additional information needed
  89. _phantom: Int
  90. }
  91. type OpeningStatusFilled @variant {
  92. # TODO: Variant relationships
  93. openingFilledEventId: ID!
  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. "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. "Blocknumber of opening creation block"
  138. createdAtBlock: Int!
  139. "Time of opening creation"
  140. createdAt: DateTime!
  141. }
  142. type ApplicationStatusPending @variant {
  143. # No additional information needed
  144. _phantom: Int
  145. }
  146. type ApplicationStatusAccepted @variant {
  147. # TODO: Variant relationships
  148. openingFilledEventId: ID!
  149. }
  150. type ApplicationStatusRejected @variant {
  151. # TODO: Variant relationships
  152. openingFilledEventId: ID!
  153. }
  154. type ApplicationStatusCancelled @variant {
  155. openingCancelledEventId: ID!
  156. }
  157. type ApplicationStatusWithdrawn @variant {
  158. # TODO: Variant relationships
  159. applicationWithdrawnEventId: ID!
  160. }
  161. union WorkingGroupApplicationStatus =
  162. ApplicationStatusPending
  163. | ApplicationStatusAccepted
  164. | ApplicationStatusRejected
  165. | ApplicationStatusWithdrawn
  166. | ApplicationStatusCancelled
  167. type WorkingGroupApplication @entity {
  168. "Application id ({workingGroupName}-{applicationId})"
  169. id: ID!
  170. "ApplicationId in specific working group module"
  171. runtimeId: Int!
  172. "Related working group opening"
  173. opening: WorkingGroupOpening!
  174. "Applicant's membership"
  175. applicant: Membership!
  176. "Application stake"
  177. stake: BigInt!
  178. "Applicant's initial role account"
  179. roleAccount: String!
  180. "Applicant's initial reward account"
  181. rewardAccount: String!
  182. "Applicant's initial staking account"
  183. stakingAccount: String!
  184. "Answers to application form questions"
  185. answers: [ApplicationFormQuestionAnswer!] @derivedFrom(field: "application")
  186. "Current application status"
  187. status: WorkingGroupApplicationStatus!
  188. "Blocknumber of application creation block"
  189. createdAtBlock: Int!
  190. "Time of application creation"
  191. createdAt: DateTime!
  192. }
  193. type ApplicationFormQuestionAnswer @entity {
  194. "Related application"
  195. application: WorkingGroupApplication!
  196. "The question beeing answered"
  197. question: ApplicationFormQuestion!
  198. "Applicant's answer"
  199. answer: String!
  200. }
  201. enum ApplicationFormQuestionType {
  202. TEXT
  203. TEXTAREA
  204. }
  205. type ApplicationFormQuestion @entity {
  206. "Related opening metadata"
  207. openingMetadata: WorkingGroupOpeningMetadata!
  208. "The question itself"
  209. question: String!
  210. "Type of the question (UI answer input type)"
  211. type: ApplicationFormQuestionType!
  212. "Index of the question"
  213. index: Int!
  214. }