workingGroups.graphql 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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. "Block the worker was hired at"
  43. hiredAtBlock: Block!
  44. "Time the worker was hired at"
  45. hiredAtTime: DateTime!
  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. "Status name"
  55. name: String!
  56. "Status message"
  57. message: String
  58. "Working group about text"
  59. about: String
  60. "Working group description text"
  61. description: String
  62. "Block the status was set at"
  63. setAtBlock: Block!
  64. "The time at which status was set"
  65. setAtTime: DateTime!
  66. }
  67. type WorkingGroup @entity {
  68. "Working group name"
  69. name: String!
  70. "Working group current metadata"
  71. status: WorkingGroupMetadata
  72. "Current working group leader"
  73. leader: Worker
  74. "Workers that currently belong to the group or belonged to the group in the past"
  75. workers: [Worker!] @derivedFrom(field: "group")
  76. "All openings related to this group"
  77. openings: [WorkingGroupOpening!] @derivedFrom(field: "group")
  78. "Current working group budget (JOY)"
  79. budget: BigInt!
  80. # ...
  81. }
  82. type OpeningStatusCancelled @variant {
  83. # TODO: Variant relationships
  84. openingCancelledEventId: ID!
  85. }
  86. type OpeningStatusOpen @variant {
  87. # No additional information needed
  88. _phantom: Int
  89. }
  90. type OpeningStatusFilled @variant {
  91. # TODO: Variant relationships
  92. openingFilledEventId: ID!
  93. }
  94. union WorkingGroupOpeningStatus = OpeningStatusOpen | OpeningStatusFilled | OpeningStatusCancelled
  95. enum WorkingGroupOpeningType {
  96. REGULAR
  97. LEADER
  98. }
  99. type WorkingGroupOpeningMetadata @entity {
  100. "Whether the originally provided metadata was valid"
  101. originallyValid: Boolean!
  102. "Opening short description"
  103. shortDescription: String!
  104. "Opening description (md-formatted)"
  105. description: String!
  106. "Expected max. number of applicants that will be hired"
  107. hiringLimit: Int
  108. "Expected time when the opening will close"
  109. expectedEnding: DateTime
  110. "Md-formatted text explaining the application process"
  111. applicationDetails: String!
  112. "List of questions that should be answered during application"
  113. applicationFormQuestions: [ApplicationFormQuestion!]! @derivedFrom(field: "openingMetadata")
  114. }
  115. type WorkingGroupOpening @entity {
  116. "Opening id ({workingGroupName}-{openingId})"
  117. id: ID!
  118. "OpeningId in specific working group module"
  119. runtimeId: Int!
  120. "Related working group"
  121. group: WorkingGroup!
  122. "List of opening applications"
  123. applications: [WorkingGroupApplication!] @derivedFrom(field: "opening")
  124. "Type of the opening (Leader/Regular)"
  125. type: WorkingGroupOpeningType!
  126. "Current opening status"
  127. status: WorkingGroupOpeningStatus!
  128. "Opening metadata"
  129. metadata: WorkingGroupOpeningMetadata!
  130. "Min. application/role stake amount"
  131. stakeAmount: BigInt!
  132. "Role stake unstaking period in blocks"
  133. unstakingPeriod: Int!
  134. "Initial workers' reward per block"
  135. rewardPerBlock: BigInt!
  136. "Block the opening was created at"
  137. createdAtBlock: Block!
  138. "Time of opening creation"
  139. createdAt: DateTime!
  140. }
  141. type UpcomingWorkingGroupOpening @entity {
  142. "Event the upcoming opening was created in"
  143. createdInEvent: StatusTextChangedEvent! @unique
  144. "Block the upcoming opening was added at"
  145. createdAtBlock: Block!
  146. "Related working group"
  147. group: WorkingGroup!
  148. "Expected opening start time"
  149. expectedStart: DateTime!
  150. "Expected min. application/role stake amount"
  151. stakeAmount: BigInt!
  152. "Expected reward per block"
  153. rewardPerBlock: BigInt!
  154. "Opening metadata"
  155. metadata: WorkingGroupOpeningMetadata!
  156. }
  157. type ApplicationStatusPending @variant {
  158. # No additional information needed
  159. _phantom: Int
  160. }
  161. type ApplicationStatusAccepted @variant {
  162. # TODO: Variant relationships
  163. openingFilledEventId: ID!
  164. }
  165. type ApplicationStatusRejected @variant {
  166. # TODO: Variant relationships
  167. openingFilledEventId: ID!
  168. }
  169. type ApplicationStatusCancelled @variant {
  170. openingCancelledEventId: ID!
  171. }
  172. type ApplicationStatusWithdrawn @variant {
  173. # TODO: Variant relationships
  174. applicationWithdrawnEventId: ID!
  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. "Block the application was created at"
  204. createdAtBlock: Block!
  205. "Time of application creation"
  206. createdAt: DateTime!
  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. }