async function getSearchedData (search:string){
try {
const searchData = return await this.connection
.getRepository(UserEntity)
.createQueryBuilder("user")
.leftJoinAndSelect("user.roles", "roles")
.where(
"user.full_name LIKE :search OR user.username LIKE :search OR user.email LIKE :search",
{ search: `%${search}%` }
)
.getMany();
return searchData
} catch (error) {
throw new InternalServerErrorException();
}
}
Last active
April 16, 2021 14:17
-
-
Save SantoshCode/66028c0bdf5573d43019a9a0860d50eb to your computer and use it in GitHub Desktop.
Creating search items endpoint | NestJs, Typeorm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment