From dde6aee500b96f8d8fc2f14e84266c57306224c3 Mon Sep 17 00:00:00 2001 From: haseebzaki-07 Date: Thu, 10 Oct 2024 16:05:24 +0530 Subject: [PATCH] Add Station Schema --- backend/models/Stations.js | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 backend/models/Stations.js 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;