feat: nambahin API route untuk generate certificate bagi Admin/Mentor

This commit is contained in:
Rafi Athallah
2026-07-01 15:33:22 +07:00
parent 2c5d77c22e
commit 8d34e443a5
7 changed files with 540 additions and 1 deletions
+44
View File
@@ -114,6 +114,50 @@ const router = express.Router();
*/
router.post('/claim', verifyJWT, certificateController.claimCertificate);
/**
* @swagger
* /certificate-api/generate:
* post:
* summary: Batch generate certificates (Admin/Mentor only)
* description: Mentors or Admins can batch-generate certificates for selected eligible interns of a project.
* tags: [Certificate]
* security:
* - bearerAuth: []
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* required:
* - id_project
* - id_users
* properties:
* id_project:
* type: integer
* example: 2
* id_users:
* type: array
* items:
* type: integer
* example: [5, 6]
* responses:
* 201:
* description: Certificates generated successfully
* 400:
* description: Bad request (not eligible or missing parameters)
* 401:
* description: Unauthorized
* 403:
* description: Forbidden (only mentors/admins of the project can generate)
* 409:
* description: Conflict (certificate already generated for one or more interns)
* 500:
* description: Internal server error
*/
router.post('/generate', verifyJWT, isMentorOrAdmin, certificateController.generateCertificates);
/**
* @swagger
* /certificate-api/my-certificates: