mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 14:16:34 +09:00
🔖 Checkpoint: Edit /workspaces/claude-code-flow/user-service/src/routes/user.routes.ts
This commit is contained in:
1 parent
ae65e41add
commit
34d94c29e2
3 files changed
+76
No files matched your search
@@ -0,0 +1 @@
|
||||
{"branch": "checkpoint/pre-edit-20250806-140238", "file": "/workspaces/claude-code-flow/user-service/src/middleware/error.middleware.ts", "timestamp": "2025-08-06T14:02:38Z", "type": "pre-edit", "original_branch": "alpha-88"}
|
||||
@@ -0,0 +1 @@
|
||||
{"tag": "checkpoint-20250806-140239", "file": "/workspaces/claude-code-flow/user-service/src/middleware/error.middleware.ts", "timestamp": "2025-08-06T14:02:39Z", "type": "post-edit", "branch": "alpha-88", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 2532 +++++++++++++++++++++- .claude-flow/metrics/task-metrics.json | 6 +- .claude/checkpoints/1754488941.json | 1 + .claude/checkpoints/1754488943.json | 1 + benchmark/.claude-flow/metrics/performance.json | 2 +- benchmark/.claude-flow/metrics/task-metrics.json | 6 +- claude-flow-wiki | 0 user-service/src/middleware/error.middleware.ts | 67 + 9 files changed, 2555 insertions(+), 62 deletions(-) "}
|
||||
@@ -0,0 +1,74 @@
|
||||
import { Router } from 'express';
|
||||
import { userController } from '../controllers/user.controller';
|
||||
import { authenticate, authorize, authorizeOwner } from '../middleware/auth.middleware';
|
||||
import { validateBody, validateParams, validateQuery } from '../middleware/validation.middleware';
|
||||
import { schemas } from '../utils/validation';
|
||||
import { UserRole } from '../types/user.types';
|
||||
|
||||
const router = Router();
|
||||
|
||||
// Public routes
|
||||
router.post('/register',
|
||||
validateBody(schemas.createUser),
|
||||
userController.register
|
||||
);
|
||||
|
||||
router.post('/login',
|
||||
validateBody(schemas.login),
|
||||
userController.login
|
||||
);
|
||||
|
||||
// Protected routes - require authentication
|
||||
router.get('/profile',
|
||||
authenticate,
|
||||
userController.getProfile
|
||||
);
|
||||
|
||||
router.post('/change-password',
|
||||
authenticate,
|
||||
validateBody(schemas.changePassword),
|
||||
userController.changePassword
|
||||
);
|
||||
|
||||
router.post('/verify-email',
|
||||
authenticate,
|
||||
userController.verifyEmail
|
||||
);
|
||||
|
||||
// User management routes
|
||||
router.get('/users',
|
||||
authenticate,
|
||||
authorize(UserRole.ADMIN, UserRole.MODERATOR),
|
||||
validateQuery(schemas.pagination.concat(schemas.userFilter)),
|
||||
userController.listUsers
|
||||
);
|
||||
|
||||
router.get('/users/stats',
|
||||
authenticate,
|
||||
authorize(UserRole.ADMIN),
|
||||
userController.getUserStats
|
||||
);
|
||||
|
||||
router.get('/users/:id',
|
||||
authenticate,
|
||||
authorizeOwner('id'),
|
||||
validateParams(schemas.userId),
|
||||
userController.getUserById
|
||||
);
|
||||
|
||||
router.put('/users/:id',
|
||||
authenticate,
|
||||
authorizeOwner('id'),
|
||||
validateParams(schemas.userId),
|
||||
validateBody(schemas.updateUser),
|
||||
userController.updateUser
|
||||
);
|
||||
|
||||
router.delete('/users/:id',
|
||||
authenticate,
|
||||
authorize(UserRole.ADMIN),
|
||||
validateParams(schemas.userId),
|
||||
userController.deleteUser
|
||||
);
|
||||
|
||||
export default router;
|
||||
Reference in new issue
Block a user