sungjin

Remove all unused import & variable

......@@ -3,25 +3,25 @@ import { AuthService } from './auth.service';
@Controller('auth')
export class AuthController {
constructor(private readonly AuthService: AuthService) {}
constructor(private readonly authService: AuthService) {}
@Post('signup')
signUp(@Body() body) {
return this.AuthService.createUser(body.name, body.email, body.password);
return this.authService.createUser(body.name, body.email, body.password);
}
@Post('signin')
signIn(@Body() body) {
return this.AuthService.login(body.email, body.password);
return this.authService.login(body.email, body.password);
}
@Post('refresh')
refresh(@Body() body) {
return this.AuthService.refreshTokens(body.token);
return this.authService.refreshTokens(body.token);
}
@Post('validate')
validate(@Body() body) {
return this.AuthService.getUserFromToken(body.token);
return this.authService.getUserFromToken(body.token);
}
}
......
......@@ -70,7 +70,7 @@ export class PostService {
}
async getPostsByUser(token: string, userId: string, take: number) {
const user = await this.auth.getUserFromToken(token);
await this.auth.getUserFromToken(token);
const posts = await this.prisma.post.findMany({
where: {
authorId: userId,
......@@ -142,7 +142,7 @@ export class PostService {
testoutput: string[],
difficulty: number,
) {
const user = await this.auth.getUserFromToken(token);
await this.auth.getUserFromToken(token);
let level: Level;
if (difficulty == 1) {
level = 'LOW';
......@@ -169,7 +169,7 @@ export class PostService {
}
async deletePost(token: string, id: number) {
const user = await this.auth.getUserFromToken(token);
await this.auth.getUserFromToken(token);
const post = await this.prisma.post.delete({
where: {
id: id,
......@@ -190,7 +190,7 @@ export class PostService {
})
)
return this.getPost(id);
const post = await this.prisma.postLike.create({
await this.prisma.postLike.create({
data: {
post: {
connect: {
......@@ -229,7 +229,7 @@ export class PostService {
}
async deleteComment(token: string, id: string) {
const user = await this.auth.getUserFromToken(token);
await this.auth.getUserFromToken(token);
const comment = await this.prisma.comment.delete({
where: {
id: id,
......
import {
INestApplication,
Injectable,
OnModuleInit,
OnModuleDestroy,
} from '@nestjs/common';
import { INestApplication, Injectable, OnModuleInit } from '@nestjs/common';
import { PrismaClient } from '@prisma/client';
@Injectable()
......
import { Body, Injectable } from '@nestjs/common';
import { Injectable } from '@nestjs/common';
import * as child_process from 'child_process';
import { AuthService } from 'src/auth/auth.service';
import * as fs from 'fs';
......@@ -54,7 +54,7 @@ export class RunnerService {
c(body: any, location: string) {
const output: Array<string> = [];
if (body.input == '' || body.input == undefined) {
const test = child_process.spawnSync('gcc', [location, '-o', 'tmp'], {
child_process.spawnSync('gcc', [location, '-o', 'tmp'], {
encoding: 'utf8',
shell: true,
});
......
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import { AppModule } from './../src/app.module';
describe('AppController (e2e)', () => {
let app: INestApplication;
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
});
it('/ (GET)', () => {
return request(app.getHttpServer())
.get('/')
.expect(200)
.expect('Hello World!');
});
});
{
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": ".",
"testEnvironment": "node",
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
}
}