Skip to content

Commit b085990

Browse files
committed
feat(hyperboard): enhance hyperboard functionality and restructure related components
- Introduced new fields in hyperboardArgs for collections and improved type definitions in hyperboardTypeDefs. - Migrated HyperboardResolver to services directory - Updated HyperboardService with comprehensive documentation and new methods for managing hyperboard collections and admins. - Documented and tested HyperboardsQueryStrategy for optimized query handling with filtering capabilities. - Added extensive test coverage for HyperboardResolver, HyperboardService, and HyperboardsQueryStrategy, ensuring robust functionality and error handling. - Improved mock data generation utilities for hyperboards and related entities.
1 parent 069f002 commit b085990

File tree

14 files changed

+1767
-336
lines changed

14 files changed

+1767
-336
lines changed

src/graphql/schemas/args/hyperboardArgs.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ import { ArgsType } from "type-graphql";
77
const { WhereInput: HyperboardWhereInput, SortOptions: HyperboardSortOptions } =
88
createEntityArgs("Hyperboard", {
99
...WhereFieldDefinitions.Hyperboard.fields,
10+
collections: {
11+
type: "id",
12+
references: {
13+
entity: EntityTypeDefs.Collection,
14+
fields: WhereFieldDefinitions.Collection.fields,
15+
},
16+
},
1017
admins: {
1118
type: "id",
1219
references: {

src/graphql/schemas/resolvers/composed.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { FractionResolver } from "../../../services/graphql/resolvers/fractionRe
55
import { AttestationResolver } from "../../../services/graphql/resolvers/attestationResolver.js";
66
import { AttestationSchemaResolver } from "../../../services/graphql/resolvers/attestationSchemaResolver.js";
77
import { OrderResolver } from "../../../services/graphql/resolvers/orderResolver.js";
8-
import { HyperboardResolver } from "./hyperboardResolver.js";
8+
import { HyperboardResolver } from "../../../services/graphql/resolvers/hyperboardResolver.js";
99
import { AllowlistRecordResolver } from "../../../services/graphql/resolvers/allowlistRecordResolver.js";
1010
import { SalesResolver } from "../../../services/graphql/resolvers/salesResolver.js";
1111
import { UserResolver } from "../../../services/graphql/resolvers/userResolver.js";

src/graphql/schemas/resolvers/hyperboardResolver.ts

Lines changed: 0 additions & 260 deletions
This file was deleted.

src/graphql/schemas/typeDefs/hyperboardTypeDefs.ts

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
import { Field, ObjectType } from "type-graphql";
2-
import { BasicTypeDef } from "./baseTypes/basicTypeDef.js";
2+
import { DataResponse } from "../../../lib/graphql/DataResponse.js";
33
import { EthBigInt } from "../../scalars/ethBigInt.js";
4-
import GetUsersResponse, { User } from "./userTypeDefs.js";
5-
import { GraphQLBigInt } from "graphql-scalars";
4+
import { BasicTypeDef } from "./baseTypes/basicTypeDef.js";
65
import { Collection } from "./collectionTypeDefs.js";
7-
import { DataResponse } from "../../../lib/graphql/DataResponse.js";
6+
import GetUsersResponse, { User } from "./userTypeDefs.js";
7+
8+
@ObjectType()
9+
export class HyperboardOwner extends User {
10+
@Field()
11+
percentage_owned?: number;
12+
}
13+
14+
@ObjectType()
15+
export class GetHyperboardOwnersResponse extends DataResponse(
16+
HyperboardOwner,
17+
) {}
818

919
@ObjectType({
1020
description: "Hyperboard of hypercerts for reference and display purposes",
@@ -37,8 +47,8 @@ export class Hyperboard extends BasicTypeDef {
3747
@Field(() => [SectionResponseType])
3848
sections?: SectionResponseType[];
3949

40-
@Field(() => [HyperboardOwner])
41-
owners?: HyperboardOwner[];
50+
@Field(() => GetHyperboardOwnersResponse)
51+
owners?: GetHyperboardOwnersResponse;
4252
}
4353

4454
@ObjectType({})
@@ -63,16 +73,23 @@ export class Section {
6373
@Field(() => [SectionEntry])
6474
entries?: SectionEntry[];
6575

66-
@Field(() => [HyperboardOwner])
67-
owners?: HyperboardOwner[];
76+
@Field(() => GetHyperboardOwnersResponse)
77+
owners?: GetHyperboardOwnersResponse[];
6878
}
6979

7080
@ObjectType()
71-
export class HyperboardOwner extends User {
81+
class SectionEntryOwner extends User {
7282
@Field()
73-
percentage_owned?: number;
83+
percentage?: number;
84+
@Field(() => EthBigInt, { nullable: true })
85+
units?: bigint | number | string;
7486
}
7587

88+
@ObjectType()
89+
export class GetSectionEntryOwnersResponse extends DataResponse(
90+
SectionEntryOwner,
91+
) {}
92+
7693
@ObjectType({
7794
description: "Entry representing a hypercert or blueprint within a section",
7895
})
@@ -87,19 +104,11 @@ class SectionEntry {
87104
display_size?: number;
88105
@Field({ description: "Name of the hypercert or blueprint", nullable: true })
89106
name?: string;
90-
@Field(() => GraphQLBigInt, { nullable: true })
107+
@Field(() => EthBigInt, { nullable: true })
91108
total_units?: bigint | number | string;
92109

93-
@Field(() => [SectionEntryOwner])
94-
owners?: SectionEntryOwner[];
95-
}
96-
97-
@ObjectType()
98-
class SectionEntryOwner extends User {
99-
@Field()
100-
percentage?: number;
101-
@Field(() => GraphQLBigInt, { nullable: true })
102-
units?: bigint | number | string;
110+
@Field(() => GetSectionEntryOwnersResponse)
111+
owners?: GetSectionEntryOwnersResponse;
103112
}
104113

105114
@ObjectType()

0 commit comments

Comments
 (0)