cityssm/parking-ticket-system

View on GitHub
handlers/plates-ontario-post/doMTOImportUpload.js

Summary

Maintainability
A
0 mins
Test Coverage
F
58%
import multer from 'multer';
import { importLicencePlateOwnership } from '../../helpers/functions.mto.js';
const storage = multer.memoryStorage();
const upload = multer({ storage });
export const uploadHandler = upload.single('importFile');
export async function handler(request, response) {
    const batchId = request.body.batchId;
    const ownershipData = request.file?.buffer.toString() ?? '';
    const results = await importLicencePlateOwnership(Number.parseInt(batchId, 10), ownershipData, request.session.user);
    response.json(results);
}
export default handler;