문제1: bcypt.hash를 사용해 model.create(data) 할 때
The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object...
이러한 에러가 나옴
User.beforeCreate((user, _) => {
user.password = bcrypt.hash(user.password, salt);
});
아무생각없이 이렇게 만들었다가..
User.create(body)를 하는데 계속 에러가 나면서 안 넘어가는... ㅠㅠ
User.beforeCreate(async (user, _) => {
user.password = await bcrypt.hash(user.password, salt);
});
이것도 생각 못 하고 2시간 동안.... 으아아아 ㅋㅋㅋ
password에 계속 Promise가 들어가니 type vallidate가 안 되지... 일어나지휴...