Browse Source

Make the `BountyEntry.works` field events

Theophile Sandoz 3 years ago
parent
commit
cc03778ec2
2 changed files with 33 additions and 15 deletions
  1. 3 15
      query-node/schemas/bounty.graphql
  2. 30 0
      query-node/schemas/bountyEvents.graphql

+ 3 - 15
query-node/schemas/bounty.graphql

@@ -156,18 +156,6 @@ union BountyEntryStatus =
   | BountyEntryStatusRejected
   | BountyEntryStatusCashedOut
 
-"Work data submitted into an entry"
-type BountyWorkData @entity {
-  "The entry this work was submitted into"
-  entry: BountyEntry!
-
-  "Title of the work"
-  title: String!
-
-  "Description which contains the work itself as a URL, a BLOB, or just text"
-  description: String!
-}
-
 type BountyEntry @entity {
   # Work entry creation parameters:
   "Work Entry Id"
@@ -189,15 +177,15 @@ type BountyEntry @entity {
   "Whether at least one work has been submitted"
   workSubmitted: Boolean!
 
-  "All of the submitted works"
-  works: [BountyWorkData] @derivedFrom(field: "entry")
-
   "Work entry status"
   status: BountyEntryStatus!
 
   # Events
   "The event the work entry was created in"
   announcedInEvent: WorkEntryAnnouncedEvent! @derivedFrom(field: "entry")
+
+  "All of the submitted work events"
+  works: [WorkSubmittedEvent] @derivedFrom(field: "entry")
 }
 
 type BountyContribution @entity {

+ 30 - 0
query-node/schemas/bountyEvents.graphql

@@ -69,3 +69,33 @@ type WorkEntryAnnouncedEvent implements Event @entity {
   "Related work entry"
   entry: BountyEntry!
 }
+
+type WorkSubmittedEvent implements Event @entity {
+  ### GENERIC DATA ###
+
+  "(network}-{blockNumber}-{indexInBlock}"
+  id: ID!
+
+  "Hash of the extrinsic which caused the event to be emitted"
+  inExtrinsic: String
+
+  "Blocknumber of the block in which the event was emitted."
+  inBlock: Int!
+
+  "Network the block was produced in"
+  network: Network!
+
+  "Index of event in block from which it was emitted."
+  indexInBlock: Int!
+
+  ### SPECIFIC DATA ###
+
+  "The entry this work was submitted into"
+  entry: BountyEntry!
+
+  "Title of the work"
+  title: String!
+
+  "Description which contains the work itself as a URL, a BLOB, or just text"
+  description: String!
+}