Skip to content

Commit

Permalink
⚙️ chore: lint,test 에러 발생 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jinddings committed Nov 6, 2024
1 parent e4ba28a commit 8b121d1
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 63 deletions.
16 changes: 4 additions & 12 deletions BE/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion BE/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"axios": "^1.7.7",
"bcrypt": "^5.1.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"cross-env": "^7.0.3",
"docker": "^1.0.0",
"dotenv": "^16.4.5",
Expand All @@ -53,7 +54,6 @@
"@types/jest": "^29.5.2",
"@types/node": "^20.3.1",
"@types/supertest": "^6.0.0",
"class-validator": "^0.14.1",
"eslint": "^8.0.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^18.0.0",
Expand Down
18 changes: 0 additions & 18 deletions BE/src/auth/auth.controller.spec.ts

This file was deleted.

6 changes: 3 additions & 3 deletions BE/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
ValidationPipe,
UseGuards,
} from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { AuthService } from './auth.service';
import { AuthCredentialsDto } from './dto/authCredentials.dto';
import { AuthGuard } from '@nestjs/passport';

@Controller('auth')
export class AuthController {
Expand All @@ -29,7 +29,7 @@ export class AuthController {

@Get('/test')
@UseGuards(AuthGuard())
test(@Req() req) {
console.log(req);
test(@Req() req: Request) {
return req;
}
}
4 changes: 2 additions & 2 deletions BE/src/auth/auth.module.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { JwtModule } from '@nestjs/jwt';
import { PassportModule } from '@nestjs/passport';
import { AuthController } from './auth.controller';
import { AuthService } from './auth.service';
import { User } from './user.entity';
import { UserRepository } from './user.repository';
import { JwtModule } from '@nestjs/jwt';
import { PassportModule } from '@nestjs/passport';
import { JwtStrategy } from './jwt.strategy';

@Module({
Expand Down
18 changes: 0 additions & 18 deletions BE/src/auth/auth.service.spec.ts

This file was deleted.

13 changes: 6 additions & 7 deletions BE/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Injectable } from '@nestjs/common';
import { Injectable, UnauthorizedException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { UserRepository } from './user.repository';
import { AuthCredentialsDto } from './dto/authCredentials.dto';
import { JwtService } from '@nestjs/jwt';
import * as bcrypt from 'bcrypt';
import { UnauthorizedException } from '@nestjs/common';
import { UserRepository } from './user.repository';
import { AuthCredentialsDto } from './dto/authCredentials.dto';

@Injectable()
export class AuthService {
constructor(
Expand All @@ -26,9 +26,8 @@ export class AuthService {
if (user && (await bcrypt.compare(password, user.password))) {
const payload = { email };
const accessToken = this.jwtService.sign(payload);
return { accessToken: accessToken };
} else {
throw new UnauthorizedException('Please check your login credentials');
return { accessToken };
}
throw new UnauthorizedException('Please check your login credentials');
}
}
1 change: 1 addition & 0 deletions BE/src/auth/dto/authCredentials.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IsString, Matches, MaxLength, MinLength } from 'class-validator';

export class AuthCredentialsDto {
@IsString()
@MinLength(4)
Expand Down
2 changes: 1 addition & 1 deletion BE/src/auth/jwt.strategy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PassportStrategy } from '@nestjs/passport';
import { InjectRepository } from '@nestjs/typeorm';
import { ExtractJwt, Strategy } from 'passport-jwt';
import { UserRepository } from './user.repository';
import { Injectable, UnauthorizedException } from '@nestjs/common';
import { UserRepository } from './user.repository';
import { User } from './user.entity';

@Injectable()
Expand Down
2 changes: 1 addition & 1 deletion BE/src/auth/user.repository.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Injectable, UnauthorizedException } from '@nestjs/common';
import { Injectable } from '@nestjs/common';
import { InjectDataSource } from '@nestjs/typeorm';
import { DataSource, Repository } from 'typeorm';
import * as bcrypt from 'bcrypt';
Expand Down

0 comments on commit 8b121d1

Please sign in to comment.