Skip to content

Commit

Permalink
fix: allow all length for evaNumbers (marudor#480)
Browse files Browse the repository at this point in the history
  • Loading branch information
marudor authored Apr 6, 2021
1 parent f34acf4 commit 576a3f0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
6 changes: 3 additions & 3 deletions packages/server/API/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const models: TsoaRoute.Models = {
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
"EvaNumber": {
"dataType": "refAlias",
"type": {"dataType":"string","validators":{"minLength":{"value":7},"maxLength":{"value":7}}},
"type": {"dataType":"string","validators":{}},
},
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
"OccupancyPeriod": {
Expand Down Expand Up @@ -1573,8 +1573,8 @@ const models: TsoaRoute.Models = {
"numF": {"dataType":"double"},
"ctxScr": {"dataType":"string"},
"ushrp": {"dataType":"boolean"},
"start": {"dataType":"string","required":true},
"destination": {"dataType":"string","required":true},
"start": {"ref":"EvaNumber","required":true},
"destination": {"ref":"EvaNumber","required":true},
"time": {"dataType":"datetime"},
"transferTime": {"dataType":"double"},
"maxChanges": {"dataType":"double"},
Expand Down
3 changes: 3 additions & 0 deletions packages/server/StopPlace/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ export async function geoSearchStopPlace(
}

async function byRl100WithSpaceHandling(rl100: string) {
if (rl100.length > 5) {
return Promise.resolve(undefined);
}
const rl100Promise = byRl100(rl100.toUpperCase());
let rl100DoubleSpacePromise: typeof rl100Promise = Promise.resolve(undefined);
if (rl100.length < 5 && rl100.includes(' ')) {
Expand Down
9 changes: 3 additions & 6 deletions packages/types/common.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
export interface CommonRoutingOptions {
// evaid
start: string;
// evaid
destination: string;
start: EvaNumber;
destination: EvaNumber;
time?: Date;
}

/**
* @minLength 7
* @maxLength 7
* Usually 7 digits
*/
export type EvaNumber = string;
7 changes: 3 additions & 4 deletions public/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
},
"EvaNumber": {
"type": "string",
"minLength": 7,
"maxLength": 7
"description": "Usually 7 digits"
},
"OccupancyPeriod": {
"properties": {
Expand Down Expand Up @@ -3717,10 +3716,10 @@
"description": "Is a station nearby enough for routing?"
},
"start": {
"type": "string"
"$ref": "#/components/schemas/EvaNumber"
},
"destination": {
"type": "string"
"$ref": "#/components/schemas/EvaNumber"
},
"time": {
"type": "string",
Expand Down

0 comments on commit 576a3f0

Please sign in to comment.