Optimize storage, GC, and upload hot paths
This commit is contained in:
@@ -65,7 +65,7 @@ describe('admin read endpoints', () => {
|
||||
it('call apiJson for the listing/settings reads', async () => {
|
||||
await admin.listUsers(25, 0);
|
||||
expect(jsonMock).toHaveBeenCalledWith(
|
||||
expect.stringContaining('/api/admin/users?limit=25&offset=0'),
|
||||
'/api/admin/users?limit=25&offset=0&summary=true',
|
||||
expect.anything()
|
||||
);
|
||||
await admin.getDashboard();
|
||||
|
||||
@@ -5,7 +5,14 @@
|
||||
*/
|
||||
import { apiFetch, apiJson } from '$lib/api/client';
|
||||
import { getCsrfHeaders } from '$lib/api/csrf';
|
||||
import type { Drive, DriveMember, DriveMemberSubject, DriveRole, User } from '$lib/api/types';
|
||||
import type {
|
||||
AdminUsersPage,
|
||||
Drive,
|
||||
DriveMember,
|
||||
DriveMemberSubject,
|
||||
DriveRole,
|
||||
User
|
||||
} from '$lib/api/types';
|
||||
|
||||
const JSON_HEADERS = { 'Content-Type': 'application/json' };
|
||||
|
||||
@@ -232,13 +239,10 @@ export async function deleteDriveAdmin(driveId: string): Promise<void> {
|
||||
|
||||
// ── Users ───────────────────────────────────────────────────────────────
|
||||
|
||||
export interface AdminUsersPage {
|
||||
total: number;
|
||||
users: User[];
|
||||
}
|
||||
|
||||
/** List the compact rows rendered by the management table; full account
|
||||
* details remain available through {@link getUserAdmin}. */
|
||||
export function listUsers(limit: number, offset: number): Promise<AdminUsersPage> {
|
||||
return apiJson<AdminUsersPage>(`/api/admin/users?limit=${limit}&offset=${offset}`, {
|
||||
return apiJson<AdminUsersPage>(`/api/admin/users?limit=${limit}&offset=${offset}&summary=true`, {
|
||||
credentials: 'same-origin'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -199,6 +199,28 @@ export interface User {
|
||||
ui_preferences: Record<string, unknown>;
|
||||
}
|
||||
|
||||
/** Fields rendered by the paginated admin table. Full account details remain
|
||||
* available from the detail endpoint; this shape keeps avatars and preference
|
||||
* documents off every listing page. */
|
||||
export type AdminUserSummary = Pick<
|
||||
User,
|
||||
| 'id'
|
||||
| 'username'
|
||||
| 'email'
|
||||
| 'role'
|
||||
| 'storage_quota_bytes'
|
||||
| 'storage_used_bytes'
|
||||
| 'last_login_at'
|
||||
| 'active'
|
||||
| 'auth_provider'
|
||||
| 'is_external'
|
||||
>;
|
||||
|
||||
export interface AdminUsersPage {
|
||||
total: number;
|
||||
users: AdminUserSummary[];
|
||||
}
|
||||
|
||||
export interface AuthResponse {
|
||||
user: User;
|
||||
access_token: string;
|
||||
|
||||
Reference in New Issue
Block a user