diff --git a/backendV2/info.json b/backendV2/info.json index 331fa29..aa09c6e 100644 --- a/backendV2/info.json +++ b/backendV2/info.json @@ -1,11 +1,11 @@ { "backend-info": { - "version": "v2.0 (dev)" + "version": "v2.0.1 (dev)" }, "frontend-info": { "version": "v2.0 (dev)" }, "admin-panel-info": { - "version": "v1.2 (dev)" + "version": "v1.3 (dev)" } } \ No newline at end of file diff --git a/backendV2/routes/app/database/loansMgmt.database.js b/backendV2/routes/app/database/loansMgmt.database.js index 4bea657..99cdbaa 100644 --- a/backendV2/routes/app/database/loansMgmt.database.js +++ b/backendV2/routes/app/database/loansMgmt.database.js @@ -69,12 +69,20 @@ export const createLoanInDatabase = async ( ) .filter(Boolean); - // Build lockers array (unique, only 2-digit strings) + // Build lockers array (unique, only 2-digit numbers from safe_nr) const lockers = [ ...new Set( itemsRows .map((r) => r.safe_nr) - .filter((sn) => typeof sn === "string" && /^\d{2}$/.test(sn)) + .filter( + (sn) => + sn !== null && + sn !== undefined && + Number.isInteger(Number(sn)) && + Number(sn) >= 0 && + Number(sn) <= 99 + ) + .map((sn) => Number(sn)) ), ];