Skip to content

Commit 13fc4e0

Browse files
mahmoodhamdiclaude
andcommitted
docs(swagger): add comprehensive API documentation to all routes
- Add @Swagger JSDoc annotations to all 17 route files - Document public and admin endpoints with proper tags - Include request/response schemas and security requirements - Cover: auth, services, projects, team, careers, blog - Cover: contact, settings, dashboard, activity, notifications - Cover: users, upload, content, menus, translations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9e5c831 commit 13fc4e0

17 files changed

+6208
-248
lines changed

backend/src/routes/activity.routes.ts

Lines changed: 153 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,174 @@ import { authenticate, authorize } from '../middlewares';
99

1010
const router = Router();
1111

12+
/**
13+
* @swagger
14+
* tags:
15+
* - name: Activity
16+
* description: Activity log management
17+
*/
18+
1219
// All routes require authentication
1320
router.use(authenticate);
1421

15-
// User routes
22+
/**
23+
* @swagger
24+
* /activity/me:
25+
* get:
26+
* summary: Get my activity
27+
* description: Returns activity logs for the current user
28+
* tags: [Activity]
29+
* security:
30+
* - bearerAuth: []
31+
* responses:
32+
* 200:
33+
* description: User's activity logs
34+
* 401:
35+
* description: Unauthorized
36+
*/
1637
router.get('/me', activityController.getMyActivity);
1738

18-
// Admin routes
39+
/**
40+
* @swagger
41+
* /activity:
42+
* get:
43+
* summary: Get all activity logs
44+
* tags: [Activity]
45+
* security:
46+
* - bearerAuth: []
47+
* parameters:
48+
* - in: query
49+
* name: page
50+
* schema:
51+
* type: integer
52+
* - in: query
53+
* name: limit
54+
* schema:
55+
* type: integer
56+
* - in: query
57+
* name: action
58+
* schema:
59+
* type: string
60+
* enum: [create, update, delete, login, logout]
61+
* - in: query
62+
* name: resource
63+
* schema:
64+
* type: string
65+
* - in: query
66+
* name: startDate
67+
* schema:
68+
* type: string
69+
* format: date
70+
* - in: query
71+
* name: endDate
72+
* schema:
73+
* type: string
74+
* format: date
75+
* responses:
76+
* 200:
77+
* description: Activity logs
78+
* 401:
79+
* description: Unauthorized
80+
*/
1981
router.get('/', authorize('admin', 'super_admin'), activityController.getLogs);
82+
83+
/**
84+
* @swagger
85+
* /activity/recent:
86+
* get:
87+
* summary: Get recent activity
88+
* tags: [Activity]
89+
* security:
90+
* - bearerAuth: []
91+
* responses:
92+
* 200:
93+
* description: Recent activity logs
94+
* 401:
95+
* description: Unauthorized
96+
*/
2097
router.get('/recent', authorize('admin', 'super_admin'), activityController.getRecent);
98+
99+
/**
100+
* @swagger
101+
* /activity/stats:
102+
* get:
103+
* summary: Get activity statistics
104+
* tags: [Activity]
105+
* security:
106+
* - bearerAuth: []
107+
* responses:
108+
* 200:
109+
* description: Activity statistics
110+
* 401:
111+
* description: Unauthorized
112+
*/
21113
router.get('/stats', authorize('admin', 'super_admin'), activityController.getStatistics);
114+
115+
/**
116+
* @swagger
117+
* /activity/user/{userId}:
118+
* get:
119+
* summary: Get activity by user
120+
* tags: [Activity]
121+
* security:
122+
* - bearerAuth: []
123+
* parameters:
124+
* - in: path
125+
* name: userId
126+
* required: true
127+
* schema:
128+
* type: string
129+
* responses:
130+
* 200:
131+
* description: User's activity logs
132+
* 401:
133+
* description: Unauthorized
134+
*/
22135
router.get('/user/:userId', authorize('admin', 'super_admin'), activityController.getLogsByUser);
136+
137+
/**
138+
* @swagger
139+
* /activity/resource/{resource}:
140+
* get:
141+
* summary: Get activity by resource
142+
* tags: [Activity]
143+
* security:
144+
* - bearerAuth: []
145+
* parameters:
146+
* - in: path
147+
* name: resource
148+
* required: true
149+
* schema:
150+
* type: string
151+
* responses:
152+
* 200:
153+
* description: Resource activity logs
154+
* 401:
155+
* description: Unauthorized
156+
*/
23157
router.get(
24158
'/resource/:resource',
25159
authorize('admin', 'super_admin'),
26160
activityController.getLogsByResource
27161
);
28162

29-
// Super admin only
163+
/**
164+
* @swagger
165+
* /activity/old:
166+
* delete:
167+
* summary: Delete old activity logs
168+
* description: Super Admin only - deletes old activity logs
169+
* tags: [Activity]
170+
* security:
171+
* - bearerAuth: []
172+
* responses:
173+
* 200:
174+
* description: Old logs deleted
175+
* 401:
176+
* description: Unauthorized
177+
* 403:
178+
* description: Forbidden - Super Admin only
179+
*/
30180
router.delete('/old', authorize('super_admin'), activityController.deleteOldLogs);
31181

32182
export default router;

0 commit comments

Comments
 (0)