in src/RenewDriversLicense.ts [33:50]
async function getPersonIdFromLicenseNumber(txn: TransactionExecutor, licenseNumber: string): Promise<string> {
const query: string = "SELECT PersonId FROM DriversLicense WHERE LicenseNumber = ?";
let personId: string;
await txn.execute(query, licenseNumber).then((result: Result) => {
const resultList: dom.Value[] = result.getResultList();
if (resultList.length === 0) {
throw new Error(`Unable to find person with ID: ${licenseNumber}.`);
}
const PersonIdValue: dom.Value = resultList[0].get("PersonId");
if (PersonIdValue === null) {
throw new Error(`Expected field name PersonId not found.`);
}
personId = PersonIdValue.stringValue();
});
return personId;
}