diff --git a/app/models/citystate_hospitals.ts b/app/models/citystate_hospitals.ts new file mode 100644 index 00000000..c9e869ef --- /dev/null +++ b/app/models/citystate_hospitals.ts @@ -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({ + hospital_id: { type: String, default: null }, + hospital_name: { type: String, required: true }, + appointment_charge: { type: String, required: true }, +}); + +const citySchema = new mongoose.Schema({ + name: { type: String, required: true }, + hospitals: [hospitalSchema], +}); + +const stateSchema = new mongoose.Schema( + { + name: { type: String, required: true }, + cities: [citySchema], + }, + { + collection: "citystate_hospitals", + } +); + +export default mongoose.models.StateDocument || + mongoose.model("StateDocument", stateSchema); diff --git a/app/models/hospitalsData.ts b/app/models/hospitalsData.ts deleted file mode 100644 index d7fefe41..00000000 --- a/app/models/hospitalsData.ts +++ /dev/null @@ -1,59 +0,0 @@ -// import mongoose from "mongoose"; - -// export interface CityStateHospital extends mongoose.Document { -// State: { -// City: [ -// { -// hospital_id: null; -// hospital_name: "Apollo Hospitals"; -// appointment_charge: "250"; -// }, -// { -// hospital_id: null; -// hospital_name: "Yashoda Hospitals"; -// appointment_charge: "250"; -// }, -// { -// hospital_id: null; -// hospital_name: "KIMS Hospitals"; -// appointment_charge: "250"; -// }, -// { -// hospital_id: null; -// hospital_name: "Continental Hospitals"; -// appointment_charge: "250"; -// }, -// { -// hospital_id: null; -// hospital_name: "Sunshine Hospitals"; -// appointment_charge: "250"; -// } -// ]; -// }; -// } - -// const hospitalsDataSchema = new mongoose.Schema({ -// hospital_id: String, -// hospital_name: { type: String, required: true }, -// appointment_charge: { type: String, required: true }, -// }); - -// const cityStateSchema = new mongoose.Schema( -// { -// _id: { type: mongoose.Schema.Types.ObjectId, required: true }, -// state: String, -// cities: [ -// { -// city_name: { type: String, required: true }, -// hospitals: [hospitalsDataSchema], -// }, -// ], -// }, -// { -// collection: "citystate_hospitals", -// } -// ); - -// const HospitalsData = mongoose.model("HospitalsData", cityStateSchema); - -// export default HospitalsData; diff --git a/app/models/index.ts b/app/models/index.ts index a2b369ac..db14b469 100644 --- a/app/models/index.ts +++ b/app/models/index.ts @@ -2,8 +2,8 @@ import BookedAppointment from "./bookedAppointment"; import CommonDiseases from "./commonDisease"; import Doctor from "./doctor"; import Hospital from "./hospital"; -// import HospitalsData from "./HospitalsData"; // import MedicalHistory from "./MedicalHistory"; +import CityStateHospital from "./citystate_hospitals"; import Patient from "./patient"; import Receptionist from "./receptionist"; // import Transaction from "./Transaction"; @@ -14,7 +14,7 @@ export { CommonDiseases, Doctor, Hospital, - // HospitalsData, + CityStateHospital, // MedicalHistory, Patient, Receptionist,