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