This commit is contained in:
Brian Cao 2022-10-31 23:42:37 -07:00
parent 246e4e5f4f
commit 17041efaae
73 changed files with 491 additions and 874 deletions

View file

@ -13,9 +13,9 @@ const runQuery = async query => {
});
};
const updateAccountByUsername = (username, data) => {
const updateUserByUsername = (username, data) => {
return runQuery(
prisma.account.update({
prisma.user.update({
where: {
username,
},
@ -26,7 +26,7 @@ const updateAccountByUsername = (username, data) => {
const changePassword = async (username, newPassword) => {
const password = hashPassword(newPassword);
return updateAccountByUsername(username, { password });
return updateUserByUsername(username, { password });
};
const getUsernameAndPassword = async () => {
@ -40,7 +40,7 @@ const getUsernameAndPassword = async () => {
questions.push({
type: 'text',
name: 'username',
message: 'Enter account to change password',
message: 'Enter user to change password',
});
}
if (!password) {
@ -84,7 +84,7 @@ const getUsernameAndPassword = async () => {
console.log('Password changed for user', chalk.greenBright(username));
} catch (error) {
if (error.meta.cause.includes('Record to update not found')) {
console.log('Account not found:', chalk.redBright(username));
console.log('User not found:', chalk.redBright(username));
} else {
throw error;
}

View file

@ -40,7 +40,7 @@ async function checkConnection() {
async function checkTables() {
try {
await prisma.$queryRaw`select * from account limit 1`;
await prisma.$queryRaw`select * from user limit 1`;
success('Database tables found.');
} catch (e) {