Skip to content

Commit 65da071

Browse files
committed
fix: resolve swagger yaml indentation errors
1 parent 7f6b870 commit 65da071

4 files changed

Lines changed: 149 additions & 5 deletions

File tree

backend/Swagger.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const options = {
2323
},
2424
},
2525
},
26-
// --- DOCUMENTATION DEFINED HERE TO PREVENT INDENTATION ERRORS ---
26+
// Keep existing hardcoded paths for now so Registration/Login don't disappear
2727
paths: {
2828
'/api/auth/registration': {
2929
post: {
@@ -74,8 +74,8 @@ const options = {
7474
}
7575
}
7676
},
77-
// We turn off file scanning so it doesn't look for broken comments
78-
apis: [],
77+
// FIX: Enable scanner to find docs in route files
78+
apis: ['./routes/*.js'],
7979
};
8080

8181
const specs = swaggerJsdoc(options);

backend/package-lock.json

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

backend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"cors": "^2.8.5",
1818
"dotenv": "^16.5.0",
1919
"express": "^5.1.0",
20+
"joi": "^18.0.2",
2021
"jsonwebtoken": "^9.0.2",
2122
"mongoose": "^8.15.2",
2223
"multer": "^2.0.1",

backend/routes/authRoutes.js

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,82 @@ import { registerSchema, loginSchema } from "../validators/authSchemas.js";
55

66
const authRoutes = express.Router();
77

8-
// Routes are now documented in Swagger.js to avoid crash errors
8+
// Note: Registration and Login are documented in Swagger.js
99
authRoutes.post("/registration", validateRequest(registerSchema), registration);
1010
authRoutes.post("/login", validateRequest(loginSchema), login);
1111

12-
authRoutes.get("/logout", logOut);
12+
/**
13+
* @swagger
14+
* /api/auth/logout:
15+
* get:
16+
* summary: Logout the current user
17+
* tags: [Auth]
18+
* responses:
19+
* 200:
20+
* description: Successfully logged out
21+
* 500:
22+
* description: Server error
23+
*/
24+
authRoutes.get("/lout", logOut);
25+
26+
/**
27+
* @swagger
28+
* /api/auth/googlelogin:
29+
* post:
30+
* summary: Login using Google OAuth
31+
* tags: [Auth]
32+
* requestBody:
33+
* required: true
34+
* content:
35+
* application/json:
36+
* schema:
37+
* type: object
38+
* required:
39+
* - tokenId
40+
* properties:
41+
* tokenId:
42+
* type: string
43+
* description: The token received from Google
44+
* responses:
45+
* 200:
46+
* description: Google login successful
47+
* 400:
48+
* description: Invalid token
49+
* 500:
50+
* description: Server error
51+
*/
1352
authRoutes.post("/googlelogin", googleLogin);
53+
54+
/**
55+
* @swagger
56+
* /api/auth/adminlogin:
57+
* post:
58+
* summary: Login for Admin users
59+
* tags: [Auth]
60+
* requestBody:
61+
* required: true
62+
* content:
63+
* application/json:
64+
* schema:
65+
* type: object
66+
* required:
67+
* - email
68+
* - password
69+
* properties:
70+
* email:
71+
* type: string
72+
* description: Admin email address
73+
* password:
74+
* type: string
75+
* description: Admin password
76+
* responses:
77+
* 200:
78+
* description: Admin login successful
79+
* 401:
80+
* description: Unauthorized credentials
81+
* 500:
82+
* description: Server error
83+
*/
1484
authRoutes.post("/adminlogin", adminLogin);
1585

1686
export default authRoutes;

0 commit comments

Comments
 (0)