cityssm/lottery-licence-manager

View on GitHub
helpers/licencesDB/getMaxLicenceAmendmentIndex.js

Summary

Maintainability
A
1 hr
Test Coverage
F
18%
export const getMaxLicenceAmendmentIndexWithDB = (database, licenceID) => {
    const result = database.prepare("select amendmentIndex" +
        " from LotteryLicenceAmendments" +
        " where licenceID = ?" +
        " order by amendmentIndex desc" +
        " limit 1")
        .get(licenceID);
    return (result
        ? result.amendmentIndex
        : -1);
};