mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 14:12:10 +08:00
PERF: introduce a basic api key serializer
For better performances when listing all the API keys. Loading all the "api key scopes" is slow and not required when showing the list of all the api keys.
This commit is contained in:
@ -13,12 +13,16 @@ class Admin::ApiController < Admin::AdminController
|
||||
keys =
|
||||
ApiKey
|
||||
.where(hidden: false)
|
||||
.includes(:user, :api_key_scopes)
|
||||
.includes(:user)
|
||||
.order("revoked_at DESC NULLS FIRST, created_at DESC")
|
||||
.offset(offset)
|
||||
.limit(limit)
|
||||
|
||||
render_json_dump(keys: serialize_data(keys, ApiKeySerializer), offset: offset, limit: limit)
|
||||
render_json_dump(
|
||||
keys: serialize_data(keys, BasicApiKeySerializer),
|
||||
offset: offset,
|
||||
limit: limit,
|
||||
)
|
||||
end
|
||||
|
||||
def show
|
||||
|
Reference in New Issue
Block a user