mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: add testing setup in backend
This commit is contained in:
1 parent
cb376caff0
commit
1f77328362
15 files changed
+92
-100
No files matched your search
@@ -0,0 +1,16 @@
|
||||
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()
|
||||
}
|
||||
Reference in new issue
Block a user