diff --git a/backend/models/Stations.js b/backend/models/Stations.js new file mode 100644 index 0000000..ac29f5e --- /dev/null +++ b/backend/models/Stations.js @@ -0,0 +1,53 @@ +import mongoose from "mongoose"; + +const Schema = mongoose.Schema; + +const stationSchema = new Schema( + { + name: { + type: String, + required: true, + trim: true, + }, + location: { + type: { + postalCode: { + type: Number, + required: true, + trim: true, + }, + city: { + type: String, + required: true, + trim: true, + }, + state: { + type: String, + required: true, + trim: true, + }, + }, + required: true, + }, + stationCode: { + type: String, + required: true, + trim: true, + unique: true, + }, + capacity: { + type: Number, + required: true, + }, + services: { + type: [String], // An array to list services like cloakroom, parking, restrooms, etc. + required: true, + }, + }, + { + timestamps: true, + } +); + +const Station = mongoose.model("Station", stationSchema); +export default Station;