fix: add public profiles tests

This commit is contained in:
David Nguyen
2025-02-19 16:07:04 +11:00
parent 5ce2bae39d
commit a319ea0f5e
26 changed files with 187 additions and 41 deletions

View File

@ -33,7 +33,7 @@ export const filesRoute = new Hono<HonoEnv>()
return c.json({ error: 'No file provided' }, 400);
}
// Todo: This is new.
// Todo: (RR7) This is new.
// Add file size validation.
// Convert MB to bytes (1 MB = 1024 * 1024 bytes)
const MAX_FILE_SIZE = APP_DOCUMENT_UPLOAD_SIZE_LIMIT * 1024 * 1024;
@ -54,7 +54,7 @@ export const filesRoute = new Hono<HonoEnv>()
throw new AppError('INVALID_DOCUMENT_FILE');
}
// Todo: Test this.
// Todo: (RR7) Test this.
if (!file.name.endsWith('.pdf')) {
Object.defineProperty(file, 'name', {
writable: true,

View File

@ -37,13 +37,13 @@ app.route('/api/auth', auth);
// Files route.
app.route('/api/files', filesRoute);
// API servers. Todo: Configure max durations, etc?
// API servers. Todo: (RR7) Configure max durations, etc?
app.route('/api/v1', tsRestHonoApp);
app.use('/api/jobs/*', jobsClient.getApiHandler());
app.use('/api/trpc/*', reactRouterTrpcServer);
// Unstable API server routes. Order matters for these two.
app.get(`${API_V2_BETA_URL}/openapi.json`, (c) => c.json(openApiDocument));
app.use(`${API_V2_BETA_URL}/*`, async (c) => openApiTrpcServerHandler(c)); // Todo: Add next()?
app.use(`${API_V2_BETA_URL}/*`, async (c) => openApiTrpcServerHandler(c)); // Todo: (RR7) Add next()?
export default app;

View File

@ -11,8 +11,8 @@ export const openApiTrpcServerHandler = async (c: Context) => {
return createOpenApiFetchHandler<typeof appRouter>({
endpoint: API_V2_BETA_URL,
router: appRouter,
// Todo: Test this, since it's not using the createContext params.
// Todo: Reduce calls since we fetch on most request? maybe
// Todo: (RR7) Test this, since it's not using the createContext params.
// Todo: (RR7) Reduce calls since we fetch on most request? maybe
createContext: async () => createTrpcContext({ c, requestSource: 'apiV2' }),
req: c.req.raw,
onError: (opts) => handleTrpcRouterError(opts, 'apiV2'),