-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocumentRoutes.js
More file actions
64 lines (60 loc) · 1.57 KB
/
documentRoutes.js
File metadata and controls
64 lines (60 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import express from "express";
import { protect } from "../middleware/auth.js";
import { uploadDocument } from "../controllers/documentController.js";
import {
applyUpload,
documentUpload,
ensureFilePresent,
ensureImageKitConfigured,
ensureValidPdfSignature,
} from "../middleware/multer.js";
const router = express.Router();
/**
* @openapi
* tags:
* - name: Document
* description: Upload dokumenata korisnika
*/
/**
* @openapi
* /api/document/upload:
* post:
* tags: [Document]
* summary: Upload dokumenta (samo PDF) - multipart
* security:
* - bearerAuth: []
* requestBody:
* required: true
* content:
* multipart/form-data:
* schema:
* type: object
* required: [file, documentType]
* properties:
* file:
* type: string
* format: binary
* description: PDF dokument, maksimalno 5MB
* documentType:
* type: string
* enum: [DRIVING_LICENSE, ID_CARD, PASSPORT, OTHER]
* responses:
* 200:
* description: Dokument uploadovan
* 400:
* description: Neispravan dokument ili neispravan request
* 413:
* description: Fajl je prevelik
* 503:
* description: Upload servis nije dostupan
*/
router.post(
"/upload",
protect,
ensureImageKitConfigured,
applyUpload(documentUpload.single("file")),
ensureFilePresent("file"),
ensureValidPdfSignature,
uploadDocument
);
export default router;