fix(authorization): allow querying REVOKED records despite deletedAt being set
撤销授权时会同时设置 status=REVOKED 和 deletedAt(软删除), 导致 findByStatus(REVOKED) 因为 deletedAt IS NULL 条件永远返回空。 修改为查询 REVOKED 状态时不过滤 deletedAt。 🤖 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
5026661fa8
commit
0991d5d484
|
|
@ -183,8 +183,12 @@ export class AuthorizationRoleRepositoryImpl implements IAuthorizationRoleReposi
|
|||
}
|
||||
|
||||
async findByStatus(status: AuthorizationStatus): Promise<AuthorizationRole[]> {
|
||||
// 查询 REVOKED 状态时不过滤 deletedAt,因为撤销操作会同时设置 deletedAt
|
||||
const whereClause = status === AuthorizationStatus.REVOKED
|
||||
? { status }
|
||||
: { status, ...this.notDeleted }
|
||||
const records = await this.prisma.authorizationRole.findMany({
|
||||
where: { status, ...this.notDeleted },
|
||||
where: whereClause,
|
||||
})
|
||||
return records.map((record) => this.toDomain(record))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue