mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-22 22:59:35 +02:00
accessibility filters for every profile
This commit is contained in:
parent
9f0db98cea
commit
965d5393ef
3 changed files with 16 additions and 6 deletions
15
index.js
15
index.js
|
@ -60,7 +60,18 @@ const createClient = (profile) => {
|
|||
}, opt)
|
||||
if (opt.via) opt.via = profile.formatLocation(profile, opt.via)
|
||||
opt.when = opt.when || new Date()
|
||||
const products = profile.formatProducts(opt.products || {})
|
||||
|
||||
const filters = [
|
||||
profile.formatProducts(opt.products || {})
|
||||
]
|
||||
if (
|
||||
opt.accessibility &&
|
||||
profile.filters &&
|
||||
profile.filters.accessibility &&
|
||||
profile.filters.accessibility[opt.accessibility]
|
||||
) {
|
||||
filters.push(profile.filters.accessibility[opt.accessibility])
|
||||
}
|
||||
|
||||
const query = profile.transformJourneysQuery({
|
||||
outDate: profile.formatDate(profile, opt.when),
|
||||
|
@ -72,7 +83,7 @@ const createClient = (profile) => {
|
|||
depLocL: [from],
|
||||
viaLocL: opt.via ? [opt.via] : null,
|
||||
arrLocL: [to],
|
||||
jnyFltrL: [products],
|
||||
jnyFltrL: filters,
|
||||
getTariff: !!opt.tickets,
|
||||
|
||||
// todo: what is req.gisFltrL?
|
||||
|
|
|
@ -21,6 +21,7 @@ const formatStation = require('../format/station')
|
|||
const formatTime = require('../format/time')
|
||||
const formatLocation = require('../format/location')
|
||||
const formatRectangle = require('../format/rectangle')
|
||||
const filters = require('../format/filters')
|
||||
|
||||
const id = x => x
|
||||
|
||||
|
@ -52,6 +53,7 @@ const defaultProfile = {
|
|||
formatTime,
|
||||
formatLocation,
|
||||
formatRectangle,
|
||||
filters,
|
||||
|
||||
journeyPart: false,
|
||||
radar: false
|
||||
|
|
|
@ -7,7 +7,7 @@ const _createParseJourney = require('../../parse/journey')
|
|||
const _formatStation = require('../../format/station')
|
||||
const createParseBitmask = require('../../parse/products-bitmask')
|
||||
const createFormatBitmask = require('../../format/products-bitmask')
|
||||
const {accessibility, bike} = require('../../format/filters')
|
||||
const {bike} = require('../../format/filters')
|
||||
|
||||
const modes = require('./modes')
|
||||
const formatLoyaltyCard = require('./loyalty-cards').format
|
||||
|
@ -36,9 +36,6 @@ const transformReq = (req) => {
|
|||
|
||||
const transformJourneysQuery = (query, opt) => {
|
||||
const filters = query.jnyFltrL
|
||||
if (opt.accessibility && accessibility[opt.accessibility]) {
|
||||
filters.push(accessibility[opt.accessibility])
|
||||
}
|
||||
if (opt.bike) filters.push(bike)
|
||||
|
||||
query.trfReq = {
|
||||
|
|
Loading…
Add table
Reference in a new issue