-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #174 from haseebzaki-07/new_branch_3
Added Station Schema : Fixes issue #159
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |