Skip to content

Commit

Permalink
style : prettier구조로 npm run format 적용 #35
Browse files Browse the repository at this point in the history
  • Loading branch information
GeunH committed Nov 17, 2023
1 parent 03d08b8 commit cf3ddd5
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion be/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class AuthService {
constructor(
private userRepository: UserRepository,
private jwtService: JwtService
) { }
) {}
async NaverAuth(authorization: string) {
if (!authorization) {
throw new HttpException(
Expand Down
7 changes: 5 additions & 2 deletions be/src/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { AuthGuard } from "@nestjs/passport";

@Controller("user")
export class UserController {
constructor(private userService: UserService) { }
constructor(private userService: UserService) {}

@Get(":nickname/details")
@UseGuards(AuthGuard("jwt"))
Expand Down Expand Up @@ -101,7 +101,10 @@ export class UserController {
@ApiResponse({ status: 401, description: "인증 실패" })
@ApiResponse({ status: 400, description: "부적절한 요청" })
@UsePipes(new ValidationPipe())
async updateMypageUserInfo(@GetUser() tokenInfo: TokenInfo, @Body() userInfoDto: UserInfoDto) {
async updateMypageUserInfo(
@GetUser() tokenInfo: TokenInfo,
@Body() userInfoDto: UserInfoDto
) {
return await this.userService.updateMypageUserInfo(tokenInfo, userInfoDto);
}
}
10 changes: 5 additions & 5 deletions be/src/user/user.decorator.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ExecutionContext, createParamDecorator } from "@nestjs/common";

export interface TokenInfo {
id: number;
id: number;
}

export const GetUser = createParamDecorator(
(data, ctx: ExecutionContext): TokenInfo => {
const req = ctx.switchToHttp().getRequest();
return req.user;
}
(data, ctx: ExecutionContext): TokenInfo => {
const req = ctx.switchToHttp().getRequest();
return req.user;
}
);
9 changes: 7 additions & 2 deletions be/src/user/user.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ export class UserRepository extends Repository<User> {
const user = await this.findOne({ select: ["id"], where: { id: id } });
const [emailUser, nickNameUser] = await Promise.all([
this.findOne({ select: ["id"], where: { email: userInfoDto["email"] } }),
this.findOne({ select: ["id"], where: { nickName: userInfoDto["nickName"] } })
this.findOne({
select: ["id"], where: { nickName: userInfoDto["nickName"] },
}),
]);

const isEmailDuplicate = !!emailUser;
Expand All @@ -85,6 +87,9 @@ export class UserRepository extends Repository<User> {
updateObject["nickName"] = userInfoDto["nickName"];
}
await this.update(user.id, updateObject);
return { isEmailDuplicate: isEmailDuplicate, isNickNameDuplicate: isNickNameDuplicate };
return {
isEmailDuplicate: isEmailDuplicate,
isNickNameDuplicate: isNickNameDuplicate,
};
}
}
11 changes: 6 additions & 5 deletions be/src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class UserService {
constructor(
@InjectRepository(UserRepository)
private usersRepository: UserRepository
) { }
) {}
async signup(userInfoDto: UserInfoDto) {
return await this.usersRepository.createUser(userInfoDto);
}
Expand All @@ -20,14 +20,15 @@ export class UserService {
return await this.usersRepository.getUserInfo(nickName);
}
async getMypageUserDetailInfo(tokenInfo: TokenInfo) {
return await this.usersRepository.getMypageUserDetailInfo(
tokenInfo.id
);
return await this.usersRepository.getMypageUserDetailInfo(tokenInfo.id);
}
async deleteUserAccount(tokenInfo: TokenInfo) {
return await this.usersRepository.deleteUserAccount(tokenInfo.id);
}
async updateMypageUserInfo(tokenInfo: TokenInfo, userInfoDto: UserInfoDto) {
return await this.usersRepository.updateMypageUserInfo(tokenInfo.id, userInfoDto);
return await this.usersRepository.updateMypageUserInfo(
tokenInfo.id,
userInfoDto
);
}
}

0 comments on commit cf3ddd5

Please sign in to comment.