fix bug
This commit is contained in:
@@ -65,14 +65,17 @@ export class InvoicesRepository extends Repository<Invoice> {
|
||||
}
|
||||
|
||||
async findPaginatedListByUserIds(queryDto: InvoicesSearchQueryDto, userIds: string[]) {
|
||||
if (!userIds.length) {
|
||||
return [[], 0] as [Invoice[], number];
|
||||
}
|
||||
|
||||
const { limit, skip } = PaginationUtils(queryDto);
|
||||
|
||||
const queryBuilder = this.createQueryBuilder("invoice");
|
||||
console.log(userIds)
|
||||
queryBuilder
|
||||
.leftJoin("invoice.user", "user")
|
||||
.addSelect(["user.id", "user.firstName", "user.lastName", "user.email", "user.phone"])
|
||||
// .where("user.id IN (:...userIds)", { userIds });
|
||||
.where("user.id IN (:...userIds)", { userIds });
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -131,17 +131,22 @@ export class ReferralsService {
|
||||
}
|
||||
|
||||
async findReferedUsersIds(userIds: string[]) {
|
||||
const referedUSers = await this.referralsRepository.find({
|
||||
const referrals = await this.referralsRepository.find({
|
||||
where: {
|
||||
referrer: {
|
||||
id: In(userIds)
|
||||
}
|
||||
},
|
||||
relations: {
|
||||
referredUser: true
|
||||
},
|
||||
select: {
|
||||
referredUser: {
|
||||
id: true
|
||||
}
|
||||
}
|
||||
})
|
||||
return referedUSers.map(u => u.id)
|
||||
return referrals.map(r => r.referredUser.id)
|
||||
}
|
||||
|
||||
//*********************************** */
|
||||
|
||||
@@ -14,9 +14,8 @@ export class ReferralRewardsRepository extends Repository<ReferralReward> {
|
||||
|
||||
async findPaginatedList(userIds: string[], queryDto: SearchWithdrawRequestQueryDto) {
|
||||
const { limit, skip } = PaginationUtils(queryDto);
|
||||
console.log(userIds)
|
||||
const qb = this.createQueryBuilder("rr")
|
||||
// .where("rr.userId IN (:...userIds)", { userIds })
|
||||
.where("rr.userId IN (:...userIds)", { userIds })
|
||||
.leftJoinAndSelect("rr.user", "user")
|
||||
.orderBy("rr.createdAt", "DESC")
|
||||
.skip(skip)
|
||||
|
||||
Reference in New Issue
Block a user