Added backend external API to change the inSafe state in the database

This commit is contained in:
2025-08-19 19:33:16 +02:00
parent 9287c949ca
commit 508c30c5d0
2 changed files with 36 additions and 3 deletions

View File

@@ -28,6 +28,17 @@ export const getItemsFromDatabaseV2 = async () => {
return { success: false };
};
export const changeInSafeStateV2 = async (itemId, state) => {
const [result] = await pool.query(
"UPDATE items SET inSafe = ? WHERE id = ?",
[state, itemId]
);
if (result.affectedRows > 0) {
return { success: true };
}
return { success: false };
};
export const getItemsFromDatabase = async (role) => {
const sql =
role == 0