Skip to content

Commit d678222

Browse files
committed
fix: Silent bugs
1 parent 7558aaa commit d678222

12 files changed

Lines changed: 61 additions & 56 deletions

File tree

.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 42 deletions
This file was deleted.

eslint.config.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
4+
export default [
5+
js.configs.recommended,
6+
7+
{
8+
languageOptions: {
9+
globals: {
10+
...globals.node,
11+
},
12+
},
13+
},
14+
15+
{
16+
files: ["tests/**/*.js"],
17+
languageOptions: {
18+
globals: {
19+
...globals.jest,
20+
},
21+
},
22+
},
23+
24+
{
25+
ignores: ["node_modules", "dist"],
26+
},
27+
28+
{
29+
rules: {
30+
"no-unused-vars": "warn",
31+
"no-console": "off",
32+
},
33+
},
34+
];

package-lock.json

Lines changed: 17 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"eslint-plugin-import": "^2.32.0",
4646
"eslint-plugin-node": "^11.1.0",
4747
"eslint-plugin-prettier": "^5.5.4",
48+
"globals": "^17.3.0",
4849
"nodemon": "^3.1.11",
4950
"prettier": "^3.7.4",
5051
"supertest": "^7.2.2"

src/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ app.use('/api/patients', patientRoutes);
6969
app.use('/api/departments', deptRoutes);
7070
app.use('/api/appointments', appointmentRoutes);
7171

72-
app.use((req, res, _next) => {
72+
app.use((req, res) => {
7373
res.status(404).json({
7474
success: false,
7575
message: "Route not found"

src/controllers/admincontroller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import User from '../models/User.js';
22
import bcrypt from 'bcrypt';
33
import jwt from 'jsonwebtoken';
4+
import doctorService from '../services/doctor.service.js';
45

56
export const login = async (req, res, next) => {
67
try {

src/controllers/patient.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Patient from '../models/patient.js';
22

3-
const createPatient = async (req, res) => {
3+
const createPatient = async (req, res, next) => {
44
try {
55
const patient = new Patient(req.body);
66
await patient.save();
@@ -10,7 +10,7 @@ const createPatient = async (req, res) => {
1010
}
1111
};
1212

13-
const getPatients = async (req, res) => {
13+
const getPatients = async (req, res, next) => {
1414
try {
1515
const patients = await Patient.find();
1616
res.json(patients);
@@ -19,7 +19,7 @@ const getPatients = async (req, res) => {
1919
}
2020
};
2121

22-
const updatePatient = async (req, res) => {
22+
const updatePatient = async (req, res, next) => {
2323
try {
2424
const { id } = req.params;
2525

@@ -40,7 +40,7 @@ const updatePatient = async (req, res) => {
4040
}
4141
};
4242

43-
const deletePatient = async (req, res) => {
43+
const deletePatient = async (req, res, next) => {
4444
try {
4545
const { id } = req.params;
4646

src/middleware/errorHandler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const errorHandler = (err, req, res, next) => {
1+
export const errorHandler = (err, req, res) => {
22
console.error(err);
33

44
const statusCode = err.statusCode || 500;

src/models/User.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const userSchema = new mongoose.Schema({
6969
type: String,
7070
required: true,
7171
unique: true,
72-
match: /.+\@.+\..+/
72+
match: /.+@.+\..+/
7373
},
7474

7575
password: {

0 commit comments

Comments
 (0)