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:
@@ -33,7 +33,7 @@ export const getContacts = async (req, res, next) => {
|
||||
data: contacts,
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -79,7 +79,7 @@ export const discoverContacts = async (req, res, next) => {
|
||||
data: potentialContacts,
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -138,7 +138,7 @@ export const addContact = async (req, res, next) => {
|
||||
message: 'Kontakt pridaný a emaily synchronizované',
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -172,7 +172,7 @@ export const removeContact = async (req, res, next) => {
|
||||
message: result.message,
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -208,7 +208,7 @@ export const updateContact = async (req, res, next) => {
|
||||
message: 'Kontakt aktualizovaný',
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -255,7 +255,7 @@ export const linkCompanyToContact = async (req, res, next) => {
|
||||
message: 'Firma bola linknutá ku kontaktu',
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -290,7 +290,7 @@ export const unlinkCompanyFromContact = async (req, res, next) => {
|
||||
message: 'Firma bola odlinknutá od kontaktu',
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -327,6 +327,6 @@ export const createCompanyFromContact = async (req, res, next) => {
|
||||
message: 'Firma bola vytvorená z kontaktu',
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user