sungjin

Remove all unused import & variable

...@@ -3,25 +3,25 @@ import { AuthService } from './auth.service'; ...@@ -3,25 +3,25 @@ import { AuthService } from './auth.service';
3 3
4 @Controller('auth') 4 @Controller('auth')
5 export class AuthController { 5 export class AuthController {
6 - constructor(private readonly AuthService: AuthService) {} 6 + constructor(private readonly authService: AuthService) {}
7 7
8 @Post('signup') 8 @Post('signup')
9 signUp(@Body() body) { 9 signUp(@Body() body) {
10 - return this.AuthService.createUser(body.name, body.email, body.password); 10 + return this.authService.createUser(body.name, body.email, body.password);
11 } 11 }
12 12
13 @Post('signin') 13 @Post('signin')
14 signIn(@Body() body) { 14 signIn(@Body() body) {
15 - return this.AuthService.login(body.email, body.password); 15 + return this.authService.login(body.email, body.password);
16 } 16 }
17 17
18 @Post('refresh') 18 @Post('refresh')
19 refresh(@Body() body) { 19 refresh(@Body() body) {
20 - return this.AuthService.refreshTokens(body.token); 20 + return this.authService.refreshTokens(body.token);
21 } 21 }
22 22
23 @Post('validate') 23 @Post('validate')
24 validate(@Body() body) { 24 validate(@Body() body) {
25 - return this.AuthService.getUserFromToken(body.token); 25 + return this.authService.getUserFromToken(body.token);
26 } 26 }
27 } 27 }
......
...@@ -70,7 +70,7 @@ export class PostService { ...@@ -70,7 +70,7 @@ export class PostService {
70 } 70 }
71 71
72 async getPostsByUser(token: string, userId: string, take: number) { 72 async getPostsByUser(token: string, userId: string, take: number) {
73 - const user = await this.auth.getUserFromToken(token); 73 + await this.auth.getUserFromToken(token);
74 const posts = await this.prisma.post.findMany({ 74 const posts = await this.prisma.post.findMany({
75 where: { 75 where: {
76 authorId: userId, 76 authorId: userId,
...@@ -142,7 +142,7 @@ export class PostService { ...@@ -142,7 +142,7 @@ export class PostService {
142 testoutput: string[], 142 testoutput: string[],
143 difficulty: number, 143 difficulty: number,
144 ) { 144 ) {
145 - const user = await this.auth.getUserFromToken(token); 145 + await this.auth.getUserFromToken(token);
146 let level: Level; 146 let level: Level;
147 if (difficulty == 1) { 147 if (difficulty == 1) {
148 level = 'LOW'; 148 level = 'LOW';
...@@ -169,7 +169,7 @@ export class PostService { ...@@ -169,7 +169,7 @@ export class PostService {
169 } 169 }
170 170
171 async deletePost(token: string, id: number) { 171 async deletePost(token: string, id: number) {
172 - const user = await this.auth.getUserFromToken(token); 172 + await this.auth.getUserFromToken(token);
173 const post = await this.prisma.post.delete({ 173 const post = await this.prisma.post.delete({
174 where: { 174 where: {
175 id: id, 175 id: id,
...@@ -190,7 +190,7 @@ export class PostService { ...@@ -190,7 +190,7 @@ export class PostService {
190 }) 190 })
191 ) 191 )
192 return this.getPost(id); 192 return this.getPost(id);
193 - const post = await this.prisma.postLike.create({ 193 + await this.prisma.postLike.create({
194 data: { 194 data: {
195 post: { 195 post: {
196 connect: { 196 connect: {
...@@ -229,7 +229,7 @@ export class PostService { ...@@ -229,7 +229,7 @@ export class PostService {
229 } 229 }
230 230
231 async deleteComment(token: string, id: string) { 231 async deleteComment(token: string, id: string) {
232 - const user = await this.auth.getUserFromToken(token); 232 + await this.auth.getUserFromToken(token);
233 const comment = await this.prisma.comment.delete({ 233 const comment = await this.prisma.comment.delete({
234 where: { 234 where: {
235 id: id, 235 id: id,
......
1 -import { 1 +import { INestApplication, Injectable, OnModuleInit } from '@nestjs/common';
2 - INestApplication,
3 - Injectable,
4 - OnModuleInit,
5 - OnModuleDestroy,
6 -} from '@nestjs/common';
7 import { PrismaClient } from '@prisma/client'; 2 import { PrismaClient } from '@prisma/client';
8 3
9 @Injectable() 4 @Injectable()
......
1 -import { Body, Injectable } from '@nestjs/common'; 1 +import { Injectable } from '@nestjs/common';
2 import * as child_process from 'child_process'; 2 import * as child_process from 'child_process';
3 import { AuthService } from 'src/auth/auth.service'; 3 import { AuthService } from 'src/auth/auth.service';
4 import * as fs from 'fs'; 4 import * as fs from 'fs';
...@@ -54,7 +54,7 @@ export class RunnerService { ...@@ -54,7 +54,7 @@ export class RunnerService {
54 c(body: any, location: string) { 54 c(body: any, location: string) {
55 const output: Array<string> = []; 55 const output: Array<string> = [];
56 if (body.input == '' || body.input == undefined) { 56 if (body.input == '' || body.input == undefined) {
57 - const test = child_process.spawnSync('gcc', [location, '-o', 'tmp'], { 57 + child_process.spawnSync('gcc', [location, '-o', 'tmp'], {
58 encoding: 'utf8', 58 encoding: 'utf8',
59 shell: true, 59 shell: true,
60 }); 60 });
......
1 -import { Test, TestingModule } from '@nestjs/testing';
2 -import { INestApplication } from '@nestjs/common';
3 -import * as request from 'supertest';
4 -import { AppModule } from './../src/app.module';
5 -
6 -describe('AppController (e2e)', () => {
7 - let app: INestApplication;
8 -
9 - beforeEach(async () => {
10 - const moduleFixture: TestingModule = await Test.createTestingModule({
11 - imports: [AppModule],
12 - }).compile();
13 -
14 - app = moduleFixture.createNestApplication();
15 - await app.init();
16 - });
17 -
18 - it('/ (GET)', () => {
19 - return request(app.getHttpServer())
20 - .get('/')
21 - .expect(200)
22 - .expect('Hello World!');
23 - });
24 -});
1 -{
2 - "moduleFileExtensions": ["js", "json", "ts"],
3 - "rootDir": ".",
4 - "testEnvironment": "node",
5 - "testRegex": ".e2e-spec.ts$",
6 - "transform": {
7 - "^.+\\.(t|j)s$": "ts-jest"
8 - }
9 -}