Skip to content

Commit

Permalink
build(server): fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
Falinor committed Jan 6, 2025
1 parent e2f5ce5 commit eb8795d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
9 changes: 1 addition & 8 deletions server/src/middlewares/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,12 @@ import config from '~/infra/config';
import BadRequestError from '~/errors/badRequestError';

export function upload(): RequestHandler {

const ALLOWED_MIMES = [
'image/png',
'image/jpeg',
'application/pdf',
];
const ALLOWED_MIMES = ['image/png', 'image/jpeg', 'application/pdf'];
const upload = multer({
limits: {
files: 1,
fileSize: 1024 * 1024 * 5 // 5 MB
},
// @ts-expect-error: Due to express-server-static-core weird type augmentation
fileFilter(
request: Request,
file: Express.Multer.File,
Expand Down Expand Up @@ -50,6 +44,5 @@ export function upload(): RequestHandler {
})
});

// @ts-expect-error: Due to express-server-static-core weird type augmentation
return upload.single('file');
}
1 change: 0 additions & 1 deletion server/src/routers/protected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ router.get(

// TODO: should be /geo-perimeters
router.get('/geo/perimeters', geoController.listGeoPerimeters);
// @ts-expect-error: should be fixed later
router.post('/geo/perimeters', fileUpload(), geoController.createGeoPerimeter);
router.put(
'/geo/perimeters/:geoPerimeterId',
Expand Down

0 comments on commit eb8795d

Please sign in to comment.