mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 23:29:35 +02:00
db: parse additional line names
This commit is contained in:
parent
1e8bdda6df
commit
d797333a70
1 changed files with 13 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
||||||
const trim = require('lodash/trim')
|
const trim = require('lodash/trim')
|
||||||
|
|
||||||
const _createParseJourney = require('../../parse/journey')
|
const _createParseJourney = require('../../parse/journey')
|
||||||
|
const _createParseLine = require('../../parse/line')
|
||||||
const _parseHint = require('../../parse/hint')
|
const _parseHint = require('../../parse/hint')
|
||||||
const _formatStation = require('../../format/station')
|
const _formatStation = require('../../format/station')
|
||||||
const {bike} = require('../../format/filters')
|
const {bike} = require('../../format/filters')
|
||||||
|
@ -12,7 +13,7 @@ const formatLoyaltyCard = require('./loyalty-cards').format
|
||||||
|
|
||||||
const transformReqBody = (body) => {
|
const transformReqBody = (body) => {
|
||||||
body.client = {id: 'DB', v: '16040000', type: 'IPH', name: 'DB Navigator'}
|
body.client = {id: 'DB', v: '16040000', type: 'IPH', name: 'DB Navigator'}
|
||||||
body.ext = 'DB.R15.12.a'
|
body.ext = 'DB.R18.06.a'
|
||||||
body.ver = '1.16'
|
body.ver = '1.16'
|
||||||
body.auth = {type: 'AID', aid: 'n91dB8Z77MLdoR0K'}
|
body.auth = {type: 'AID', aid: 'n91dB8Z77MLdoR0K'}
|
||||||
|
|
||||||
|
@ -37,6 +38,16 @@ const transformJourneysQuery = (query, opt) => {
|
||||||
return query
|
return query
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const createParseLine = (profile, opt, data) => {
|
||||||
|
const parseLine = _createParseLine(profile, opt, data)
|
||||||
|
const parseLineWithAdditionalName = (l) => {
|
||||||
|
const res = parseLine(l)
|
||||||
|
if (l.addName) res.additionalName = l.addName
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
return parseLineWithAdditionalName
|
||||||
|
}
|
||||||
|
|
||||||
const createParseJourney = (profile, opt, data) => {
|
const createParseJourney = (profile, opt, data) => {
|
||||||
const parseJourney = _createParseJourney(profile, opt, data)
|
const parseJourney = _createParseJourney(profile, opt, data)
|
||||||
|
|
||||||
|
@ -315,6 +326,7 @@ const dbProfile = {
|
||||||
|
|
||||||
// todo: parseLocation
|
// todo: parseLocation
|
||||||
parseJourney: createParseJourney,
|
parseJourney: createParseJourney,
|
||||||
|
parseLine: createParseLine,
|
||||||
parseHint,
|
parseHint,
|
||||||
|
|
||||||
formatStation,
|
formatStation,
|
||||||
|
|
Loading…
Add table
Reference in a new issue