Skip to content

Commit 59fc10b

Browse files
claudfuenclaude
andcommitted
fix: filter deactivated members from activity query and clamp inactiveDays
- Add deactivated:false to members query in getOrgActivity so deactivated users don't inflate lastSession or get picked as owner - Clamp inactiveDays to non-negative to prevent future-dated cutoffs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8b8270b commit 59fc10b

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

apps/api/src/admin-organizations/admin-organizations.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class AdminOrganizationsController {
5757
@Query('limit') limit?: string,
5858
) {
5959
return this.service.getOrgActivity({
60-
inactiveDays: Number.isFinite(parseInt(inactiveDays ?? '90', 10)) ? parseInt(inactiveDays ?? '90', 10) : 90,
60+
inactiveDays: Math.max(0, Number.isFinite(parseInt(inactiveDays ?? '90', 10)) ? parseInt(inactiveDays ?? '90', 10) : 90),
6161
hasAccess: hasAccess === 'true' ? true : hasAccess === 'false' ? false : undefined,
6262
onboarded: onboarded === 'true' ? true : onboarded === 'false' ? false : undefined,
6363
page: Math.max(1, parseInt(page || '1', 10) || 1),

apps/api/src/admin-organizations/admin-organizations.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export class AdminOrganizationsService {
127127
onboardingCompleted: true,
128128
_count: { select: { members: true, tasks: true, policies: true, auditLog: true } },
129129
members: {
130+
where: { deactivated: false },
130131
select: {
131132
role: true,
132133
user: {

0 commit comments

Comments
 (0)