Code quality improvements from code review
- Add admin-only authorization for company and projects CRUD operations - Create requireAccountId middleware to eliminate code duplication - Standardize error handling (use next(error) consistently) - Change error messages to Slovak language 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,7 @@ export const getEmailAccounts = async (req, res, next) => {
|
||||
data: accounts,
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -37,7 +37,7 @@ export const getEmailAccount = async (req, res, next) => {
|
||||
data: account,
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -67,7 +67,7 @@ export const createEmailAccount = async (req, res, next) => {
|
||||
message: 'Email účet úspešne pripojený',
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -93,7 +93,7 @@ export const updateEmailAccountPassword = async (req, res, next) => {
|
||||
message: 'Heslo k emailovému účtu bolo aktualizované',
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -119,7 +119,7 @@ export const toggleEmailAccountStatus = async (req, res, next) => {
|
||||
message: `Email účet ${isActive ? 'aktivovaný' : 'deaktivovaný'}`,
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -140,7 +140,7 @@ export const setPrimaryEmailAccount = async (req, res, next) => {
|
||||
message: 'Primárny email účet bol nastavený',
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -161,6 +161,6 @@ export const deleteEmailAccount = async (req, res, next) => {
|
||||
message: result.message,
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user