feat: add testing setup in backend

This commit is contained in:
Lin, Hung-Shin committed 2023-11-17 10:59:47 +08:00
1 parent cb376caff0
commit 1f77328362
15 files changed
+92 -100

No files matched your search

+16
View File
@@ -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()
}