condition check lambda

This commit is contained in:
jackiettran
2026-01-13 17:14:19 -05:00
parent 2ee5571b5b
commit f5fdcbfb82
30 changed files with 14293 additions and 461 deletions

View File

@@ -0,0 +1,22 @@
const { query } = require("../shared/db/connection");
/**
* Check if a condition check already exists for a rental and check type.
* @param {string} rentalId - UUID of the rental
* @param {string} checkType - Type of check (pre_rental_owner, rental_start_renter, etc.)
* @returns {Promise<boolean>} True if a condition check exists
*/
async function conditionCheckExists(rentalId, checkType) {
const result = await query(
`SELECT id FROM "ConditionChecks"
WHERE "rentalId" = $1 AND "checkType" = $2
LIMIT 1`,
[rentalId, checkType]
);
return result.rows.length > 0;
}
module.exports = {
conditionCheckExists,
};