Merge branch 'dev_v1' into debian12_v1

This commit is contained in:
2025-08-28 21:14:48 +02:00
4 changed files with 147 additions and 5 deletions

View File

@@ -294,3 +294,29 @@ export const createLoanInDatabase = async (
conn.release();
}
};
// These functions are only temporary, and will be deleted when the full bin is set up.
export const onTake = async (loanId) => {
const [result] = await pool.query(
"UPDATE loans SET take_date = NOW() WHERE id = ?",
[loanId]
);
if (result.affectedRows > 0) {
return { success: true };
}
return { success: false };
};
export const onReturn = async (loanId) => {
const [result] = await pool.query(
"UPDATE loans SET returned_date = NOW() WHERE id = ?",
[loanId]
);
if (result.affectedRows > 0) {
return { success: true };
}
return { success: false };
};