Skip to content

Commit 59c9653

Browse files
authored
Merge pull request #152 from hypercerts-org/fix/filter_on_sales_attestations_count
feat(count): add sales and attestations count input and where filter
2 parents 8dc1468 + 8b372c9 commit 59c9653

File tree

5 files changed

+100
-6
lines changed

5 files changed

+100
-6
lines changed

schema.graphql

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,15 @@ input BasicFractionWhereInput {
202202
}
203203

204204
input BasicHypercertWhereArgs {
205+
attestations_count: NumberSearchOptions
205206
creation_block_number: NumberSearchOptions
206207
creation_block_timestamp: NumberSearchOptions
207208
creator_address: StringSearchOptions
208209
hypercert_id: StringSearchOptions
209210
id: IdSearchOptions
210211
last_update_block_number: NumberSearchOptions
211212
last_update_block_timestamp: NumberSearchOptions
213+
sales_count: NumberSearchOptions
212214
token_id: NumberSearchOptions
213215
uri: StringSearchOptions
214216
}
@@ -447,6 +449,9 @@ type Hypercert {
447449
"""Attestations for the hypercert or parts of its data"""
448450
attestations: GetAttestationsResponse
449451

452+
"""Count of attestations referencing this hypercert"""
453+
attestations_count: Float
454+
450455
"""The contract that the hypercert is associated with"""
451456
contract: Contract
452457

@@ -478,6 +483,9 @@ type Hypercert {
478483
"""Sales related to this hypercert"""
479484
sales: GetSalesResponse
480485

486+
"""Count of sales of fractions that belong to this hypercert"""
487+
sales_count: Float
488+
481489
"""The token ID of the hypercert"""
482490
token_id: EthBigInt
483491

@@ -489,6 +497,9 @@ type Hypercert {
489497
}
490498

491499
type HypercertBaseType {
500+
"""Count of attestations referencing this hypercert"""
501+
attestations_count: Float
502+
492503
"""The UUID of the contract as stored in the database"""
493504
contracts_id: ID
494505
creation_block_number: EthBigInt
@@ -508,6 +519,9 @@ type HypercertBaseType {
508519
"""The metadata for the hypercert as referenced by the uri"""
509520
metadata: Metadata
510521

522+
"""Count of sales of fractions that belong to this hypercert"""
523+
sales_count: Float
524+
511525
"""The token ID of the hypercert"""
512526
token_id: EthBigInt
513527

@@ -540,6 +554,7 @@ input HypercertSortOptions {
540554
"""Arguments for filtering hypercerts"""
541555
input HypercertsWhereArgs {
542556
attestations: BasicAttestationWhereInput
557+
attestations_count: NumberSearchOptions
543558
contract: BasicContractWhereInput
544559
creation_block_number: NumberSearchOptions
545560
creation_block_timestamp: NumberSearchOptions
@@ -550,6 +565,7 @@ input HypercertsWhereArgs {
550565
last_update_block_number: NumberSearchOptions
551566
last_update_block_timestamp: NumberSearchOptions
552567
metadata: BasicMetadataWhereInput
568+
sales_count: NumberSearchOptions
553569
token_id: NumberSearchOptions
554570
uri: StringSearchOptions
555571
}

src/graphql/schemas/inputs/hypercertsInput.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,8 @@ export class BasicHypercertWhereArgs implements WhereOptions<Hypercert> {
2727
uri?: StringSearchOptions;
2828
@Field(() => StringSearchOptions, { nullable: true })
2929
hypercert_id?: StringSearchOptions;
30+
@Field(() => NumberSearchOptions, { nullable: true })
31+
attestations_count?: NumberSearchOptions;
32+
@Field(() => NumberSearchOptions, { nullable: true })
33+
sales_count?: NumberSearchOptions;
3034
}

src/graphql/schemas/resolvers/baseTypes.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,13 @@ export function createBaseResolver<T extends ClassType>(
103103
return queries.data.executeTakeFirst();
104104
}
105105

106-
console.log("got hypercerts queries: ", queries);
107-
108106
return this.supabaseCachingService.db
109107
.transaction()
110108
.execute(async (transaction) => {
111-
console.log("got transaction: ", transaction);
112-
console.log("got transaction execute query: ", queries.data);
113109
const dataRes = await transaction.executeQuery(queries.data);
114110

115-
console.log("got hypercerts data: ", dataRes);
116111
const countRes = await transaction.executeQuery(queries.count);
117112

118-
console.log("got hypercerts data and count: ", dataRes, countRes);
119113
return {
120114
data: dataRes.rows,
121115
count: countRes.rows[0].count,

src/graphql/schemas/typeDefs/baseTypes/hypercertBaseType.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ class HypercertBaseType extends BasicTypeDef {
5151
last_update_block_number?: bigint | number | string;
5252
@Field(() => EthBigInt, { nullable: true })
5353
last_update_block_timestamp?: bigint | number | string;
54+
55+
@Field({
56+
nullable: true,
57+
description: "Count of attestations referencing this hypercert",
58+
})
59+
attestations_count?: number;
60+
61+
@Field({
62+
nullable: true,
63+
description: "Count of sales of fractions that belong to this hypercert",
64+
})
65+
sales_count?: number;
5466
}
5567

5668
export { HypercertBaseType };

src/types/graphql-env.d.ts

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,14 @@ export type introspection = {
10121012
"kind": "INPUT_OBJECT",
10131013
"name": "BasicHypercertWhereArgs",
10141014
"inputFields": [
1015+
{
1016+
"name": "attestations_count",
1017+
"type": {
1018+
"kind": "INPUT_OBJECT",
1019+
"name": "NumberSearchOptions",
1020+
"ofType": null
1021+
}
1022+
},
10151023
{
10161024
"name": "creation_block_number",
10171025
"type": {
@@ -1068,6 +1076,14 @@ export type introspection = {
10681076
"ofType": null
10691077
}
10701078
},
1079+
{
1080+
"name": "sales_count",
1081+
"type": {
1082+
"kind": "INPUT_OBJECT",
1083+
"name": "NumberSearchOptions",
1084+
"ofType": null
1085+
}
1086+
},
10711087
{
10721088
"name": "token_id",
10731089
"type": {
@@ -2163,6 +2179,15 @@ export type introspection = {
21632179
},
21642180
"args": []
21652181
},
2182+
{
2183+
"name": "attestations_count",
2184+
"type": {
2185+
"kind": "SCALAR",
2186+
"name": "Float",
2187+
"ofType": null
2188+
},
2189+
"args": []
2190+
},
21662191
{
21672192
"name": "contract",
21682193
"type": {
@@ -2283,6 +2308,15 @@ export type introspection = {
22832308
},
22842309
"args": []
22852310
},
2311+
{
2312+
"name": "sales_count",
2313+
"type": {
2314+
"kind": "SCALAR",
2315+
"name": "Float",
2316+
"ofType": null
2317+
},
2318+
"args": []
2319+
},
22862320
{
22872321
"name": "token_id",
22882322
"type": {
@@ -2317,6 +2351,15 @@ export type introspection = {
23172351
"kind": "OBJECT",
23182352
"name": "HypercertBaseType",
23192353
"fields": [
2354+
{
2355+
"name": "attestations_count",
2356+
"type": {
2357+
"kind": "SCALAR",
2358+
"name": "Float",
2359+
"ofType": null
2360+
},
2361+
"args": []
2362+
},
23202363
{
23212364
"name": "contracts_id",
23222365
"type": {
@@ -2401,6 +2444,15 @@ export type introspection = {
24012444
},
24022445
"args": []
24032446
},
2447+
{
2448+
"name": "sales_count",
2449+
"type": {
2450+
"kind": "SCALAR",
2451+
"name": "Float",
2452+
"ofType": null
2453+
},
2454+
"args": []
2455+
},
24042456
{
24052457
"name": "token_id",
24062458
"type": {
@@ -2559,6 +2611,14 @@ export type introspection = {
25592611
"ofType": null
25602612
}
25612613
},
2614+
{
2615+
"name": "attestations_count",
2616+
"type": {
2617+
"kind": "INPUT_OBJECT",
2618+
"name": "NumberSearchOptions",
2619+
"ofType": null
2620+
}
2621+
},
25622622
{
25632623
"name": "contract",
25642624
"type": {
@@ -2639,6 +2699,14 @@ export type introspection = {
26392699
"ofType": null
26402700
}
26412701
},
2702+
{
2703+
"name": "sales_count",
2704+
"type": {
2705+
"kind": "INPUT_OBJECT",
2706+
"name": "NumberSearchOptions",
2707+
"ofType": null
2708+
}
2709+
},
26422710
{
26432711
"name": "token_id",
26442712
"type": {

0 commit comments

Comments
 (0)