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:
@@ -32,7 +32,7 @@ export const getAllTodos = async (req, res, next) => {
|
||||
data: todos,
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -58,7 +58,7 @@ export const getMyTodos = async (req, res, next) => {
|
||||
data: todos,
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -77,7 +77,7 @@ export const getTodoById = async (req, res, next) => {
|
||||
data: todo,
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -96,7 +96,7 @@ export const getTodoWithRelations = async (req, res, next) => {
|
||||
data: todo,
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -121,7 +121,7 @@ export const createTodo = async (req, res, next) => {
|
||||
message: 'Todo bolo vytvorené',
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -143,7 +143,7 @@ export const updateTodo = async (req, res, next) => {
|
||||
message: 'Todo bolo aktualizované',
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -170,7 +170,7 @@ export const deleteTodo = async (req, res, next) => {
|
||||
message: result.message,
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -203,6 +203,6 @@ export const toggleTodo = async (req, res, next) => {
|
||||
message: 'Todo status aktualizovaný',
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
next(error);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user