2015-09-26 16:34:31 +02:00
|
|
|
export default function() {
|
2015-10-07 11:31:02 +02:00
|
|
|
this.namespace = '/api/ngsi10';
|
|
|
|
|
|
|
|
this.post('/queryContext', function(db, request) {
|
2015-09-28 13:45:09 +02:00
|
|
|
return {
|
2015-10-07 11:31:02 +02:00
|
|
|
contextResponses: db.entities.map(attrs => ({
|
|
|
|
contextElement: {
|
|
|
|
type: attrs.type,
|
|
|
|
isPattern: false,
|
|
|
|
id: attrs.name,
|
|
|
|
attributes: attrs.properties.map(props => ({
|
|
|
|
name: props.name,
|
|
|
|
type: props.type,
|
|
|
|
value: props.value,
|
|
|
|
metadatas: [
|
|
|
|
{
|
|
|
|
name: 'timestamp',
|
|
|
|
type: 'date',
|
|
|
|
value: props.timestamp
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}))
|
|
|
|
},
|
|
|
|
statusCode: {
|
|
|
|
code: 200,
|
|
|
|
reasonPhrase: 'OK'
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
};
|
2015-09-28 13:45:09 +02:00
|
|
|
});
|
2015-09-26 16:34:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
You can optionally export a config that is only loaded during tests
|
|
|
|
export function testConfig() {
|
|
|
|
|
|
|
|
}
|
|
|
|
*/
|