use uuid
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user