-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Refactor]: unify all notation to camelCase (#114)
* [refactor]: fix snake_case to camelCase * [refactor]: change test directory structure
- Loading branch information
Showing
118 changed files
with
897 additions
and
803 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
import { User } from '@app/user/entities/user.entity'; | ||
import { User } from '@app/user/domain/user.entity'; | ||
import { IsNotEmpty, IsString } from 'class-validator'; | ||
|
||
export class GoogleLoginDto { | ||
@IsString() | ||
@IsNotEmpty() | ||
access_token: string; | ||
accessToken: string; | ||
} | ||
|
||
export class KakaoLoginDto { | ||
@IsString() | ||
@IsNotEmpty() | ||
access_token: string; | ||
accessToken: string; | ||
} | ||
|
||
export class OAuthLoginSessionDto { | ||
is_exist: boolean; | ||
session_token?: string; | ||
isExist: boolean; | ||
sessionToken?: string; | ||
user?: User; | ||
register_token?: string; | ||
registerToken?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import { User } from '@app/user/entities/user.entity'; | ||
import { User } from '@app/user/domain/user.entity'; | ||
import { IsInt, IsUUID } from 'class-validator'; | ||
|
||
export class LoginSessionDto { | ||
session_token: string; | ||
sessionToken: string; | ||
|
||
user: User; | ||
} | ||
|
||
export class CreateSessionDto { | ||
@IsUUID() | ||
session_token: string; | ||
sessionToken: string; | ||
|
||
@IsInt() | ||
user_id: number; | ||
userId: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import { Session as PrismaSession } from '@prisma/client'; | ||
import { CreateSessionDto } from '../dto/token.dto'; | ||
import { Session as MongoSession } from '../entities/mongo.session.entity'; | ||
import { Session as MongoSession } from '../domain/mongo.session.entity'; | ||
import { ICrudRepository } from '@app/common/repository/crud.repository'; | ||
|
||
type Session = PrismaSession | MongoSession; | ||
|
||
export interface IAuthRepository | ||
extends ICrudRepository<Session, CreateSessionDto, any, any> { | ||
findBySessionToken(session: string): Promise<Session>; | ||
|
||
deleteBySessionToken(session: string): Promise<Session>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...h/src/controllers/auth.controller.spec.ts → .../test/integration/auth.controller.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...epositories/mongo.auth.repository.spec.ts → ...integration/mongo.auth.repository.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { TestBed } from '@automock/jest'; | ||
import { AuthService } from './auth.service'; | ||
import { AuthRepository } from '../repositories/auth.repository'; | ||
import { UserService } from '@app/user/services/user.service'; | ||
import { AuthService } from '@app/auth/auth.service'; | ||
import { AuthRepository } from '@app/auth/repositories/auth.repository'; | ||
import { UserService } from '@app/user/user.service'; | ||
import { JwtService } from '@nestjs/jwt'; | ||
import { User } from '@app/user/entities/user.entity'; | ||
import { User } from '@app/user/domain/user.entity'; | ||
import { CreateUserDto } from '@app/user/dto/modify-user.dto'; | ||
import { LoginSessionDto } from '../dto/token.dto'; | ||
import { Session } from '../entities/session.entity'; | ||
import { OAuthLoginSessionDto } from '../dto/oauth.dto'; | ||
import { LoginSessionDto } from '@app/auth/dto/token.dto'; | ||
import { Session } from '@app/auth/domain/session.entity'; | ||
import { OAuthLoginSessionDto } from '@app/auth/dto/oauth.dto'; | ||
|
||
jest.mock('uuid', () => ({ | ||
v4: () => 'mock-uuid', | ||
|
@@ -52,16 +52,16 @@ describe('AuthService', () => { | |
}; | ||
const sessToken = 'mock-uuid'; | ||
const loginSessionDto: LoginSessionDto = { | ||
session_token: sessToken, | ||
sessionToken: sessToken, | ||
user, | ||
}; | ||
authRepository.create.mockResolvedValueOnce(new Session()); | ||
|
||
const result = await service.login(user); | ||
|
||
expect(authRepository.create).toHaveBeenCalledWith({ | ||
user_id: user.id, | ||
session_token: sessToken, | ||
userId: user.id, | ||
sessionToken: sessToken, | ||
}); | ||
expect(result).toEqual(loginSessionDto); | ||
}); | ||
|
@@ -76,11 +76,11 @@ describe('AuthService', () => { | |
user.username = username; | ||
|
||
const loginSessionDto: LoginSessionDto = { | ||
session_token: 'sessToken', | ||
sessionToken: 'sessToken', | ||
user, | ||
}; | ||
const oAuthLoginSessionDto: OAuthLoginSessionDto = { | ||
is_exist: true, | ||
isExist: true, | ||
...loginSessionDto, | ||
}; | ||
userService.findByEmail.mockResolvedValue(user); | ||
|
@@ -97,8 +97,8 @@ describe('AuthService', () => { | |
const email = '[email protected]'; | ||
const username = 'test'; | ||
const expectedResponse = { | ||
is_exist: false, | ||
register_token: 'register_token', | ||
isExist: false, | ||
registerToken: 'register_token', | ||
}; | ||
jwtService.sign.mockReturnValue('register_token'); | ||
userService.findByEmail.mockResolvedValue(undefined); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.