chore: cleaned up hopp-backend package and modified docker and docker-compose files
This commit is contained in:
@@ -2,7 +2,7 @@ module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: 'tsconfig.json',
|
||||
tsconfigRootDir : __dirname,
|
||||
tsconfigRootDir: __dirname,
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: ['@typescript-eslint/eslint-plugin'],
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,16 +5,11 @@ WORKDIR /usr/src/app
|
||||
# # Install pnpm
|
||||
RUN npm i -g pnpm
|
||||
|
||||
# # NPM package install
|
||||
# COPY package*.json ./
|
||||
# RUN pnpm install
|
||||
|
||||
|
||||
# Prisma bits
|
||||
COPY prisma ./
|
||||
RUN pnpx prisma generate
|
||||
|
||||
|
||||
# # NPM package install
|
||||
COPY . .
|
||||
RUN pnpm i
|
||||
|
||||
@@ -25,6 +20,4 @@ ENV APP_PORT=${PORT}
|
||||
ENV DB_URL=${DATABASE_URL}
|
||||
ENV PRODUCTION=true
|
||||
|
||||
#ENV FB_SERVICE_KEY_PATH="secrets/fb-service-key.json"
|
||||
# CMD ["pnpm", "run", "start:dev"]
|
||||
CMD ["pnpm", "run", "start"]
|
||||
|
||||
@@ -6,8 +6,9 @@ services:
|
||||
- PRODUCTION=false
|
||||
- DATABASE_URL=postgresql://postgres:testpass@dev-db:5432/hoppscotch?connect_timeout=300
|
||||
- PORT=3000
|
||||
# volumes:
|
||||
# - .:/usr/src/app
|
||||
volumes:
|
||||
- .:/usr/src/app
|
||||
- /usr/src/app/node_modules/
|
||||
depends_on:
|
||||
- dev-db
|
||||
ports:
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
|
||||
describe('AppController', () => {
|
||||
let appController: AppController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const app: TestingModule = await Test.createTestingModule({
|
||||
controllers: [AppController],
|
||||
providers: [AppService],
|
||||
}).compile();
|
||||
|
||||
appController = app.get<AppController>(AppController);
|
||||
});
|
||||
|
||||
describe('root', () => {
|
||||
it('should return "Hello World!"', () => {
|
||||
expect(appController.getHello()).toBe('Hello World!');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,12 +0,0 @@
|
||||
import { Controller, Get } from '@nestjs/common';
|
||||
import { AppService } from './app.service';
|
||||
|
||||
@Controller()
|
||||
export class AppController {
|
||||
constructor(private readonly appService: AppService) {}
|
||||
|
||||
@Get()
|
||||
getHello(): string {
|
||||
return this.appService.getHello();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
import { Query, Resolver } from '@nestjs/graphql';
|
||||
import { AppService } from './app.service';
|
||||
|
||||
@Resolver((of) => String)
|
||||
export class AppResolver {
|
||||
constructor(private appService: AppService) {}
|
||||
|
||||
@Query((returns) => String)
|
||||
async author() {
|
||||
return this.appService.getHello();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class AppService {
|
||||
getHello(): string {
|
||||
return 'Hello World!';
|
||||
}
|
||||
}
|
||||
@@ -24,13 +24,6 @@ async function bootstrap() {
|
||||
} else {
|
||||
console.log('Enabling CORS with production settings');
|
||||
|
||||
// HACK: Temporary fix for Liyas to work on production directly :P
|
||||
/*
|
||||
app.enableCors({
|
||||
origin: /hoppscotch\.io$/
|
||||
});
|
||||
*/
|
||||
|
||||
app.enableCors({
|
||||
origin: true,
|
||||
});
|
||||
|
||||
@@ -6,20 +6,10 @@ import { GqlUser } from '../decorators/gql-user.decorator';
|
||||
|
||||
@Resolver(() => User)
|
||||
export class UserResolver {
|
||||
// TODO: remove the eslint-disable line below once dependencies are added to user.service file
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
constructor() {}
|
||||
|
||||
// Query
|
||||
// @Query(() => User, {
|
||||
// nullable: true,
|
||||
// description: 'Finds a user by their UID or null if no match',
|
||||
// deprecationReason:
|
||||
// 'Deprecated due to privacy concerns. Try to get the user from the context-relevant queries',
|
||||
// })
|
||||
// async user(@Args({ name: 'uid', type: () => ID }) uid: string): Promise<User | null> {
|
||||
// return this.userService.getUserForUID(uid);
|
||||
// }
|
||||
|
||||
@Query(() => User, {
|
||||
description:
|
||||
"Gives details of the user executing this query (pass Authorization 'Bearer' header)",
|
||||
@@ -29,29 +19,12 @@ export class UserResolver {
|
||||
return user;
|
||||
}
|
||||
|
||||
// // Mutation
|
||||
// @Mutation(() => Boolean, {
|
||||
// description: 'Delete an user account',
|
||||
// })
|
||||
// @UseGuards(GqlAuthGuard)
|
||||
// deleteUser(
|
||||
// @GqlUser() user:User
|
||||
// ): Promise<boolean> {
|
||||
// return pipe(
|
||||
// this.userService.deleteUserByUID(user),
|
||||
// TE.map(() => true),
|
||||
// TE.mapLeft((message) => message.toString()),
|
||||
// TE.getOrElse(throwErr)
|
||||
// )();
|
||||
// }
|
||||
//
|
||||
// // Subscription
|
||||
// @Subscription(() => User, {
|
||||
// description: 'Listen for user deletion',
|
||||
// resolve: (value) => value,
|
||||
// })
|
||||
// @UseGuards(GqlAuthGuard)
|
||||
// userDeleted(@GqlUser() user: User): AsyncIterator<User> {
|
||||
// return this.pubsub.asyncIterator(`user/${user.uid}/deleted`);
|
||||
// }
|
||||
@Query(() => User, {
|
||||
description:
|
||||
"Gives details of the user executing this query (pass Authorization 'Bearer' header)",
|
||||
})
|
||||
@UseGuards(GqlAuthGuard)
|
||||
me2(@GqlUser() user: User): User {
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ import * as TE from 'fp-ts/TaskEither';
|
||||
import * as T from 'fp-ts/Task';
|
||||
import { User } from './user/user.model';
|
||||
import * as A from 'fp-ts/Array';
|
||||
// import { Reflector } from '@nestjs/core';
|
||||
// import { TeamMemberRole } from './team/team.model';
|
||||
|
||||
/**
|
||||
* A workaround to throw an exception in an expression.
|
||||
|
||||
Reference in New Issue
Block a user