@@ -10,19 +10,108 @@ import { SupabaseClient } from '@supabase/supabase-js';
1010export default function interviewRouter ( upload : Multer , supabase : SupabaseClient ) {
1111 const router = express . Router ( ) ;
1212
13-
13+ /**
14+ * @api {get } /interviews Get all interview experiences
15+ * @apiName getInterviews
16+ * @apiGroup Interview
17+ *
18+ * @apiSuccess {Object[]} interviews List of all interview experiences
19+ * @apiSuccessExample {json} Success-Response:
20+ * HTTP/1.1 200 OK
21+ * {
22+ * "success": true,
23+ * "data": [
24+ * {
25+ * "id": 1,
26+ * "company": "Google",
27+ * "role": "SDE Intern",
28+ * "verdict": "Selected",
29+ * "content": "It was amazing...",
30+ * "isAnonymous": false,
31+ * "memberId": "uuid-string"
32+ * }
33+ * ]
34+ * }
35+ *
36+ * @apiError (500) InternalServerError Failed to fetch interviews from the database
37+ */
1438 router . get ( '/' , interviewCtrl . getInterviews ) ;
39+
40+
41+
42+ /**
43+ * @api {get } /interviews/:id Get interview experience by ID
44+ * @apiName getInterviewById
45+ * @apiGroup Interview
46+ *
47+ * @apiParam (Path Params) {Number} id Interview ID
48+ *
49+ * @apiSuccess {Object} interview The interview experience object
50+ *
51+ * @apiError (400) BadRequest Invalid interview ID
52+ * @apiError (404) NotFound Interview not found
53+ * @apiError (500) InternalServerError Internal server error
54+ */
1555 router . get ( '/:id' , interviewCtrl . getInterviewById ) ;
16- router . post ( '/:memberId' , interviewCtrl . createInterview ) ;
17- router . patch ( '/:id' , interviewCtrl . updateInterviewById ) ;
18- router . delete ( '/:id' , interviewCtrl . deleteInterviewById ) ;
1956
2057
21- // router.get('/:acheivementId',interviewCtrl.getAchievementById);
22- // router.patch('/:acheivementId',interviewCtrl.updateAchievementById);
23- // router.delete('/:acheivementId',interviewCtrl.deleteAchievementById);
58+
59+ /**
60+ * @api {post } /interviews/:memberId Create a new interview experience
61+ * @apiName createInterview
62+ * @apiGroup Interview
63+ *
64+ * @apiParam (Path Params) {UUID} memberId ID of the member sharing the interview
65+ * @apiParam (Request Body) {String} company Name of the company
66+ * @apiParam (Request Body) {String} role Role applied for
67+ * @apiParam (Request Body) {String="Selected","Rejected","Pending"} verdict Result of the interview
68+ * @apiParam (Request Body) {String} content Experience content
69+ * @apiParam (Request Body) {Boolean} isAnonymous Whether the post is anonymous
70+ *
71+ * @apiSuccess {Object} interview Created interview experience
72+ *
73+ * @apiError (400) BadRequest Missing or invalid fields
74+ * @apiError (500) InternalServerError Internal server error
75+ */
76+ router . post ( '/:memberId' , interviewCtrl . createInterview ) ;
77+
78+ /**
79+ * @api {patch } /interviews/:id Update an interview experience
80+ * @apiName updateInterview
81+ * @apiGroup Interview
82+ *
83+ * @apiParam (Path Params) {Number} id Interview ID to update
84+ * @apiParam (Request Body) {UUID} memberId Member ID of the owner
85+ * @apiParam (Request Body) {String} [company] Company name
86+ * @apiParam (Request Body) {String} [role] Role
87+ * @apiParam (Request Body) {String="Selected","Rejected","Pending"} [verdict] Interview result
88+ * @apiParam (Request Body) {String} [content] Experience content
89+ * @apiParam (Request Body) {Boolean} [isAnonymous] Anonymous flag
90+ *
91+ * @apiSuccess {Object} interview Updated interview experience
92+ *
93+ * @apiError (400) BadRequest Invalid input or missing memberId
94+ * @apiError (403) Forbidden Not authorized to update this interview
95+ * @apiError (404) NotFound Interview not found
96+ * @apiError (500) InternalServerError Internal server error
97+ */
98+ router . patch ( '/:id' , interviewCtrl . updateInterviewById ) ;
2499
25100
101+ /**
102+ * @api {delete } /interviews/:id Delete an interview experience
103+ * @apiName deleteInterview
104+ * @apiGroup Interview
105+ *
106+ * @apiParam (Path Params) {Number} id Interview ID to delete
107+ *
108+ * @apiSuccess {String} message Deletion confirmation
109+ *
110+ * @apiError (400) BadRequest Invalid interview ID
111+ * @apiError (404) NotFound Interview not found
112+ * @apiError (500) InternalServerError Internal server error
113+ */
114+ router . delete ( '/:id' , interviewCtrl . deleteInterviewById ) ;
26115
27116 return router
28117}
0 commit comments