Skip to content

Commit 7adfdd0

Browse files
Merge pull request #220 from 18F/semantic-routing-update-v2
Semantic routing update v2
2 parents 28a7adc + 05e18bb commit 7adfdd0

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "analytics-report-api",
3-
"version": "1.2.0",
3+
"version": "2.0.0",
44
"description": "An API for service data generated by Analytics Reporter",
55
"main": "index.js",
66
"scripts": {

src/app.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,6 @@ app.get('/', (req, res) => {
7575
});
7676
});
7777

78-
// we need to support legacy route
79-
// app.get('/v1.1/domain/:domain/reports/:reportName/data', checkDomainFilter);
80-
// app.get('/v1.1/agencies/:reportAgency/reports/:reportName/data', fetchData);
81-
// app.get('/v1.1/reports/:reportName/data', fetchData);
82-
83-
// We need a way to set versions without breaking the request
84-
// Right now if we update '/v1/reports/:reportName/data' to '/v2/reports/:reportName/data' anyone requesting from '/v1/reports/:reportName/data' will have a broken application
85-
8678
// middleware
8779
router.use('/v:version/', function(req, res, next) {
8880
console.log('req', req.params.version)
@@ -94,19 +86,19 @@ router.use('/v:version/', function(req, res, next) {
9486
router.get('/v:version/reports/:reportName/data',
9587
routesVersioning({
9688
"1.1.0": respondV1, // legacy
97-
"~1.2.0": fetchData,
89+
"~2.0.0": fetchData,
9890
}, NoMatchFoundCallback));
9991

10092
router.get('/v:version/domain/:domain/reports/:reportName/data',
10193
routesVersioning({
10294
"1.1.0": respondDomainV1, // legacy
103-
"~1.2.0": checkDomainFilter,
95+
"~2.0.0": checkDomainFilter,
10496
}, NoMatchFoundCallback));
10597

10698
router.get('/v:version/agencies/:reportAgency/reports/:reportName/data',
10799
routesVersioning({
108100
"1.1.0": respondV1, // legacy
109-
"~1.2.0": fetchData,
101+
"~2.0.0": fetchData,
110102
}, NoMatchFoundCallback));
111103

112104
function NoMatchFoundCallback(req, res) {
@@ -128,5 +120,4 @@ function respondDomainV1(req, res) {
128120
return checkDomainFilter(req, res)
129121
}
130122

131-
132123
module.exports = app;

src/db.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ const query = ({ reportName,
6969
version
7070
}) => {
7171
// we have different tables for new ga4
72+
// TODO: once UA has sunset we can remove this
7273
const dbTable = version === '1.1' ? "analytics_data" : "analytics_data_ga4"
7374
const limitParam = parseLimitParam(limit);
7475
const pageParam = parsePageParam(page);

0 commit comments

Comments
 (0)