-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix : issues in citystate_hospitals model
- Loading branch information
Showing
3 changed files
with
43 additions
and
61 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,41 @@ | ||
import mongoose from "mongoose"; | ||
|
||
interface HospitalDocument extends mongoose.Document { | ||
hospital_id: string | null; | ||
hospital_name: string; | ||
appointment_charge: string; | ||
} | ||
|
||
interface CityDocument extends mongoose.Document { | ||
name: string; | ||
hospitals: HospitalDocument[]; | ||
} | ||
|
||
interface StateDocument extends mongoose.Document { | ||
name: string; | ||
cities: CityDocument[]; | ||
} | ||
|
||
const hospitalSchema = new mongoose.Schema<HospitalDocument>({ | ||
hospital_id: { type: String, default: null }, | ||
hospital_name: { type: String, required: true }, | ||
appointment_charge: { type: String, required: true }, | ||
}); | ||
|
||
const citySchema = new mongoose.Schema<CityDocument>({ | ||
name: { type: String, required: true }, | ||
hospitals: [hospitalSchema], | ||
}); | ||
|
||
const stateSchema = new mongoose.Schema<StateDocument>( | ||
{ | ||
name: { type: String, required: true }, | ||
cities: [citySchema], | ||
}, | ||
{ | ||
collection: "citystate_hospitals", | ||
} | ||
); | ||
|
||
export default mongoose.models.StateDocument || | ||
mongoose.model<StateDocument>("StateDocument", stateSchema); |
This file was deleted.
Oops, something went wrong.
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