added new api endpoint for getting the loan by the loan code

This commit is contained in:
2025-08-20 17:07:49 +02:00
parent c779a31bfa
commit 4b79583574
2 changed files with 25 additions and 0 deletions

View File

@@ -28,6 +28,17 @@ export const getItemsFromDatabaseV2 = async () => {
return { success: false };
};
export const getLoanByCodeV2 = async (loan_code) => {
const [result] = await pool.query(
"SELECT * FROM loans WHERE loan_code = ?;",
[loan_code]
);
if (result.length > 0) {
return { success: true, data: result[0] };
}
return { success: false };
};
export const changeInSafeStateV2 = async (itemId, state) => {
const [result] = await pool.query(
"UPDATE items SET inSafe = ? WHERE id = ?",