mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09: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)
|
}, opt)
|
||||||
if (opt.via) opt.via = profile.formatLocation(profile, opt.via)
|
if (opt.via) opt.via = profile.formatLocation(profile, opt.via)
|
||||||
opt.when = opt.when || new Date()
|
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({
|
const query = profile.transformJourneysQuery({
|
||||||
outDate: profile.formatDate(profile, opt.when),
|
outDate: profile.formatDate(profile, opt.when),
|
||||||
|
@ -72,7 +83,7 @@ const createClient = (profile) => {
|
||||||
depLocL: [from],
|
depLocL: [from],
|
||||||
viaLocL: opt.via ? [opt.via] : null,
|
viaLocL: opt.via ? [opt.via] : null,
|
||||||
arrLocL: [to],
|
arrLocL: [to],
|
||||||
jnyFltrL: [products],
|
jnyFltrL: filters,
|
||||||
getTariff: !!opt.tickets,
|
getTariff: !!opt.tickets,
|
||||||
|
|
||||||
// todo: what is req.gisFltrL?
|
// todo: what is req.gisFltrL?
|
||||||
|
|
|
@ -21,6 +21,7 @@ const formatStation = require('../format/station')
|
||||||
const formatTime = require('../format/time')
|
const formatTime = require('../format/time')
|
||||||
const formatLocation = require('../format/location')
|
const formatLocation = require('../format/location')
|
||||||
const formatRectangle = require('../format/rectangle')
|
const formatRectangle = require('../format/rectangle')
|
||||||
|
const filters = require('../format/filters')
|
||||||
|
|
||||||
const id = x => x
|
const id = x => x
|
||||||
|
|
||||||
|
@ -52,6 +53,7 @@ const defaultProfile = {
|
||||||
formatTime,
|
formatTime,
|
||||||
formatLocation,
|
formatLocation,
|
||||||
formatRectangle,
|
formatRectangle,
|
||||||
|
filters,
|
||||||
|
|
||||||
journeyPart: false,
|
journeyPart: false,
|
||||||
radar: false
|
radar: false
|
||||||
|
|
|
@ -7,7 +7,7 @@ const _createParseJourney = require('../../parse/journey')
|
||||||
const _formatStation = require('../../format/station')
|
const _formatStation = require('../../format/station')
|
||||||
const createParseBitmask = require('../../parse/products-bitmask')
|
const createParseBitmask = require('../../parse/products-bitmask')
|
||||||
const createFormatBitmask = require('../../format/products-bitmask')
|
const createFormatBitmask = require('../../format/products-bitmask')
|
||||||
const {accessibility, bike} = require('../../format/filters')
|
const {bike} = require('../../format/filters')
|
||||||
|
|
||||||
const modes = require('./modes')
|
const modes = require('./modes')
|
||||||
const formatLoyaltyCard = require('./loyalty-cards').format
|
const formatLoyaltyCard = require('./loyalty-cards').format
|
||||||
|
@ -36,9 +36,6 @@ const transformReq = (req) => {
|
||||||
|
|
||||||
const transformJourneysQuery = (query, opt) => {
|
const transformJourneysQuery = (query, opt) => {
|
||||||
const filters = query.jnyFltrL
|
const filters = query.jnyFltrL
|
||||||
if (opt.accessibility && accessibility[opt.accessibility]) {
|
|
||||||
filters.push(accessibility[opt.accessibility])
|
|
||||||
}
|
|
||||||
if (opt.bike) filters.push(bike)
|
if (opt.bike) filters.push(bike)
|
||||||
|
|
||||||
query.trfReq = {
|
query.trfReq = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue