Skip to content

Commit

Permalink
Fixup silly errors (#4721)
Browse files Browse the repository at this point in the history
* Fixup silly errors

* Add "legacy: true" to legacy report routes
  • Loading branch information
EMcQ-BES authored Jul 11, 2023
1 parent 1163926 commit 6088642
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/tupaia-web-server/src/app/createApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function createApp() {
'requestCountryAccess',
handleWith(RequestCountryAccessRoute),
)
.get<EntitiesRequest>('entities/:hierarchyName/:rootEntityCode', handleWith(EntitiesRoute))
.get<EntitiesRequest>('entities/:projectCode/:rootEntityCode', handleWith(EntitiesRoute))
.get<EntitySearchRequest>('entitySearch/:projectCode', handleWith(EntitySearchRoute))
.get<EntitiesRequest>('entities/:projectCode/:rootEntityCode', handleWith(EntitiesRoute))
.get<EntityAncestorsRequest>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,13 @@
import { Request } from 'express';
import { Route } from '@tupaia/server-boilerplate';

export type LegacyDashboardReportRequest = Request<
{ reportCode: string },
any,
any,
any
>;
export type LegacyDashboardReportRequest = Request<{ reportCode: string }, any, any, any>;

export class LegacyDashboardReportRoute extends Route<LegacyDashboardReportRequest> {
public async buildResponse() {
const { query, ctx } = this.req;
const { reportCode } = this.req.params;

return ctx.services.webConfig.fetchReport(reportCode, query);
return ctx.services.webConfig.fetchReport(reportCode, { legacy: true, ...query });
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ export class LegacyMapOverlayReportRoute extends Route<LegacyMapOverlayReportReq
const { query, ctx } = this.req;
const { mapOverlayCode } = this.req.params;

return ctx.services.webConfig.fetchMeasureData(mapOverlayCode, query);
return ctx.services.webConfig.fetchMeasureData(mapOverlayCode, { legacy: true, ...query });
}
}
2 changes: 1 addition & 1 deletion packages/tupaia-web-server/src/routes/ReportRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class ReportRoute extends Route<ReportRequest> {
// the params for the non-legacy reports are different
const params = {
organisationUnitCodes: organisationUnitCode,
hierarchyName: projectCode,
hierarchy: projectCode,
startDate,
endDate,
};
Expand Down

0 comments on commit 6088642

Please sign in to comment.