refactor: rewrite ke codebase lama

This commit is contained in:
Muhammad Zhafran Ilham
2026-06-07 20:17:49 +07:00
parent ce5487dcbf
commit fe74b2213d
146 changed files with 14608 additions and 6686 deletions
+95
View File
@@ -0,0 +1,95 @@
const express = require('express');
const { authController } = require('../modules/auth');
const { verifyJWT } = require('../middleware/verifyJWT');
const router = express.Router();
/**
* @swagger
* /auth-api/login:
* post:
* summary: Admin login
* tags: [Auth]
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* properties:
* email:
* type: string
* example: "admin@example.com"
* password:
* type: string
* example: "password123"
* responses:
* 200:
* description: Login successful
* content:
* application/json:
* schema:
* type: object
* properties:
* message:
* type: string
* example: "Login successful"
* token:
* type: string
* example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
* 400:
* description: Invalid email or password
* 500:
* description: Internal server error
*/
router.post("/login", authController.login);
/**
* @swagger
* /auth-api/me:
* get:
* summary: Get authenticated admin details
* tags: [Auth]
* security:
* - bearerAuth: []
* responses:
* 200:
* description: Get admin details successfully
* content:
* application/json:
* schema:
* type: object
* properties:
* message:
* type: string
* example: "Get admin successfully"
* data:
* type: object
* properties:
* id:
* type: integer
* example: 1
* nama_depan:
* type: string
* example: "John"
* nama_belakang:
* type: string
* example: "Doe"
* email:
* type: string
* example: "admin@example.com"
* role:
* type: string
* example: "admin"
* 401:
* description: Authorization header missing or invalid
* 403:
* description: Invalid or expired token
* 404:
* description: Admin not found
* 500:
* description: Internal server error
*/
router.get("/me", verifyJWT, authController.me);
module.exports = router;