Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ad956 committed Jul 3, 2024
1 parent ad8a0c9 commit 32b7373
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 30 deletions.
10 changes: 5 additions & 5 deletions app/models/citystate_hospitals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ interface CityDocument extends mongoose.Document {
name: string;
hospitals: HospitalDocument[];
}

interface StateDocument extends mongoose.Document {
// StateDocument
interface CityStateHospital extends mongoose.Document {
name: string;
cities: CityDocument[];
}
Expand All @@ -27,7 +27,7 @@ const citySchema = new mongoose.Schema<CityDocument>({
hospitals: [hospitalSchema],
});

const stateSchema = new mongoose.Schema<StateDocument>(
const stateSchema = new mongoose.Schema<CityStateHospital>(
{
name: { type: String, required: true },
cities: [citySchema],
Expand All @@ -37,5 +37,5 @@ const stateSchema = new mongoose.Schema<StateDocument>(
}
);

export default mongoose.models.StateDocument ||
mongoose.model<StateDocument>("StateDocument", stateSchema);
export default mongoose.models.CityStateHospital ||
mongoose.model<CityStateHospital>("CityStateHospital", stateSchema);
8 changes: 4 additions & 4 deletions app/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import BookedAppointment from "./bookedAppointment";
import CommonDiseases from "./commonDisease";
import Doctor from "./doctor";
import Hospital from "./hospital";
// import MedicalHistory from "./MedicalHistory";
import MedicalHistory from "./medicalHistory";
import CityStateHospital from "./citystate_hospitals";
import Patient from "./patient";
import Receptionist from "./receptionist";
// import Transaction from "./Transaction";
import Transaction from "./transaction";
import UserLog from "./userLog";

export {
Expand All @@ -15,9 +15,9 @@ export {
Doctor,
Hospital,
CityStateHospital,
// MedicalHistory,
MedicalHistory,
Patient,
Receptionist,
// Transaction,
Transaction,
UserLog,
};
47 changes: 26 additions & 21 deletions app/models/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,33 @@ export interface Transaction extends mongoose.Document {
status: string;
}

const transactionSchema = new mongoose.Schema({
transaction_id: { type: String, required: true, unique: true },
timestamp: { type: Date, required: true },
patient: {
type: mongoose.Schema.Types.ObjectId,
ref: "Patient",
required: true,
const transactionSchema = new mongoose.Schema(
{
transaction_id: { type: String, required: true, unique: true },
timestamp: { type: Date, required: true },
patient: {
type: mongoose.Schema.Types.ObjectId,
ref: "Patient",
required: true,
},
hospital: {
type: mongoose.Schema.Types.ObjectId,
ref: "Hospital",
required: true,
},
disease: { type: String, required: true },
description: { type: String, required: true },
amount: { type: Number, required: true },
status: {
type: String,
required: true,
enum: ["Success", "Failed", "Pending"],
},
},
hospital: {
type: mongoose.Schema.Types.ObjectId,
ref: "Hospital",
required: true,
},
disease: { type: String, required: true },
description: { type: String, required: true },
amount: { type: Number, required: true },
status: {
type: String,
required: true,
enum: ["Success", "Failed", "Pending"],
},
});
{
collection: "transactions",
}
);

export default mongoose.models.Transaction ||
mongoose.model<Transaction>("Transaction", transactionSchema);

0 comments on commit 32b7373

Please sign in to comment.