Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
a61d5871
Commit
a61d5871
authored
Mar 31, 2026
by
weak-fox
Browse files
fix(admin): exclude rate-limited accounts from active filter
parent
318aa5e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
backend/internal/repository/account_repo.go
View file @
a61d5871
...
@@ -468,6 +468,14 @@ func (r *accountRepository) ListWithFilters(ctx context.Context, params paginati
...
@@ -468,6 +468,14 @@ func (r *accountRepository) ListWithFilters(ctx context.Context, params paginati
}
}
if
status
!=
""
{
if
status
!=
""
{
switch
status
{
switch
status
{
case
service
.
StatusActive
:
q
=
q
.
Where
(
dbaccount
.
StatusEQ
(
status
),
dbaccount
.
Or
(
dbaccount
.
RateLimitResetAtIsNil
(),
dbaccount
.
RateLimitResetAtLTE
(
time
.
Now
()),
),
)
case
"rate_limited"
:
case
"rate_limited"
:
q
=
q
.
Where
(
dbaccount
.
RateLimitResetAtGT
(
time
.
Now
()))
q
=
q
.
Where
(
dbaccount
.
RateLimitResetAtGT
(
time
.
Now
()))
case
"temp_unschedulable"
:
case
"temp_unschedulable"
:
...
...
backend/internal/repository/account_repo_integration_test.go
View file @
a61d5871
...
@@ -255,6 +255,22 @@ func (s *AccountRepoSuite) TestListWithFilters() {
...
@@ -255,6 +255,22 @@ func (s *AccountRepoSuite) TestListWithFilters() {
s
.
Require
()
.
Equal
(
service
.
StatusDisabled
,
accounts
[
0
]
.
Status
)
s
.
Require
()
.
Equal
(
service
.
StatusDisabled
,
accounts
[
0
]
.
Status
)
},
},
},
},
{
name
:
"filter_by_status_active_excludes_rate_limited"
,
setup
:
func
(
client
*
dbent
.
Client
)
{
mustCreateAccount
(
s
.
T
(),
client
,
&
service
.
Account
{
Name
:
"active-normal"
,
Status
:
service
.
StatusActive
})
rateLimited
:=
mustCreateAccount
(
s
.
T
(),
client
,
&
service
.
Account
{
Name
:
"active-rate-limited"
,
Status
:
service
.
StatusActive
})
err
:=
client
.
Account
.
UpdateOneID
(
rateLimited
.
ID
)
.
SetRateLimitResetAt
(
time
.
Now
()
.
Add
(
10
*
time
.
Minute
))
.
Exec
(
context
.
Background
())
s
.
Require
()
.
NoError
(
err
)
},
status
:
service
.
StatusActive
,
wantCount
:
1
,
validate
:
func
(
accounts
[]
service
.
Account
)
{
s
.
Require
()
.
Equal
(
"active-normal"
,
accounts
[
0
]
.
Name
)
},
},
{
{
name
:
"filter_by_search"
,
name
:
"filter_by_search"
,
setup
:
func
(
client
*
dbent
.
Client
)
{
setup
:
func
(
client
*
dbent
.
Client
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment