Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

hotfix: fixing type errors in backend graphql layer (HBE-174) (#45)

Balu Babub0d9a934d918
diff --git a/packages/hoppscotch-backend/src/app.module.ts b/packages/hoppscotch-backend/src/app.module.ts
index fb34b3b1b..d6289a871 100644
--- a/packages/hoppscotch-backend/src/app.module.ts
+++ b/packages/hoppscotch-backend/src/app.module.ts
@@ -21,6 +21,9 @@ import { COOKIES_NOT_FOUND } from './errors';
@Module({
imports: [
GraphQLModule.forRoot<ApolloDriverConfig>({
+ buildSchemaOptions: {
+ numberScalarMode: 'integer',
+ },
cors: process.env.PRODUCTION !== 'true' && {
origin: process.env.WHITELISTED_ORIGINS.split(','),
credentials: true,
diff --git a/packages/hoppscotch-backend/src/team-invitation/team-invitation.model.ts b/packages/hoppscotch-backend/src/team-invitation/team-invitation.model.ts
index 99a5ea1c8..4b753039d 100644
--- a/packages/hoppscotch-backend/src/team-invitation/team-invitation.model.ts
+++ b/packages/hoppscotch-backend/src/team-invitation/team-invitation.model.ts
@@ -18,7 +18,7 @@ export class TeamInvitation {
})
creatorUid: string;
- @Field(() => ID, {
+ @Field({
description: 'Email of the invitee',
})
inviteeEmail: string;
diff --git a/packages/hoppscotch-backend/src/types/input-types.args.ts b/packages/hoppscotch-backend/src/types/input-types.args.ts
index fea176ae0..3e3f4d49f 100644
--- a/packages/hoppscotch-backend/src/types/input-types.args.ts
+++ b/packages/hoppscotch-backend/src/types/input-types.args.ts
@@ -1,9 +1,9 @@
-import { ArgsType, Field, InputType } from '@nestjs/graphql';
+import { ArgsType, Field, ID, InputType } from '@nestjs/graphql';
@ArgsType()
@InputType()
export class PaginationArgs {
- @Field({
+ @Field(() => ID, {
nullable: true,
defaultValue: undefined,
description: 'Cursor for pagination, ID of the last item in the list',
diff --git a/packages/hoppscotch-backend/src/user-collection/user-collection.resolver.ts b/packages/hoppscotch-backend/src/user-collection/user-collection.resolver.ts
index 5c27497a3..0ffc9bca8 100644
--- a/packages/hoppscotch-backend/src/user-collection/user-collection.resolver.ts
+++ b/packages/hoppscotch-backend/src/user-collection/user-collection.resolver.ts
@@ -209,7 +209,7 @@ export class UserCollectionResolver {
}
@Mutation(() => UserCollection, {
- description: 'Creates a new child REST user collection',
+ description: 'Creates a new child GraphQL user collection',
})
@UseGuards(GqlAuthGuard)
async createGQLChildUserCollection(
@@ -229,7 +229,7 @@ export class UserCollectionResolver {
}
@Mutation(() => UserCollection, {
- description: 'Creates a new child GraphQL user collection',
+ description: 'Creates a new child REST user collection',
})
@UseGuards(GqlAuthGuard)
async createRESTChildUserCollection(
@@ -309,7 +309,8 @@ export class UserCollectionResolver {
}
@Mutation(() => Boolean, {
- description: 'Move user collection into new parent or root',
+ description:
+ 'Update the order of UserCollections inside parent collection or in root',
})
@UseGuards(GqlAuthGuard)
async updateUserCollectionOrder(
diff --git a/packages/hoppscotch-backend/src/user-history/user-history.resolver.ts b/packages/hoppscotch-backend/src/user-history/user-history.resolver.ts
index 65247c79f..1df39ecf6 100644
--- a/packages/hoppscotch-backend/src/user-history/user-history.resolver.ts
+++ b/packages/hoppscotch-backend/src/user-history/user-history.resolver.ts
@@ -1,4 +1,4 @@
-import { Args, Mutation, Resolver, Subscription } from '@nestjs/graphql';
+import { Args, ID, Mutation, Resolver, Subscription } from '@nestjs/graphql';
import { UserHistoryService } from './user-history.service';
import { PubSubService } from '../pubsub/pubsub.service';
import { UserHistory } from './user-history.model';
@@ -59,6 +59,7 @@ export class UserHistoryResolver {
@Args({
name: 'id',
description: 'ID of User History',
+ type: () => ID,
})
id: string,
): Promise<UserHistory> {
@@ -77,6 +78,7 @@ export class UserHistoryResolver {
@Args({
name: 'id',
description: 'ID of User History',
+ type: () => ID,
})
id: string,
): Promise<UserHistory> {
diff --git a/packages/hoppscotch-backend/src/user-request/input-type.args.ts b/packages/hoppscotch-backend/src/user-request/input-type.args.ts
index 3b428f946..924a5244f 100644
--- a/packages/hoppscotch-backend/src/user-request/input-type.args.ts
+++ b/packages/hoppscotch-backend/src/user-request/input-type.args.ts
@@ -10,13 +10,6 @@ export class GetUserRequestArgs extends PaginationArgs {
description: 'Collection ID of the user request',
})
collectionID?: string;
-
- @Field({
- nullable: true,
- defaultValue: undefined,
- description: 'Title of the user request',
- })
- title?: string;
}
@ArgsType()
@@ -46,13 +39,15 @@ export class MoveUserRequestArgs {
@ArgsType()
export class CreateUserRequestArgs {
- @Field({ nullable: false, description: 'Collection ID of the user request' })
+ @Field(() => ID, {
+ description: 'Collection ID of the user request',
+ })
collectionID: string;
- @Field({ nullable: false, description: 'Title of the user request' })
+ @Field({ description: 'Title of the user request' })
title: string;
- @Field({ nullable: false, description: 'content/body of the user request' })
+ @Field({ description: 'content/body of the user request' })
request: string;
type: ReqType;