in our project we have an SQL Database with a table representing all users
CREATE TABLE `user_table` (
`firstname` varchar(20) NOT NULL,
`lastName` varchar(20) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(24) NOT NULL,
`accessToken` varchar(64) NOT NULL,
`id` bigint(20) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
)
and we have a class UserDAO. We need to add methods such as
public boolean areUserCredentialsValid(String email, String password) {...}
public boolean isAccessTokenValid(String accessToken) {...}
public boolean isEmailInUse(String email) {...}
I think the names are pretty self-explicative: we want to perform operations on the entire table in order to return boolean values, so we thought it may not be correct to add these methods in UserDAO, as they do not perform CRUD operations on a single User, instead they perform R-only operations on the entire User Table, so we were thinking about a new class AllUsersDAO but it does not seem convincing. What is the best solution here and why?
I don't know if we are overthinking this, but this is a project for an University course and we are evaluated especially for our software engineering abilities, so we want to be sure to adopt the best solution.
Thank you all in advance!