cityssm/parking-ticket-system

View on GitHub
database/parkingDB/getParkingLocations.js

Summary

Maintainability
A
1 hr
Test Coverage
A
100%
import sqlite from 'better-sqlite3';
import { parkingDB as databasePath } from '../../data/databasePaths.js';
export default function getParkingLocations() {
    const database = sqlite(databasePath, {
        readonly: true
    });
    const rows = database
        .prepare(`select locationKey, locationName, locationClassKey
        from ParkingLocations
        where isActive = 1
        order by orderNumber, locationName`)
        .all();
    database.close();
    return rows;
}