Skip to content

Commit

Permalink
Merge pull request #77 from boostcampwm-2024/be/feature/create_lotto_…
Browse files Browse the repository at this point in the history
…column

[BE/feature] 회원가입시 로또 컬럼 추가
  • Loading branch information
HBLEEEEE authored Nov 21, 2024
2 parents d4b23e1 + af22e31 commit f2f6027
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion apps/backend/src/auth/auth.queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ export const authQueries = {
findByEmailQuery:
'SELECT member_id, email, password, nickname FROM members WHERE email = $1 LIMIT 1',
updateInroduceQuery: 'UPDATE members SET introduce = $1 WHERE member_id = $2',
updateNicknameQuery: 'UPDATE members SET nickname = $1 WHERE member_id = $2'
updateNicknameQuery: 'UPDATE members SET nickname = $1 WHERE member_id = $2',
createLottoColumnQuery: 'INSERT INTO lottos (member_id) VALUES ($1)'
};
9 changes: 8 additions & 1 deletion apps/backend/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@ export class AuthService {
throw new HttpException('닉네임은 2자에서 10자 사이로 입력해주세요.', HttpStatus.BAD_REQUEST);
const hashedPassword = await bcrypt.hash(password, 10);

await this.databaseService.query(authQueries.signUpQuery, [email, hashedPassword, nickname]);
const member = await this.databaseService.query(authQueries.signUpQuery, [
email,
hashedPassword,
nickname
]);
await this.databaseService.query(authQueries.createLottoColumnQuery, [
member.rows[0].member_id
]);
}

async login(loginDto: LoginDto) {
Expand Down

0 comments on commit f2f6027

Please sign in to comment.