added changeSafeState function

This commit is contained in:
2025-09-16 13:00:15 +02:00
parent b3ddfd9aa5
commit 5159877d8d
4 changed files with 86 additions and 54 deletions

View File

@@ -39,10 +39,10 @@ export const getLoanByCodeV2 = async (loan_code) => {
return { success: false };
};
export const changeInSafeStateV2 = async (itemId, state) => {
export const changeInSafeStateV2 = async (itemId) => {
const [result] = await pool.query(
"UPDATE items SET inSafe = ? WHERE id = ?",
[state, itemId]
"UPDATE items SET inSafe = NOT inSafe WHERE id = ?",
[itemId]
);
if (result.affectedRows > 0) {
return { success: true };