Date: June 7, 2023, 10:44 am
Author: Akram Hossain
Parameters used for
- As placeholders for the dynamic values in the query
- To prevent SQL injection
Example
let businessArtists: Artists[] = await getRepository(Artists)
.createQueryBuilder('artists')
.leftJoin(LocationArtists, 'location_artists', 'artists.artist_id = location_artists.artist_id')
.where("artists.business_id =:business_id AND artists.is_active =:is_active AND artists.is_deleted=:is_deleted AND location_artists.location_id=:location_id", {
business_id: business.businessId,
is_active: 1,
is_deleted: 0,
location_id: locationId,
})
.getMany()
Views : 954