add uuid to account

This commit is contained in:
Brian Cao committed 2022-09-30 22:27:47 -07:00
1 parent d4abe51331
commit adb0a06006
3 files changed
+26 -8

No files matched your search

+6 -1
View File
@@ -1,6 +1,7 @@
import { ok, unauthorized, methodNotAllowed, badRequest, hashPassword } from 'next-basics';
import { getAccountById, getAccountByUsername, updateAccount, createAccount } from 'queries';
import { useAuth } from 'lib/middleware';
import { uuid } from 'lib/crypto';
export default async (req, res) => {
await useAuth(req, res);
@@ -47,7 +48,11 @@ export default async (req, res) => {
return badRequest(res, 'Account already exists');
}
const created = await createAccount({ username, password: hashPassword(password) });
const created = await createAccount({
username,
password: hashPassword(password),
account_uuid: uuid(),
});
return ok(res, created);
}