Skip to content

Commit 22e59aa

Browse files
Merge pull request #56 from call-0f-code/update-apidoc
Update getInterviews apidoc
2 parents 72f89e0 + f7ffcd0 commit 22e59aa

File tree

1 file changed

+69
-25
lines changed

1 file changed

+69
-25
lines changed

src/routes/interviews.ts

Lines changed: 69 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,75 @@ import * as interviewCtrl from '../controllers/interview.controller';
55
export default function interviewRouter() {
66
const router = express.Router();
77

8-
/**
9-
* @api {get} /interviews Get all interview experiences
10-
* @apiName getInterviews
11-
* @apiGroup Interview
12-
*
13-
* @apiSuccess {Object[]} interviews List of all interview experiences
14-
* @apiSuccessExample {json} Success-Response:
15-
* HTTP/1.1 200 OK
16-
* {
17-
* "success": true,
18-
* "data": [
19-
* {
20-
* "id": 1,
21-
* "company": "Google",
22-
* "role": "SDE Intern",
23-
* "verdict": "Selected",
24-
* "content": "It was amazing...",
25-
* "isAnonymous": false,
26-
* "memberId": "uuid-string"
27-
* }
28-
* ]
29-
* }
30-
*
31-
* @apiError (500) InternalServerError Failed to fetch interviews from the database
32-
*/
8+
/**
9+
* @api {get} /interviews Get all interview experiences (Paginated + Optional Filtering)
10+
* @apiName getInterviews
11+
* @apiGroup Interview
12+
*
13+
* @apiDescription
14+
* Fetches a paginated list of all interview experiences.
15+
* Filtering by verdict is optional.
16+
*
17+
* - When `verdict=All` (default) → No filtering, return *all* interview experiences.
18+
* - When `verdict=Selected/Rejected/Pending` → Filter by that verdict.
19+
*
20+
*
21+
* @apiParam {Number{1..}} [page=1] Page number (must be >= 1)
22+
* @apiParam {Number{1..100}} [limit=10] Number of records per page (1–100)
23+
* @apiParam {String="All","Selected","Rejected","Pending"} [verdict="All"]
24+
* If set to "All", no filtering is applied.
25+
*
26+
*
27+
* @apiSuccess {Boolean} success Indicates success
28+
* @apiSuccess {Object[]} data List of interview experiences (formatted)
29+
* @apiSuccess {Number} page Current page number
30+
* @apiSuccess {Number} limit Number of items per page
31+
* @apiSuccess {String} verdict The applied verdict filter ("All" means no filtering)
32+
* @apiSuccess {Number} total Total number of interviews matching the filter
33+
* @apiSuccess {Number} totalPages Total number of pages
34+
*
35+
*
36+
* @apiSuccessExample {json} Success-Response:
37+
* HTTP/1.1 200 OK
38+
* {
39+
* "success": true,
40+
* "data": [
41+
* {
42+
* "id": 45,
43+
* "company": "Google",
44+
* "role": "SDE Intern",
45+
* "verdict": "Selected",
46+
* "content": "Great experience...",
47+
* "isAnonymous": false,
48+
* "member": {
49+
* "id": "uuid-123",
50+
* "name": "John Doe",
51+
* "profilePhoto": "https://cdn.com/photo.jpg"
52+
* }
53+
* },
54+
* {
55+
* "id": 42,
56+
* "company": "Amazon",
57+
* "role": "Backend Engineer",
58+
* "verdict": "Rejected",
59+
* "content": "Challenging rounds...",
60+
* "isAnonymous": true
61+
* // member not returned because isAnonymous = true
62+
* }
63+
* ],
64+
* "page": 1,
65+
* "limit": 10,
66+
* "verdict": "All",
67+
* "total": 240,
68+
* "totalPages": 24
69+
* }
70+
*
71+
*
72+
* @apiError (400) BadRequest Invalid page, limit, or verdict
73+
* @apiError (500) InternalServerError Failed to fetch interviews from the database
74+
*/
75+
76+
3377
router.get('/', interviewCtrl.getInterviews);
3478

3579

0 commit comments

Comments
 (0)