update parsing

This commit is contained in:
Nate Kelley 2025-08-02 20:39:37 -06:00
parent a4f960ff13
commit 605b79f9b9
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
2 changed files with 6 additions and 4 deletions

View File

@ -77,7 +77,8 @@ async function getReportsListHandler(
];
const { page, page_size } = request;
const startIndex = page * page_size;
// Page is 1-based, so we need to subtract 1 for array indexing
const startIndex = (page - 1) * page_size;
const endIndex = startIndex + page_size;
const paginatedReports = stubbedReports.slice(startIndex, endIndex);
@ -99,6 +100,7 @@ const app = new Hono().get('/', zValidator('query', GetReportsListRequestSchema)
const user = c.get('busterUser');
const response = await getReportsListHandler(request, user);
return c.json(response);
});

View File

@ -14,7 +14,7 @@ async function updateReportHandler(
request: UpdateReportRequest,
user: User
): Promise<UpdateReportResponse> {
const existingReport = {
const existingReport: ReportResponse = {
id: reportId,
name: 'Sales Analysis Q4',
file_name: 'sales_analysis_q4.md',
@ -40,9 +40,9 @@ async function updateReportHandler(
throw new HTTPException(404, { message: 'Report not found' });
}
const updatedReport = {
const updatedReport: UpdateReportResponse = {
...existingReport,
...request,
...(request as Partial<ReportResponse>),
updated_at: new Date().toISOString(),
};