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
f6fe5b55
Commit
f6fe5b55
authored
Mar 04, 2026
by
xvhuan
Browse files
fix(admin): resolve CI lint and user subscriptions regression
parent
80ae592c
Changes
4
Show whitespace changes
Inline
Side-by-side
backend/internal/handler/admin/account_today_stats_cache.go
View file @
f6fe5b55
...
...
@@ -35,12 +35,12 @@ func buildAccountTodayStatsBatchCacheKey(accountIDs []int64) string {
}
var
b
strings
.
Builder
b
.
Grow
(
len
(
accountIDs
)
*
6
)
b
.
WriteString
(
"accounts_today_stats:"
)
_
,
_
=
b
.
WriteString
(
"accounts_today_stats:"
)
for
i
,
id
:=
range
accountIDs
{
if
i
>
0
{
b
.
WriteByte
(
','
)
_
=
b
.
WriteByte
(
','
)
}
b
.
WriteString
(
strconv
.
FormatInt
(
id
,
10
))
_
,
_
=
b
.
WriteString
(
strconv
.
FormatInt
(
id
,
10
))
}
return
b
.
String
()
}
backend/internal/handler/admin/user_handler.go
View file @
f6fe5b55
...
...
@@ -90,7 +90,10 @@ func (h *UserHandler) List(c *gin.Context) {
Role
:
c
.
Query
(
"role"
),
Search
:
search
,
Attributes
:
parseAttributeFilters
(
c
),
IncludeSubscriptions
:
parseBoolQueryWithDefault
(
c
.
Query
(
"include_subscriptions"
),
true
),
}
if
raw
,
ok
:=
c
.
GetQuery
(
"include_subscriptions"
);
ok
{
includeSubscriptions
:=
parseBoolQueryWithDefault
(
raw
,
true
)
filters
.
IncludeSubscriptions
=
&
includeSubscriptions
}
users
,
total
,
err
:=
h
.
adminService
.
ListUsers
(
c
.
Request
.
Context
(),
page
,
pageSize
,
filters
)
...
...
backend/internal/repository/user_repo.go
View file @
f6fe5b55
...
...
@@ -243,7 +243,8 @@ func (r *userRepository) ListWithFilters(ctx context.Context, params pagination.
userMap
[
u
.
ID
]
=
&
outUsers
[
len
(
outUsers
)
-
1
]
}
if
filters
.
IncludeSubscriptions
{
shouldLoadSubscriptions
:=
filters
.
IncludeSubscriptions
==
nil
||
*
filters
.
IncludeSubscriptions
if
shouldLoadSubscriptions
{
// Batch load active subscriptions with groups to avoid N+1.
subs
,
err
:=
r
.
client
.
UserSubscription
.
Query
()
.
Where
(
...
...
backend/internal/service/user_service.go
View file @
f6fe5b55
...
...
@@ -24,7 +24,8 @@ type UserListFilters struct {
Attributes
map
[
int64
]
string
// Custom attribute filters: attributeID -> value
// IncludeSubscriptions controls whether ListWithFilters should load active subscriptions.
// For large datasets this can be expensive; admin list pages should enable it on demand.
IncludeSubscriptions
bool
// nil means not specified (default: load subscriptions for backward compatibility).
IncludeSubscriptions
*
bool
}
type
UserRepository
interface
{
...
...
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