Skip to content

Commit

Permalink
fix : issues in citystate_hospitals model
Browse files Browse the repository at this point in the history
  • Loading branch information
ad956 committed Jul 3, 2024
1 parent edb78b3 commit 88d71fb
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 61 deletions.
41 changes: 41 additions & 0 deletions app/models/citystate_hospitals.ts
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);
59 changes: 0 additions & 59 deletions app/models/hospitalsData.ts

This file was deleted.

4 changes: 2 additions & 2 deletions app/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -14,7 +14,7 @@ export {
CommonDiseases,
Doctor,
Hospital,
// HospitalsData,
CityStateHospital,
// MedicalHistory,
Patient,
Receptionist,
Expand Down

0 comments on commit 88d71fb

Please sign in to comment.