Skip to content

Commit

Permalink
feat: 서비스 함수에 type interface로 지정
Browse files Browse the repository at this point in the history
  • Loading branch information
sjn0910 authored and vimkim committed Nov 28, 2023
1 parent 5277147 commit ccfa251
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 4 additions & 0 deletions server/src/types/user.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface ProviderInfo {
provider: string;
providerId: string;
}
2 changes: 1 addition & 1 deletion server/src/user/user.controller.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Body, Controller, Post } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { CreateUserDto } from 'src/dto/create.user.dto';
import { CreateUserDto } from './dto/create.user.dto';
import { UserService } from './user.service';

@Controller('users')
Expand Down
8 changes: 3 additions & 5 deletions server/src/user/user.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { BadRequestException, Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { CreateUserDto } from 'src/dto/create.user.dto';
import { ProviderInfo } from 'src/types/user';
import { Repository } from 'typeorm';
import User from '../entities/user.entity';
import { CreateUserDto } from './dto/create.user.dto';

@Injectable()
export class UserService {
Expand All @@ -19,10 +20,7 @@ export class UserService {
return this.userRepository.create(createUserDto).save();
}

async findUserByProviderInfo(providerInfo: {
provider: string;
providerId: string;
}) {
async findUserByProviderInfo(providerInfo: ProviderInfo) {
return this.userRepository.findOne({
where: providerInfo,
});
Expand Down

0 comments on commit ccfa251

Please sign in to comment.