cityssm/parking-ticket-system

View on GitHub
database/parkingDB/acknowledgeLookupErrorLogEntry.js

Summary

Maintainability
A
0 mins
Test Coverage
F
17%
import sqlite from 'better-sqlite3';
import { parkingDB as databasePath } from '../../data/databasePaths.js';
export default function acknowledgeLookupErrorLogEntry(batchId, logIndex, sessionUser) {
    const database = sqlite(databasePath);
    const info = database
        .prepare(`update LicencePlateLookupErrorLog
        set isAcknowledged = 1,
        recordUpdate_userName = ?,
        recordUpdate_timeMillis = ?
        where recordDelete_timeMillis is null
        and batchId = ?
        and logIndex = ?
        and isAcknowledged = 0`)
        .run(sessionUser.userName, Date.now(), batchId, logIndex);
    database.close();
    return info.changes > 0;
}