Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
b630fba
Merge pull request #1 from nosavic/development
nosavic Apr 8, 2025
9033a78
fix
nosavic Apr 8, 2025
06361ef
fix
nosavic Apr 8, 2025
c5cdcbd
fix bcrypt to bcryptjs
nosavic Apr 9, 2025
f6b289b
fix
nosavic Apr 21, 2025
6a91861
allow 5173
nosavic Apr 23, 2025
0695fb1
fix
nosavic Apr 24, 2025
127eb6a
allow all urls
nosavic Apr 24, 2025
038e7cb
remove required from patients fields
nosavic Apr 27, 2025
9fc8d05
fix
nosavic Apr 27, 2025
37b36a0
Create deploy.yml
bahseet Apr 28, 2025
a896197
Completed Design for Pharmacy Profile
Zuwaynib Apr 28, 2025
2c83c89
Merge pull request #42 from Zuwaynib/development
Timmydrax Apr 28, 2025
4ddf5f2
nothing
Owen5e Apr 28, 2025
31981fd
Remove node_modules and .env from repo
nosavic Apr 29, 2025
5e3ebae
Merge branch 'development' into main
nosavic Apr 29, 2025
74eddc5
Merge pull request #43 from nosavic/main
nosavic Apr 29, 2025
b331c8f
Merge branch 'Curamap:main' into main
nosavic Apr 29, 2025
7246a5d
SignIn: Updated styles
Zuwaynib May 1, 2025
b4b6a7c
MedicineTable: worked on the MedicineTable component and styling
Zuwaynib May 1, 2025
25fd19a
I added the HealthRightPharmacy page and I also use the module css on…
Emmanuelsheyi May 2, 2025
5c64d72
i made some changes to the color
Emmanuelsheyi May 2, 2025
f1bed27
Merge pull request #44 from Zuwaynib/development
Timmydrax May 2, 2025
a80632e
Merge branch 'development' into feature-transactions
Timmydrax May 2, 2025
560553f
Merge pull request #45 from Emmanuelsheyi/feature-transactions
Timmydrax May 2, 2025
3263fdf
merged signUp and profileComplete page
Owen5e May 2, 2025
587a020
updated css
Owen5e May 2, 2025
029ecb3
Merge branch 'development' into main
Timmydrax May 2, 2025
786b602
Merge pull request #46 from Owen5e/main
Timmydrax May 2, 2025
cb2dc46
CHORE: Worked on App.jsx
Timmydrax May 2, 2025
f1bc37a
Merge pull request #47 from Timmydrax/chore/little-changes
Timmydrax May 2, 2025
b4750ec
CHORE: Worked on Upload Prescription
Timmydrax May 3, 2025
e88db8a
CHORE: Worked on Upload Prescription
Timmydrax May 3, 2025
5c618d2
Merge pull request #48 from Timmydrax/feat/upload-prescription
Timmydrax May 3, 2025
e2e381c
TEST: Tested a component
Timmydrax May 3, 2025
8d78794
Merge pull request #49 from Timmydrax/development
Timmydrax May 3, 2025
7763b29
CHORE: Added signin integration
Timmydrax May 3, 2025
4aa96b5
Merge pull request #51 from Timmydrax/feat/signin
Timmydrax May 3, 2025
e104185
Merge branch 'staging' into development
bahseet May 4, 2025
e844c1e
Update deploy.yml
bahseet May 4, 2025
3bf8ef7
pharmacylogin and landing page update
wisdomoladipupo May 4, 2025
0fafe2d
fixed signup validation and added payment modal
Owen5e May 5, 2025
27bf25b
Merge pull request #57 from Owen5e/main
Timmydrax May 5, 2025
7b28ead
Merge branch 'main' of https://github.com/Curamap/Codes into development
Timmydrax May 5, 2025
a5dc05d
pharmacylogin and landing page update
wisdomoladipupo May 6, 2025
ee53b57
Merge pull request #58 from Curamap/landingpage-update
Timmydrax May 6, 2025
bbc648a
Merge branch 'development' of https://github.com/Curamap/Codes into d…
Timmydrax May 6, 2025
d174433
Implement medicine management functionality with CRUD operations and …
nosavic May 6, 2025
aeac796
Configure CORS middleware with specific options
nosavic May 6, 2025
f93a5f0
Update RevenueChart.jsx
bahseet May 6, 2025
31d780e
Update UploadPrescription.jsx
bahseet May 6, 2025
23a4a8c
Update docker-compose.yml
bahseet May 6, 2025
e69e529
Merge branch 'development' of https://github.com/Curamap/Codes into d…
Timmydrax May 6, 2025
afd08ab
Merge pull request #59 from nosavic/main
nosavic May 6, 2025
0fd203b
Refactor Pharmacy model: make owner, phone, address, city, state, and…
nosavic May 6, 2025
2e2044e
Merge pull request #60 from nosavic/main
nosavic May 6, 2025
6cdb17e
pharmacy signup and signin feature
Owen5e May 6, 2025
6ee6189
nothing
Owen5e May 6, 2025
e0cae2d
Merge pull request #61 from Owen5e/main
Timmydrax May 6, 2025
99a9fb1
Merge branch 'development' of https://github.com/Curamap/Codes into d…
Timmydrax May 6, 2025
64688a0
CHORE: Added some functionalities
Timmydrax May 6, 2025
382b138
Merge pull request #63 from Timmydrax/feat/page-features
Timmydrax May 6, 2025
7a475ec
Merge branch 'staging' into development
bahseet May 6, 2025
66b4c52
Delete .github/workflows directory
bahseet May 6, 2025
74aba19
Delete docker-compose.yml
bahseet May 6, 2025
67010b0
CHORE
Timmydrax May 7, 2025
cadca18
CHORE: Added navigation
Timmydrax May 7, 2025
bbc3a25
Merge pull request #64 from Timmydrax/development
Timmydrax May 7, 2025
c2bfc11
responsiveness
Owen5e May 7, 2025
94c348c
Merge pull request #67 from Owen5e/main
Timmydrax May 7, 2025
3da6710
responsiveness
Owen5e May 7, 2025
1b6b971
Merge pull request #68 from Owen5e/main
Timmydrax May 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed .github/workflows/curamap.html
Empty file.
82 changes: 0 additions & 82 deletions .github/workflows/deploy.yml

This file was deleted.

59 changes: 59 additions & 0 deletions Backend/controllers/Medicine.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// medicines.controller.js
const Medicine = require("../models/Medicine");

// Create a new medicine
exports.createMedicine = async (req, res, next) => {
try {
const medicine = new Medicine(req.body);
await medicine.save();
res.status(201).json(medicine);
} catch (err) {
next(err);
}
};

// Get all medicines
exports.getMedicines = async (req, res, next) => {
try {
const meds = await Medicine.find();
res.json(meds);
} catch (err) {
next(err);
}
};

// Get one by ID
exports.getMedicineById = async (req, res, next) => {
try {
const med = await Medicine.findById(req.params.id);
if (!med) return res.status(404).json({ message: "Medicine not found" });
res.json(med);
} catch (err) {
next(err);
}
};

// Update by ID
exports.updateMedicine = async (req, res, next) => {
try {
const med = await Medicine.findByIdAndUpdate(req.params.id, req.body, {
new: true,
runValidators: true,
});
if (!med) return res.status(404).json({ message: "Medicine not found" });
res.json(med);
} catch (err) {
next(err);
}
};

// Delete by ID
exports.deleteMedicine = async (req, res, next) => {
try {
const med = await Medicine.findByIdAndDelete(req.params.id);
if (!med) return res.status(404).json({ message: "Medicine not found" });
res.status(204).end();
} catch (err) {
next(err);
}
};
19 changes: 10 additions & 9 deletions Backend/controllers/pharmacyController.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ exports.toggleClosingStatus = async (req, res) => {
// @desc post pharmacy Forgot password
// @route POST /api/pharmacies/forgot-password
exports.forgotPassword = async (req, res) => {
const pharmacy = await pharmacy.findOne({ email: req.body.email.trim().toLowerCase() });
const pharmacy = await pharmacy.findOne({
email: req.body.email.trim().toLowerCase(),
});
if (!pharmacy) {
return res.status(404).json({ message: "Pharmacy not found" });
}
Expand Down Expand Up @@ -204,8 +206,7 @@ exports.forgotPassword = async (req, res) => {
message: "Error sending email. Please try again later.",
});
}
}

};

// @desc patch pharmacy reset password
// @route PATCH /api/pharmacies/reset-password/:token
Expand All @@ -221,17 +222,17 @@ exports.resetPassword = async (req, res) => {
passwordResetToken: hashedToken,
passwordResetExpires: { $gt: Date.now() },
});

if (!pharmacy) {
return res.status(400).json({ message: "Invalid or expired token" });
}

pharmacy.password = req.body.password;
pharmacy.passwordResetToken = undefined;
pharmacy.passwordResetExpires = undefined;

await pharmacy.save();

res.status(200).json({ message: "Password reset successful" });
//login pharmacy
const loginToken = generateToken(pharmacy);
Expand All @@ -240,6 +241,6 @@ exports.resetPassword = async (req, res) => {
token: loginToken,
});
} catch (err) {
res.status(500).json({message: "Server error", error: err.message });
res.status(500).json({ message: "Server error", error: err.message });
}
}
};
66 changes: 66 additions & 0 deletions Backend/data/medicines.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
module.exports = [
{
name: "Paracetamol",
description: "Pain reliever and fever reducer",
dosages: ["500mg", "650mg"],
packageSizes: ["10 tablets", "20 tablets"],
prescription: false,
prices: {
Nigeria: {
"500mg": 100,
"650mg": 120,
},
Ghana: {
"500mg": 80,
"650mg": 100,
},
},
},
{
name: "Amoxicillin",
description: "Used to treat bacterial infections",
dosages: ["250mg", "500mg"],
packageSizes: ["capsules", "syrup"],
prescription: true,
prices: {
Nigeria: {
"250mg": 150,
"500mg": 200,
},
Kenya: {
"250mg": 130,
"500mg": 180,
},
},
},
{
name: "Ibuprofen",
description: "Reduces fever and treats pain or inflammation",
dosages: ["200mg", "400mg"],
packageSizes: ["24 tablets", "12 tablets"],
prescription: false,
prices: {
Nigeria: {
"200mg": 90,
"400mg": 160,
},
Ghana: {
"200mg": 75,
"400mg": 140,
},
},
},
{
name: "Vitamin C",
description: "Boosts immune system",
dosages: ["100mg", "500mg"],
packageSizes: ["30 tablets", "60 tablets"],
prescription: false,
prices: {
Nigeria: {
"100mg": 70,
"500mg": 120,
},
},
},
];
3 changes: 3 additions & 0 deletions Backend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const app = express();
// Route Imports
const pharmacyRoutes = require("./routes/pharmacyRoutes");
const patientRoutes = require("./routes/patientRoutes");
const medicineRoutes = require("./routes/medicine");

// Middleware
app.use(express.json());
Expand All @@ -27,6 +28,8 @@ app.use(cors());
// Routes
app.use("/api/pharmacies", pharmacyRoutes);
app.use("/api/patients", patientRoutes);
app.use("/api/medicines", medicineRoutes);

// Database Connection
mongoose
.connect(process.env.DB_URI, { serverSelectionTimeoutMS: 60000 })
Expand Down
27 changes: 27 additions & 0 deletions Backend/models/Medicine.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// medicines.model.js
const mongoose = require("mongoose");
const { Schema } = mongoose;

const medicineSchema = new Schema(
{
name: { type: String, required: true },
description: { type: String },
dosages: [{ type: String }],
packageSizes: [{ type: String }],
prescription: { type: Boolean, default: false },
prices: {
type: Map,
of: new Schema(
{
type: Map,
of: Number,
},
{ _id: false }
),
required: true,
},
},
{ timestamps: true }
);

module.exports = mongoose.model("Medicine", medicineSchema);
20 changes: 11 additions & 9 deletions Backend/models/PharmacyModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ const pharmacySchema = new mongoose.Schema(
default: () => new mongoose.Types.ObjectId().toString(),
},
name: { type: String, required: true }, // Pharmacy Name
owner: { type: String, required: true }, // Owner's Name
owner: { type: String }, // Owner's Name
email: { type: String, required: true, unique: true },
phone: { type: String, required: true },
address: { type: String, required: true },
city: { type: String, required: true },
state: { type: String, required: true },
country: { type: String, required: true },
phone: { type: String },
address: { type: String },
city: { type: String },
state: { type: String },
country: { type: String },
website: { type: String }, // Optional website
licenseNumber: { type: String, required: true, unique: true }, // Regulatory License Number
licenseNumber: { type: String, unique: true }, // Regulatory License Number
password: { type: String, required: true },
passwordChangeAt: { type: Date },
passwordResetToken: { type: String },
Expand All @@ -28,7 +28,6 @@ const pharmacySchema = new mongoose.Schema(
},
openingHours: {
type: String,
required: true, // e.g., "8:00 AM - 10:00 PM"
},
closingStatus: {
type: Boolean,
Expand Down Expand Up @@ -59,7 +58,10 @@ pharmacySchema.methods.comparePassword = async function (password) {
pharmacySchema.methods.generatePasswordResetToken = function () {
const resetToken = crypto.randomBytes(32).toString("hex");
// Hashing the token for protection
this.passwordResetToken = crypto.createHash("sha256").update(resetToken).digest("hex");
this.passwordResetToken = crypto
.createHash("sha256")
.update(resetToken)
.digest("hex");

// Set the expiration time for the token
this.passwordResetExpires = Date.now() + 10 * 60 * 1000; // 10 minutes expiration
Expand Down
14 changes: 14 additions & 0 deletions Backend/routes/medicine.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// routes/medicineRoutes.js

const express = require("express");
const router = express.Router();
const ctrl = require("../controllers/Medicine");

router.post("/", ctrl.createMedicine);
router.get("/", ctrl.getMedicines);
router.get("/:id", ctrl.getMedicineById);
router.put("/:id", ctrl.updateMedicine);
router.delete("/:id", ctrl.deleteMedicine);

// ✅ Export just the router
module.exports = router;
25 changes: 25 additions & 0 deletions Backend/seeds/seedMedicines.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const mongoose = require("mongoose");
const Medicine = require("../models/Medicine");
const medicines = require("../data/medicines");
require("dotenv").config();

const MONGO_URI = process.env.DB_URI;

const seed = async () => {
try {
await mongoose.connect(MONGO_URI, {
useNewUrlParser: true,
useUnifiedTopology: true,
});

await Medicine.deleteMany();
await Medicine.insertMany(medicines);
console.log("✅ Medicines seeded successfully.");
process.exit(0);
} catch (err) {
console.error("❌ Error seeding medicines:", err);
process.exit(1);
}
};

seed();
3 changes: 3 additions & 0 deletions Frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# Ignore the .env file
.env
Loading
Loading