let query: SelectQueryBuilder<Projects> = this.projectModel
.createQueryBuilder('projects')
.select([
'projects',
'customers.id',
'customers.email',
'customers.phone',
'customers.is_verified',
'customers.created_at',
'property_types',
'project_executives',
'interior_design_partners',
'mitra_produksi_partners'
])
.where({ deleted_at: null })
.leftJoin('projects.customers', 'customers')
.leftJoin('projects.property_types', 'property_types')
.leftJoin('projects.project_executive', 'project_executives')
.leftJoin('projects.interior_design_partner', 'interior_design_partners')
.leftJoin('projects.mitra_produksi_partner', 'mitra_produksi_partners')
this.createQueryBuilder('profile')
.leftJoinAndSelect('profile.avatarPhoto', 'avatarPhoto')
.leftJoinAndSelect('profile.coverPhoto', 'coverPhoto')
.leftJoinAndSelect('profile.primaryCountry', 'country')
.leftJoinAndSelect('profile.primaryCity', 'city')
.leftJoinAndSelect('profile.images', 'image')
.leftJoinAndSelect('profile.practicedSports', 'practicedSport')
.leftJoinAndSelect(
(subQuery) =>
subQuery
.subQuery()
.createQueryBuilder()
.select(['id'])
.leftJoin('user', 'user')
.from(SportEvent, 'event'),
'event',
'event.user.id = profile.id',
)
// .leftJoinAndSelect('profile.sportServices', 'service')
// .leftJoinAndSelect('profile.lessons', 'lesson')
// .leftJoinAndSelect('profile.activityRequests', 'request')
.leftJoin('profile.userAuth', 'auth')
.where('auth.registered = true')
.andWhere('auth.blocked = false')
.take(params.pageSize)
.skip(itemsNumber)
.getMany()