Skip to content

Commit f3598f1

Browse files
committed
fix: handle nil/missing deactivated_at field in UpdateProjectState filter
The DeactivatedAt field uses omitempty tag, so it may not exist in MongoDB for members who were never deactivated. Changed the filter to use $not $gt pattern which correctly matches: - deactivated_at = 0 - deactivated_at = nil - field doesn't exist Addresses Copilot code review feedback.
1 parent af7cdb2 commit f3598f1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

chaoscenter/authentication/pkg/project/repository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ func (r repository) UpdateProjectState(ctx context.Context, userID string, deact
373373
{"$elemMatch", bson.D{
374374
{"user_id", bson.D{{"$ne", userID}}},
375375
{"role", entities.RoleOwner},
376-
{"deactivated_at", 0},
376+
{"deactivated_at", bson.D{{"$not", bson.D{{"$gt", int64(0)}}}}},
377377
}},
378378
}},
379379
}},

0 commit comments

Comments
 (0)