cityssm/parking-ticket-system

View on GitHub
handlers/admin-post/doAddOffence.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import addParkingOffence from '../../database/parkingDB/addParkingOffence.js';
import getParkingOffences from '../../database/parkingDB/getParkingOffences.js';
export default function handler(request, response) {
    const results = addParkingOffence(request.body);
    if (results.success && request.body.returnOffences) {
        results.offences = getParkingOffences();
    }
    response.json(results);
}