-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrouter.js
32 lines (27 loc) · 1.16 KB
/
router.js
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
const express = require('express');
const router = express.Router();
const {
getAllPhotos,
getPhotoById,
createPhoto,
updateAnnotationStatus,
updatePhotoDetails,
deletePhoto,
getUnannotatedPhoto, // New route for serving unannotated photo
getAnnotationDetails, // New route for annotation details by ID
getPhotoByFilename, // New route for getting photo by filename
} = require('./photoController'); // Define your controller functions
// Define the API routes
router.get('/api/photos', getAllPhotos);
router.get('/api/photos/:id', getPhotoById);
router.post('/api/photos', createPhoto);
router.patch('/api/photos/:id/annotate', updateAnnotationStatus);
router.patch('/api/photos/:id', updatePhotoDetails);
router.delete('/api/photos/:id', deletePhoto);
// New route for serving an unannotated photo by lowest ID
router.get('/api/photos/unannotated', getUnannotatedPhoto);
// New route for annotation details by ID
router.get('/api/photos/:id/annotation-details', getAnnotationDetails);
// New route for getting a photo by filename
router.get('/api/photos/filename/:filename', getPhotoByFilename);
module.exports = router;