2020-03-02 20:50:33 +01:00
|
|
|
/**
|
|
|
|
* Model permettant de bufferiser les events reçus de Kafka
|
|
|
|
*/
|
|
|
|
module.exports = mongoose => {
|
|
|
|
const schema = new mongoose.Schema({
|
|
|
|
stationId: String,
|
2020-03-06 15:49:16 +01:00
|
|
|
name: String,
|
2020-03-02 20:50:33 +01:00
|
|
|
location: {
|
|
|
|
type: { type: String },
|
|
|
|
coordinates: []
|
|
|
|
},
|
|
|
|
prices: [
|
|
|
|
{
|
|
|
|
gasType: String,
|
|
|
|
price: Number,
|
|
|
|
updatedAt: Object
|
|
|
|
}
|
|
|
|
],
|
|
|
|
services: [],
|
|
|
|
postCode: String,
|
|
|
|
address: String,
|
|
|
|
city: String
|
|
|
|
});
|
|
|
|
|
|
|
|
schema.index({ location: "2dsphere" });
|
|
|
|
|
|
|
|
const Stations = mongoose.model("Stations", schema);
|
|
|
|
|
|
|
|
Stations.createIndexes();
|
|
|
|
|
|
|
|
return Stations;
|
|
|
|
};
|