feat hasItemOlder refs#6964
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Sergio De la torre 2024-06-18 08:24:15 +02:00
parent eedcdb54fa
commit 46cd20a1fd
1 changed files with 7 additions and 8 deletions

View File

@ -17,7 +17,7 @@ module.exports = Self => {
},
],
returns: {
type: 'Object',
type: 'Array',
root: true
},
http: {
@ -31,7 +31,7 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
const isParkingToReview = await Self.rawSql(`
const [isParkingToReview] = await Self.rawSql(`
SELECT COUNT(p.id) parkingToReview
FROM vn.parking p
JOIN vn.sector s ON s.id = p.sectorFk
@ -39,7 +39,8 @@ module.exports = Self => {
WHERE p.code = ? AND s.code = pc.sectorToCode;`,
[parking], myOptions);
if (isParkingToReview[0]['parkingToReview'] > 0) {
if (isParkingToReview['parkingToReview'] < 1) return [];
const result = await Self.rawSql(`
WITH tItemShelving AS(
SELECT is2.itemFk, is2.created, p.sectorFK, is2.id
@ -65,7 +66,5 @@ module.exports = Self => {
WHERE ti.created > tis.created + INTERVAL pc.itemOlderReviewHours HOUR;`,
[shelvingFk, shelvingFk], myOptions);
return result;
} else
return [];
};
};