fix(admin-service): 修复 referrerId 可能为 null 的 TypeScript 错误
- getAncestors 和 getDirectReferrals 中的 directReferralCounts groupBy 结果 referrerId 字段可能为 null - 添加 filter 过滤 null 值,使用非空断言通过类型检查 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
58e3e34373
commit
97bcaa2dfc
|
|
@ -102,7 +102,11 @@ export class UserDetailQueryRepositoryImpl implements IUserDetailQueryRepository
|
|||
]);
|
||||
|
||||
const adoptionCountMap = new Map(adoptionCounts.map(a => [a.accountSequence, a._count.id]));
|
||||
const directCountMap = new Map(directReferralCounts.map(d => [d.referrerId.toString(), d._count.userId]));
|
||||
const directCountMap = new Map(
|
||||
directReferralCounts
|
||||
.filter(d => d.referrerId !== null)
|
||||
.map(d => [d.referrerId!.toString(), d._count.userId])
|
||||
);
|
||||
|
||||
// 合并数据
|
||||
const referralMap = new Map(referrals.map((r) => [r.userId.toString(), r]));
|
||||
|
|
@ -175,7 +179,11 @@ export class UserDetailQueryRepositoryImpl implements IUserDetailQueryRepository
|
|||
]);
|
||||
|
||||
const adoptionCountMap = new Map(adoptionCounts.map(a => [a.accountSequence, a._count.id]));
|
||||
const directCountMap = new Map(directReferralCounts.map(d => [d.referrerId.toString(), d._count.userId]));
|
||||
const directCountMap = new Map(
|
||||
directReferralCounts
|
||||
.filter(d => d.referrerId !== null)
|
||||
.map(d => [d.referrerId!.toString(), d._count.userId])
|
||||
);
|
||||
const userMap = new Map(users.map((u) => [u.userId.toString(), u]));
|
||||
|
||||
return directReferrals.map((ref) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue