mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
17 lines
383 B
JavaScript
17 lines
383 B
JavaScript
import { User, UserProfile } from '@linux-odyssey/models'
|
|
import { hashPassword } from '../utils/auth.js'
|
|
|
|
export async function createUser(username, email, password) {
|
|
const user = new User({
|
|
username,
|
|
email,
|
|
})
|
|
user.hashedPassword = await hashPassword(password)
|
|
await user.save()
|
|
|
|
const userProfile = new UserProfile({
|
|
user,
|
|
})
|
|
await userProfile.save()
|
|
}
|