-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DMVM-161 feat: SMS 인증, 회원가입 API 구현 #26
Conversation
example: '01012345678', | ||
type: String, | ||
}) | ||
phoneNumber: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
생각보다 010-1234-5678 이런 패턴으로 입력하시는 분이 많습니다.
정확한 기준을 가지고 정규식으로 특정 패턴의 전화번호만 받는것이 좋을것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
프론트에서 보여지는건 010-0000-0000 이런식이긴합니다.
const newCustomer = await this.customerRepository.create(dto); | ||
return await this.customerRepository.save(newCustomer); | ||
} | ||
|
||
async create(dto: CreateCustomerDto): Promise<Customer> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
모든 정보를 클라이언트에서 수집한 후에 백엔드에선 한번의 Request만으로 처리하는것으로 보이는데 맞나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아래에서 말씀드린것처럼 CRUD 혹은 API마다 DTO가 있는것은
딱히 좋다고 생각들지는 않습니다.
validation이 필요하다고하면 group validation을 지정하여서 하는거는 어떠신가요?
|
두가지 사항 반영했습니다! api 작동이 안되어서 시간이 걸렸네요ㅠㅠ 암호화 알고리즘은 AES256 CTR 사용했습니다. 시간되실 때 확인 부탁드립니다! |
1194b5e
to
149c07e
Compare
import { EncryptionServiceInterface } from '../domain/encryption-service.interface'; | ||
|
||
@Injectable() | ||
export class EncryptionService implements EncryptionServiceInterface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EncryptionServiceInterface라는 이름보단 IEncryptionService가 어떨까요?
private readonly ivLength = 16; | ||
|
||
constructor(private readonly configService: ConfigService) { | ||
this.secretKey = this.configService.get<string>('encryption.secretKey'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameter Store의 계층구조에 따라 encryption.secretKey보단
encryption/secretKey나 encryption/key/secret가 좋아보입니다.
'sms/expired_minutes', | ||
10, | ||
); | ||
this.otpLength = this.configService.get<number>('sms/otp_length', 6); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
camelCase, snakeCase 둘다 혼용되고 있는것 같은데 맞춰주세요
그리고 위에서 설명드린것처럼 계층구조로 나타내는것은 어떤지 고민해봐주세요
const customer = this.customerRepository.create({ | ||
uuid: dto.uuid, | ||
customerName: dto.name, | ||
customerPhoneNumber: dto.phoneNumber, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아직 phoneNumber가 DB저장시 암호화 되지 않는걸로 확인됩니다.
확인 부탁드려요
customerPhoneNumber: dto.phoneNumber, | ||
customerLocation: null, | ||
authProvider: dto.authProvider, | ||
createdAt: new Date(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createdAt은 CreateDateColumn로 선언되어 있어서 해당 코드가 필요 없어보입니다.
customerLocation: null, | ||
authProvider: dto.authProvider, | ||
createdAt: new Date(), | ||
modifiedAt: new Date(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UpdateDateColumn이어서 필요없지 않나라는 의문점입니다.
🎫 161
변경 사항에 대한 설명
SMS 인증과, 회원가입 API를 구현했습니다. SMS 전송에는 알리고 API를 사용했습니다.
테스트 방법
API 사용 플로우
사용자가 전화번호를 입력하여 인증 코드를 요청합니다.
서버는 해당 전화번호로 SMS 인증 코드를 전송합니다.
사용자가 받은 인증 코드를 서버에 제출하여 인증을 확인합니다.
서버는 인증 코드를 확인하고, 성공 시 verificationId를 반환합니다.
사용자가 verificationId와 추가 정보를 입력하여 회원가입을 요청합니다.
서버는 전화번호와 verificationId를 확인하고, 새로운 사용자를 등록합니다.
변경된 환경
변경된 환경(라이브러리 버전, 데이터베이스 스키마 등)에 대한 정보를 제공해주세요.
참고 사항
추후 CustomerService의 create 메서드를 제가 작성한 코드로 교체해야 합니다.
코드 리뷰 부탁드립니다. 감사합니다.