(input: CreateUserInput)
| 63 | } |
| 64 | |
| 65 | export async function createUser(input: CreateUserInput) { |
| 66 | try { |
| 67 | const salt = genSaltSync(10); |
| 68 | const hash = hashSync(input.password, salt); |
| 69 | |
| 70 | await db.insert(users).values({ |
| 71 | username: input.username, |
| 72 | email: input.email, |
| 73 | password: hash, |
| 74 | }); |
| 75 | } catch (e) { |
| 76 | throw e; |
| 77 | } |
| 78 | } |