You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

19 lines
484 B

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
}