first commit

This commit is contained in:
2025-07-08 00:52:10 +08:00
commit aa2416c5d6
69 changed files with 16628 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
import { Router } from 'express';
import { accountController } from '../controllers/accountController';
import { authMiddleware } from '../middleware/authMiddleware';
import { adminMiddleware } from '../middleware/adminMiddleware';
const router = Router();
// All routes require authentication
router.use(authMiddleware);
// Get all accounts (admin only)
router.get('/', adminMiddleware, accountController.getAllAccounts);
// Get account by ID (admin only)
router.get('/:id', adminMiddleware, accountController.getAccountById);
// Create new account (admin only)
router.post('/', adminMiddleware, accountController.createAccount);
// Update account (admin only)
router.put('/:id', adminMiddleware, accountController.updateAccount);
// Delete account (admin only)
router.delete('/:id', adminMiddleware, accountController.deleteAccount);
// Get user's assigned accounts
router.get('/user/assigned', accountController.getUserAccounts);
// Assign account to user (admin only)
router.post('/:id/assign', adminMiddleware, accountController.assignAccount);
// Unassign account from user (admin only)
router.delete('/:id/assign/:userId', adminMiddleware, accountController.unassignAccount);
// Login to website
router.post('/:accountId/login', accountController.loginToWebsite);
export default router;