Skip to content

Commit 253dfbb

Browse files
committed
refactor: reception service layer migrate start with first function
1 parent 9568f48 commit 253dfbb

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

src/services/reception.service.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
import User from '../models/User.js';
22
import bcrypt from 'bcrypt';
33

4-
const
4+
const creatReceptionist = async (data) => {
5+
const password = data.password || 'reception@123';
6+
const hashedPassword = await bcrypt.hash(password, 10);
7+
8+
const receptionist = new User({
9+
...data,
10+
password: hashedPassword,
11+
role: 'receptionist'
12+
});
13+
14+
return await receptionist.save();
15+
};
16+
17+
const changePassword = async (userId, oldPassword, newPassword) => {
18+
const receptionist = await User.findById(userId)
19+
}

0 commit comments

Comments
 (0)