-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
100 lines (88 loc) · 2.12 KB
/
schema.graphql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
type Account @entity {
id: ID!
voucher: Voucher @derivedFrom(field: "owner")
role: Role
}
type Role @entity {
id: ID!
name: String
accounts: [Account!]! @derivedFrom(field: "role")
}
type Counter @entity {
id: ID!
count: BigInt!
}
type VoucherType @entity {
id: ID!
description: String!
duration: BigInt!
eligibleAssets: [Asset!]!
vouchers: [Voucher!]! @derivedFrom(field: "voucherType")
}
type Voucher @entity {
id: ID!
owner: Account!
expiration: BigInt!
voucherType: VoucherType!
value: BigDecimal! # last funding value
balance: BigDecimal!
authorizedAccounts: [Account!]!
fundings: [VoucherFunding!]! @derivedFrom(field: "voucher")
deals: [Deal!]! @derivedFrom(field: "sponsor")
}
interface VoucherFunding {
id: ID!
timestamp: BigInt!
value: BigDecimal!
voucher: Voucher!
}
type VoucherCreation implements VoucherFunding @entity {
id: ID!
timestamp: BigInt!
value: BigDecimal!
voucher: Voucher!
}
type VoucherTopUp implements VoucherFunding @entity {
id: ID!
timestamp: BigInt!
value: BigDecimal!
voucher: Voucher!
}
# common interface for all sponsored assets
interface Asset {
id: ID!
voucherTypes: [VoucherType!]!
}
type App implements Asset @entity {
id: ID!
name: String!
usages: [Deal!]! @derivedFrom(field: "app")
voucherTypes: [VoucherType!]! @derivedFrom(field: "eligibleAssets")
}
type Dataset implements Asset @entity {
id: ID!
name: String!
usages: [Deal!]! @derivedFrom(field: "dataset")
voucherTypes: [VoucherType!]! @derivedFrom(field: "eligibleAssets")
}
type Workerpool implements Asset @entity {
id: ID!
description: String!
usages: [Deal!]! @derivedFrom(field: "workerpool")
voucherTypes: [VoucherType!]! @derivedFrom(field: "eligibleAssets")
}
# the Deal entity schema is based on the Deal entity of PoCo-subgraph
type Deal @entity {
id: ID!
sponsor: Voucher # voucher specific
sponsoredAmount: BigDecimal # voucher specific
timestamp: BigInt!
requester: Account!
app: App!
dataset: Dataset
workerpool: Workerpool!
botSize: BigInt!
appPrice: BigDecimal!
datasetPrice: BigDecimal!
workerpoolPrice: BigDecimal!
}