import ErrorType from '../error/types.error.js' import User from '../dao/user.dao.js' async function getUser(username) { if (!username) throw new Error(ErrorType.FUNCTIONAL_MISSING_PARAMETERS) const user = await getUserDB(username) if (!user) throw new Error(ErrorType.FUNCTIONAL_NOT_FOUND) return user } export default { getUser } async function getUserDB(username) { let user = null if (username) user = await User.findByName(username.toLowerCase()) return user }