Skip to content

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

fix: fixed improper imports in auth module

Balu Babu90bc0483aefe
diff --git a/packages/hoppscotch-backend/Dockerfile b/packages/hoppscotch-backend/Dockerfile
index 5ee847e55..ab0c88f42 100644
--- a/packages/hoppscotch-backend/Dockerfile
+++ b/packages/hoppscotch-backend/Dockerfile
@@ -20,4 +20,4 @@ ENV APP_PORT=${PORT}
ENV DB_URL=${DATABASE_URL}
ENV PRODUCTION=true
-CMD ["pnpm", "run", "start:dev"]
+CMD ["pnpm", "run", "start"]
diff --git a/packages/hoppscotch-backend/docker-compose.yml b/packages/hoppscotch-backend/docker-compose.yml
index 1480d8735..a27bd2c7d 100644
--- a/packages/hoppscotch-backend/docker-compose.yml
+++ b/packages/hoppscotch-backend/docker-compose.yml
@@ -2,7 +2,7 @@ version: '3.0'
services:
local:
build: .
- command: ["pnpm", "run", "start:dev"]
+ command: [ "pnpm", "run", "start:dev" ]
environment:
- PRODUCTION=false
- DATABASE_URL=postgresql://postgres:testpass@dev-db:5432/hoppscotch?connect_timeout=300
@@ -23,5 +23,3 @@ services:
environment:
POSTGRES_PASSWORD: testpass
POSTGRES_DB: hoppscotch
-
-
diff --git a/packages/hoppscotch-backend/package.json b/packages/hoppscotch-backend/package.json
index e6e8a0c55..66339eefd 100644
--- a/packages/hoppscotch-backend/package.json
+++ b/packages/hoppscotch-backend/package.json
@@ -29,6 +29,7 @@
"@nestjs/passport": "^9.0.0",
"@nestjs/platform-express": "^9.2.1",
"@prisma/client": "^4.7.1",
+ "@types/bcrypt": "^5.0.0",
"apollo-server-express": "^3.11.1",
"apollo-server-plugin-base": "^3.7.1",
"argon2": "^0.30.3",
diff --git a/packages/hoppscotch-backend/src/guards/gql-auth.guard.ts b/packages/hoppscotch-backend/src/guards/gql-auth.guard.ts
index bd566c4ba..2f657ef85 100644
--- a/packages/hoppscotch-backend/src/guards/gql-auth.guard.ts
+++ b/packages/hoppscotch-backend/src/guards/gql-auth.guard.ts
@@ -27,6 +27,8 @@ export class GqlAuthGuard implements CanActivate {
name: 'exampleUser',
image: 'http://example.com/avatar',
+ isAdmin: false,
+ createdOn: new Date(),
};
ctx.user = authUser;
diff --git a/packages/hoppscotch-backend/src/prisma/prisma.service.ts b/packages/hoppscotch-backend/src/prisma/prisma.service.ts
index 5b962c430..8febf1b5b 100644
--- a/packages/hoppscotch-backend/src/prisma/prisma.service.ts
+++ b/packages/hoppscotch-backend/src/prisma/prisma.service.ts
@@ -1,5 +1,5 @@
import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common';
-import { PrismaClient } from '@prisma/client/scripts/default-index';
+import { PrismaClient } from '@prisma/client';
@Injectable()
export class PrismaService
diff --git a/packages/hoppscotch-backend/src/user/user.model.ts b/packages/hoppscotch-backend/src/user/user.model.ts
index 5f1fe640f..f3c3ef786 100644
--- a/packages/hoppscotch-backend/src/user/user.model.ts
+++ b/packages/hoppscotch-backend/src/user/user.model.ts
@@ -26,14 +26,12 @@ export class User {
image?: string;
@Field({
- nullable: true,
description: 'Flag to determine if user is an Admin or not',
})
- isAdmin?: string;
+ isAdmin: boolean;
@Field({
- nullable: true,
description: 'Date when the user account was created',
})
- createdOn?: string;
+ createdOn: Date;
}
diff --git a/packages/hoppscotch-backend/src/user/user.module.ts b/packages/hoppscotch-backend/src/user/user.module.ts
index bdf5d79e5..d02ec68ce 100644
--- a/packages/hoppscotch-backend/src/user/user.module.ts
+++ b/packages/hoppscotch-backend/src/user/user.module.ts
@@ -2,10 +2,11 @@ import { Module } from '@nestjs/common';
import { UserResolver } from './user.resolver';
import { PubSubModule } from 'src/pubsub/pubsub.module';
import { UserService } from './user.service';
+import { PrismaModule } from 'src/prisma/prisma.module';
@Module({
- imports: [PubSubModule],
- providers: [UserResolver],
+ imports: [PubSubModule, PrismaModule],
+ providers: [UserResolver, UserService],
exports: [UserService],
})
export class UserModule {}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b9228343c..20e7e81b2 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -56,6 +56,7 @@ importers:
'@nestjs/testing': ^9.2.1
'@prisma/client': ^4.7.1
'@relmify/jest-fp-ts': ^2.0.2
+ '@types/bcrypt': ^5.0.0
'@types/express': ^4.17.14
'@types/jest': ^27.5.2
'@types/node': ^18.11.10
@@ -105,6 +106,7 @@ importers:
'@nestjs/passport': 9.0.0_6o47igfla2pj7yzh7agpvpttka
'@nestjs/platform-express': 9.2.1_hjcqpoaebdr7gdo5hgc22hthbe
'@prisma/client': [email protected]
+ '@types/bcrypt': 5.0.0
apollo-server-express: 3.11.1_4mq2c443wwzwcb6dpxnwkfvrzm
apollo-server-plugin-base: [email protected]
argon2: 0.30.3
@@ -5168,6 +5170,12 @@ packages:
'@babel/types': 7.18.7
dev: true
+ /@types/bcrypt/5.0.0:
+ resolution: {integrity: sha512-agtcFKaruL8TmcvqbndlqHPSJgsolhf/qPWchFlgnW1gECTN/nKbFcoFnvKAQRFfKbh+BO6A3SWdJu9t+xF3Lw==}
+ dependencies:
+ '@types/node': 18.11.10
+ dev: false
+
/@types/body-parser/1.19.2:
resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==}
dependencies: