-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
100 lines (93 loc) · 3.76 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
enum PaymentStatus {
PENDING
PAID
NOT_PAID
CANCELLED
CONFLICT
}
enum LeaseStatus {
ACTIVE
PENDING
ENDED
CANCELLED
}
enum ProposalStatus {
PENDING
ACCEPTED
REJECTED
}
type User @entity {
id: ID! # Tenant token id
handle: String! # User handle
address: Bytes! # User address
createdAt: BigInt # timestamp of block creation
updatedAt: BigInt # timestamp of the last change
cid: String # metadata cid of the User
ownerleases: [Lease!] @derivedFrom(field: "owner")# Leases linked to the User as an owner
tenantleases: [Lease!] @derivedFrom(field: "tenant")# Leases linked to the User as a tenant
# Field below Useful ?
rentPayments: [RentPayment!] @derivedFrom(field: "tenant")# Rents linked to the User
}
type Lease @entity {
id: ID! # Token index
type: String! # Lease type (OPEN, FIXED)
tenant: User # Tenant id
owner: User # Owner id
rentAmount: BigInt! # Rent amount
totalNumberOfRents: BigInt! # Total number of rents
paymentToken: Bytes! # Payment token
currencyPair: String! # Currency pair (e.g. ETH-DAI)
rentPaymentInterval: BigInt! # Rent payment interval
startDate: BigInt! # Start date
status: LeaseStatus! # Status
createdAt: BigInt # timestamp of creation
updatedAt: BigInt # timestamp of the last change
uri: String # metadata URI of the lease
tenantReviewUri: String # metadata URI of the tenant review
ownerReviewUri: String # metadata URI of the owner review
cancelledByOwner: Boolean! # true if cancelled by owner
cancelledByTenant: Boolean! # true if cancelled by tenant
rentPayments: [RentPayment!] @derivedFrom(field: "lease")# Rents linked to the Lease
proposal: [Proposal!] @derivedFrom(field: "lease")# Proposals linked to the Lease
platform: Platform # Platform on which the lease was created
}
type Proposal @entity {
id: ID! # Proposal id - Combination of lease id + user id
tenant: User # Tenant id
owner: User # Owner id
lease: Lease # Associated lease
totalNumberOfRents: BigInt! # Total number of rents
startDate: BigInt! # Start date
cid: String # metadata cid of the lease
status: ProposalStatus! # Status of the proposal
createdAt: BigInt # timestamp of creation
updatedAt: BigInt # timestamp of the last change
platform: Platform # Platform on which the proposal was created
}
type RentPayment @entity {
id: ID! # Concatenation of Lease id + rent index
amount: BigInt! # Rent amount
paymentToken: Bytes! # Payment token
validationDate: BigInt! # Rent payment date (unix timestamp)
rentPaymentDate: BigInt! # Rent payment date (unix timestamp)
rentPaymentLimitDate: BigInt! # Rent payment limit date (unix timestamp)
exchangeRate: BigInt! # Exchange rate of the transaction (0 if rent in crypto or if not paid or cancelled)
exchangeRateTimestamp: BigInt! # Timestamp when exchange rate was fetched (0 if rent in crypto or if not paid or cancelled)
withoutIssues: Boolean! #
tenant: User # Tenant
owner: User # Owner
lease: Lease # Associated lease
status: PaymentStatus! # Payment status
}
type Platform @entity {
id: ID! # Platform id
name: String! # Platform name
address: Bytes! # Platform address
originLeaseFeeRate: BigInt! # Fee (per 10,000) asked by the platform on which the Lease was validated
originProposalFeeRate: BigInt! # Fee (per 10,000) asked by the platform on which the proposal was validated
leasePostingFee: BigInt! # Flat fee asked by the platform to post a Lease
proposalPostingFee: BigInt! # Flat fee asked by the platform to post a service
createdAt: BigInt # timestamp of block creation
updatedAt: BigInt # timestamp of the last change
cid: String # metadata cid of the platform
}