refactor: remove redundant FileRow type annotation in pages.ts map callback

This commit is contained in:
2026-05-14 22:51:27 -07:00
parent 118ea15b4a
commit 5586a8cf19

View File

@@ -7,7 +7,7 @@ import type { Config } from '../config.ts';
import type { Logger } from '../middleware/logging.ts'; import type { Logger } from '../middleware/logging.ts';
import type { JwtPayload } from '../types.ts'; import type { JwtPayload } from '../types.ts';
import type { LockoutService } from '../services/lockout.ts'; import type { LockoutService } from '../services/lockout.ts';
import { createFile, getFileById, getFilesByUserId, deleteFile, type FileRow } from '../db/files.ts'; import { createFile, getFileById, getFilesByUserId, deleteFile } from '../db/files.ts';
import { saveFile, deleteStoredFile, getFilePath } from '../services/storage.ts'; import { saveFile, deleteStoredFile, getFilePath } from '../services/storage.ts';
import { attemptLogin } from '../services/login-handler.ts'; import { attemptLogin } from '../services/login-handler.ts';
import { makeRequireAuth, issueSessionCookie } from '../middleware/auth.ts'; import { makeRequireAuth, issueSessionCookie } from '../middleware/auth.ts';
@@ -148,7 +148,7 @@ export const pageRoutes: FastifyPluginAsync<{ deps: Deps }> = async (app, { deps
app.get('/files', { preHandler: requireAuth }, async (request, reply) => { app.get('/files', { preHandler: requireAuth }, async (request, reply) => {
const { sub: userId } = request.user as JwtPayload; const { sub: userId } = request.user as JwtPayload;
const files = getFilesByUserId(db, userId); const files = getFilesByUserId(db, userId);
const filesWithSize = files.map((f: FileRow) => ({ ...f, sizeFormatted: formatBytes(f.size) })); const filesWithSize = files.map((f) => ({ ...f, sizeFormatted: formatBytes(f.size) }));
return reply.view('file-list.ejs', { title: 'My files', authed: true, files: filesWithSize, baseUrl: config.baseUrl }); return reply.view('file-list.ejs', { title: 'My files', authed: true, files: filesWithSize, baseUrl: config.baseUrl });
}); });