diff --git a/helpers/lotOccupancyDB/addWorkOrderMilestone.js b/helpers/lotOccupancyDB/addWorkOrderMilestone.js index 6391c611..63d0ed1d 100644 --- a/helpers/lotOccupancyDB/addWorkOrderMilestone.js +++ b/helpers/lotOccupancyDB/addWorkOrderMilestone.js @@ -1,7 +1,7 @@ import { acquireConnection } from './pool.js'; import { dateStringToInteger, timeStringToInteger } from '@cityssm/utils-datetime'; export async function addWorkOrderMilestone(milestoneForm, requestSession) { - const rightNow = new Date(); + const rightNowMillis = Date.now(); const database = await acquireConnection(); const result = database .prepare(`insert into WorkOrderMilestones ( @@ -12,15 +12,17 @@ export async function addWorkOrderMilestone(milestoneForm, requestSession) { recordCreate_userName, recordCreate_timeMillis, recordUpdate_userName, recordUpdate_timeMillis) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`) - .run(milestoneForm.workOrderId, milestoneForm.workOrderMilestoneTypeId === '' ? undefined : milestoneForm.workOrderMilestoneTypeId, milestoneForm.workOrderMilestoneDateString === '' + .run(milestoneForm.workOrderId, milestoneForm.workOrderMilestoneTypeId === '' + ? undefined + : milestoneForm.workOrderMilestoneTypeId, milestoneForm.workOrderMilestoneDateString === '' ? 0 - : dateStringToInteger(milestoneForm.workOrderMilestoneDateString), milestoneForm.workOrderMilestoneTimeString - ? timeStringToInteger(milestoneForm.workOrderMilestoneTimeString) - : 0, milestoneForm.workOrderMilestoneDescription, milestoneForm.workOrderMilestoneCompletionDateString - ? dateStringToInteger(milestoneForm.workOrderMilestoneCompletionDateString) - : undefined, milestoneForm.workOrderMilestoneCompletionTimeString - ? timeStringToInteger(milestoneForm.workOrderMilestoneCompletionTimeString) - : undefined, requestSession.user.userName, rightNow.getTime(), requestSession.user.userName, rightNow.getTime()); + : dateStringToInteger(milestoneForm.workOrderMilestoneDateString), (milestoneForm.workOrderMilestoneTimeString ?? '') === '' + ? 0 + : timeStringToInteger(milestoneForm.workOrderMilestoneTimeString), milestoneForm.workOrderMilestoneDescription, (milestoneForm.workOrderMilestoneCompletionDateString ?? '') === '' + ? undefined + : dateStringToInteger(milestoneForm.workOrderMilestoneCompletionDateString), (milestoneForm.workOrderMilestoneCompletionTimeString ?? '') === '' + ? undefined + : timeStringToInteger(milestoneForm.workOrderMilestoneCompletionTimeString), requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis); database.release(); return result.lastInsertRowid; } diff --git a/helpers/lotOccupancyDB/addWorkOrderMilestone.ts b/helpers/lotOccupancyDB/addWorkOrderMilestone.ts index 915241a5..c7208478 100644 --- a/helpers/lotOccupancyDB/addWorkOrderMilestone.ts +++ b/helpers/lotOccupancyDB/addWorkOrderMilestone.ts @@ -23,7 +23,7 @@ export async function addWorkOrderMilestone( milestoneForm: AddWorkOrderMilestoneForm, requestSession: recordTypes.PartialSession ): Promise { - const rightNow = new Date() + const rightNowMillis = Date.now() const database = await acquireConnection() @@ -40,28 +40,30 @@ export async function addWorkOrderMilestone( ) .run( milestoneForm.workOrderId, - milestoneForm.workOrderMilestoneTypeId === '' ? undefined : milestoneForm.workOrderMilestoneTypeId, + milestoneForm.workOrderMilestoneTypeId === '' + ? undefined + : milestoneForm.workOrderMilestoneTypeId, milestoneForm.workOrderMilestoneDateString === '' ? 0 : dateStringToInteger(milestoneForm.workOrderMilestoneDateString), - milestoneForm.workOrderMilestoneTimeString - ? timeStringToInteger(milestoneForm.workOrderMilestoneTimeString) - : 0, + (milestoneForm.workOrderMilestoneTimeString ?? '') === '' + ? 0 + : timeStringToInteger(milestoneForm.workOrderMilestoneTimeString!), milestoneForm.workOrderMilestoneDescription, - milestoneForm.workOrderMilestoneCompletionDateString - ? dateStringToInteger( - milestoneForm.workOrderMilestoneCompletionDateString - ) - : undefined, - milestoneForm.workOrderMilestoneCompletionTimeString - ? timeStringToInteger( - milestoneForm.workOrderMilestoneCompletionTimeString - ) - : undefined, + (milestoneForm.workOrderMilestoneCompletionDateString ?? '') === '' + ? undefined + : dateStringToInteger( + milestoneForm.workOrderMilestoneCompletionDateString! + ), + (milestoneForm.workOrderMilestoneCompletionTimeString ?? '') === '' + ? undefined + : timeStringToInteger( + milestoneForm.workOrderMilestoneCompletionTimeString! + ), requestSession.user!.userName, - rightNow.getTime(), + rightNowMillis, requestSession.user!.userName, - rightNow.getTime() + rightNowMillis ) database.release() diff --git a/helpers/lotOccupancyDB/completeWorkOrderMilestone.js b/helpers/lotOccupancyDB/completeWorkOrderMilestone.js index 05baf2d2..7f4bb091 100644 --- a/helpers/lotOccupancyDB/completeWorkOrderMilestone.js +++ b/helpers/lotOccupancyDB/completeWorkOrderMilestone.js @@ -10,11 +10,11 @@ export async function completeWorkOrderMilestone(milestoneForm, requestSession) recordUpdate_userName = ?, recordUpdate_timeMillis = ? where workOrderMilestoneId = ?`) - .run(milestoneForm.workOrderMilestoneCompletionDateString - ? dateStringToInteger(milestoneForm.workOrderMilestoneCompletionDateString) - : dateToInteger(rightNow), milestoneForm.workOrderMilestoneCompletionTimeString - ? timeStringToInteger(milestoneForm.workOrderMilestoneCompletionTimeString) - : dateToTimeInteger(rightNow), requestSession.user.userName, rightNow.getTime(), milestoneForm.workOrderMilestoneId); + .run((milestoneForm.workOrderMilestoneCompletionDateString ?? '') === '' + ? dateToInteger(rightNow) + : dateStringToInteger(milestoneForm.workOrderMilestoneCompletionDateString), (milestoneForm.workOrderMilestoneCompletionTimeString ?? '') === '' + ? dateToTimeInteger(rightNow) + : timeStringToInteger(milestoneForm.workOrderMilestoneCompletionTimeString), requestSession.user.userName, rightNow.getTime(), milestoneForm.workOrderMilestoneId); database.release(); return result.changes > 0; } diff --git a/helpers/lotOccupancyDB/completeWorkOrderMilestone.ts b/helpers/lotOccupancyDB/completeWorkOrderMilestone.ts index 698b812c..325ea1f0 100644 --- a/helpers/lotOccupancyDB/completeWorkOrderMilestone.ts +++ b/helpers/lotOccupancyDB/completeWorkOrderMilestone.ts @@ -35,16 +35,16 @@ export async function completeWorkOrderMilestone( where workOrderMilestoneId = ?` ) .run( - milestoneForm.workOrderMilestoneCompletionDateString - ? dateStringToInteger( - milestoneForm.workOrderMilestoneCompletionDateString - ) - : dateToInteger(rightNow), - milestoneForm.workOrderMilestoneCompletionTimeString - ? timeStringToInteger( - milestoneForm.workOrderMilestoneCompletionTimeString - ) - : dateToTimeInteger(rightNow), + (milestoneForm.workOrderMilestoneCompletionDateString ?? '') === '' + ? dateToInteger(rightNow) + : dateStringToInteger( + milestoneForm.workOrderMilestoneCompletionDateString! + ), + (milestoneForm.workOrderMilestoneCompletionTimeString ?? '') === '' + ? dateToTimeInteger(rightNow) + : timeStringToInteger( + milestoneForm.workOrderMilestoneCompletionTimeString! + ), requestSession.user!.userName, rightNow.getTime(), milestoneForm.workOrderMilestoneId diff --git a/helpers/lotOccupancyDB/deleteLotField.js b/helpers/lotOccupancyDB/deleteLotField.js index 74ac49f4..7197ed72 100644 --- a/helpers/lotOccupancyDB/deleteLotField.js +++ b/helpers/lotOccupancyDB/deleteLotField.js @@ -1,14 +1,13 @@ import { acquireConnection } from './pool.js'; export async function deleteLotField(lotId, lotTypeFieldId, requestSession, connectedDatabase) { const database = connectedDatabase ?? (await acquireConnection()); - const rightNowMillis = Date.now(); const result = database .prepare(`update LotFields set recordDelete_userName = ?, recordDelete_timeMillis = ? where lotId = ? and lotTypeFieldId = ?`) - .run(requestSession.user.userName, rightNowMillis, lotId, lotTypeFieldId); + .run(requestSession.user.userName, Date.now(), lotId, lotTypeFieldId); if (connectedDatabase === undefined) { database.release(); } diff --git a/helpers/lotOccupancyDB/deleteLotField.ts b/helpers/lotOccupancyDB/deleteLotField.ts index f1b90f47..22d7ebab 100644 --- a/helpers/lotOccupancyDB/deleteLotField.ts +++ b/helpers/lotOccupancyDB/deleteLotField.ts @@ -11,8 +11,6 @@ export async function deleteLotField( ): Promise { const database = connectedDatabase ?? (await acquireConnection()) - const rightNowMillis = Date.now() - const result = database .prepare( `update LotFields @@ -21,7 +19,7 @@ export async function deleteLotField( where lotId = ? and lotTypeFieldId = ?` ) - .run(requestSession.user!.userName, rightNowMillis, lotId, lotTypeFieldId) + .run(requestSession.user!.userName, Date.now(), lotId, lotTypeFieldId) if (connectedDatabase === undefined) { database.release() diff --git a/helpers/lotOccupancyDB/deleteLotOccupancyFee.js b/helpers/lotOccupancyDB/deleteLotOccupancyFee.js index f5549fc8..d7f6bb27 100644 --- a/helpers/lotOccupancyDB/deleteLotOccupancyFee.js +++ b/helpers/lotOccupancyDB/deleteLotOccupancyFee.js @@ -1,14 +1,13 @@ import { acquireConnection } from './pool.js'; export async function deleteLotOccupancyFee(lotOccupancyId, feeId, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const result = database .prepare(`update LotOccupancyFees set recordDelete_userName = ?, recordDelete_timeMillis = ? where lotOccupancyId = ? and feeId = ?`) - .run(requestSession.user.userName, rightNowMillis, lotOccupancyId, feeId); + .run(requestSession.user.userName, Date.now(), lotOccupancyId, feeId); database.release(); return result.changes > 0; } diff --git a/helpers/lotOccupancyDB/deleteLotOccupancyFee.ts b/helpers/lotOccupancyDB/deleteLotOccupancyFee.ts index eb96a15d..62d2ef76 100644 --- a/helpers/lotOccupancyDB/deleteLotOccupancyFee.ts +++ b/helpers/lotOccupancyDB/deleteLotOccupancyFee.ts @@ -9,8 +9,6 @@ export async function deleteLotOccupancyFee( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const result = database .prepare( `update LotOccupancyFees @@ -19,7 +17,7 @@ export async function deleteLotOccupancyFee( where lotOccupancyId = ? and feeId = ?` ) - .run(requestSession.user!.userName, rightNowMillis, lotOccupancyId, feeId) + .run(requestSession.user!.userName, Date.now(), lotOccupancyId, feeId) database.release() diff --git a/helpers/lotOccupancyDB/deleteLotOccupancyField.js b/helpers/lotOccupancyDB/deleteLotOccupancyField.js index f2123298..2d1ecbfd 100644 --- a/helpers/lotOccupancyDB/deleteLotOccupancyField.js +++ b/helpers/lotOccupancyDB/deleteLotOccupancyField.js @@ -1,14 +1,13 @@ import { acquireConnection } from './pool.js'; export async function deleteLotOccupancyField(lotOccupancyId, occupancyTypeFieldId, requestSession, connectedDatabase) { const database = connectedDatabase ?? (await acquireConnection()); - const rightNowMillis = Date.now(); const result = database .prepare(`update LotOccupancyFields set recordDelete_userName = ?, recordDelete_timeMillis = ? where lotOccupancyId = ? and occupancyTypeFieldId = ?`) - .run(requestSession.user.userName, rightNowMillis, lotOccupancyId, occupancyTypeFieldId); + .run(requestSession.user.userName, Date.now(), lotOccupancyId, occupancyTypeFieldId); if (connectedDatabase === undefined) { database.release(); } diff --git a/helpers/lotOccupancyDB/deleteLotOccupancyField.ts b/helpers/lotOccupancyDB/deleteLotOccupancyField.ts index 63f0dbe6..9839f5ed 100644 --- a/helpers/lotOccupancyDB/deleteLotOccupancyField.ts +++ b/helpers/lotOccupancyDB/deleteLotOccupancyField.ts @@ -11,8 +11,6 @@ export async function deleteLotOccupancyField( ): Promise { const database = connectedDatabase ?? (await acquireConnection()) - const rightNowMillis = Date.now() - const result = database .prepare( `update LotOccupancyFields @@ -23,7 +21,7 @@ export async function deleteLotOccupancyField( ) .run( requestSession.user!.userName, - rightNowMillis, + Date.now(), lotOccupancyId, occupancyTypeFieldId ) diff --git a/helpers/lotOccupancyDB/deleteLotOccupancyOccupant.js b/helpers/lotOccupancyDB/deleteLotOccupancyOccupant.js index 4bbdbb57..857fa684 100644 --- a/helpers/lotOccupancyDB/deleteLotOccupancyOccupant.js +++ b/helpers/lotOccupancyDB/deleteLotOccupancyOccupant.js @@ -1,14 +1,13 @@ import { acquireConnection } from './pool.js'; export async function deleteLotOccupancyOccupant(lotOccupancyId, lotOccupantIndex, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const result = database .prepare(`update LotOccupancyOccupants set recordDelete_userName = ?, recordDelete_timeMillis = ? where lotOccupancyId = ? and lotOccupantIndex = ?`) - .run(requestSession.user.userName, rightNowMillis, lotOccupancyId, lotOccupantIndex); + .run(requestSession.user.userName, Date.now(), lotOccupancyId, lotOccupantIndex); database.release(); return result.changes > 0; } diff --git a/helpers/lotOccupancyDB/deleteLotOccupancyOccupant.ts b/helpers/lotOccupancyDB/deleteLotOccupancyOccupant.ts index 54ac1df9..93beb124 100644 --- a/helpers/lotOccupancyDB/deleteLotOccupancyOccupant.ts +++ b/helpers/lotOccupancyDB/deleteLotOccupancyOccupant.ts @@ -9,8 +9,6 @@ export async function deleteLotOccupancyOccupant( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const result = database .prepare( `update LotOccupancyOccupants @@ -21,7 +19,7 @@ export async function deleteLotOccupancyOccupant( ) .run( requestSession.user!.userName, - rightNowMillis, + Date.now(), lotOccupancyId, lotOccupantIndex ) diff --git a/helpers/lotOccupancyDB/deleteLotOccupancyTransaction.js b/helpers/lotOccupancyDB/deleteLotOccupancyTransaction.js index 195667e6..a64aec3c 100644 --- a/helpers/lotOccupancyDB/deleteLotOccupancyTransaction.js +++ b/helpers/lotOccupancyDB/deleteLotOccupancyTransaction.js @@ -1,14 +1,13 @@ import { acquireConnection } from './pool.js'; export async function deleteLotOccupancyTransaction(lotOccupancyId, transactionIndex, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const result = database .prepare(`update LotOccupancyTransactions set recordDelete_userName = ?, recordDelete_timeMillis = ? where lotOccupancyId = ? and transactionIndex = ?`) - .run(requestSession.user.userName, rightNowMillis, lotOccupancyId, transactionIndex); + .run(requestSession.user.userName, Date.now(), lotOccupancyId, transactionIndex); database.release(); return result.changes > 0; } diff --git a/helpers/lotOccupancyDB/deleteLotOccupancyTransaction.ts b/helpers/lotOccupancyDB/deleteLotOccupancyTransaction.ts index 4d0718e4..cb50c285 100644 --- a/helpers/lotOccupancyDB/deleteLotOccupancyTransaction.ts +++ b/helpers/lotOccupancyDB/deleteLotOccupancyTransaction.ts @@ -9,8 +9,6 @@ export async function deleteLotOccupancyTransaction( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const result = database .prepare( `update LotOccupancyTransactions @@ -21,7 +19,7 @@ export async function deleteLotOccupancyTransaction( ) .run( requestSession.user!.userName, - rightNowMillis, + Date.now(), lotOccupancyId, transactionIndex ) diff --git a/helpers/lotOccupancyDB/deleteOccupancyTypePrint.js b/helpers/lotOccupancyDB/deleteOccupancyTypePrint.js index 6d85556d..696433d3 100644 --- a/helpers/lotOccupancyDB/deleteOccupancyTypePrint.js +++ b/helpers/lotOccupancyDB/deleteOccupancyTypePrint.js @@ -2,14 +2,13 @@ import { acquireConnection } from './pool.js'; import { clearCacheByTableName } from '../functions.cache.js'; export async function deleteOccupancyTypePrint(occupancyTypeId, printEJS, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const result = database .prepare(`update OccupancyTypePrints set recordDelete_userName = ?, recordDelete_timeMillis = ? where occupancyTypeId = ? and printEJS = ?`) - .run(requestSession.user.userName, rightNowMillis, occupancyTypeId, printEJS); + .run(requestSession.user.userName, Date.now(), occupancyTypeId, printEJS); database.release(); clearCacheByTableName('OccupancyTypePrints'); return result.changes > 0; diff --git a/helpers/lotOccupancyDB/deleteOccupancyTypePrint.ts b/helpers/lotOccupancyDB/deleteOccupancyTypePrint.ts index 5b6ef9da..81fbab9c 100644 --- a/helpers/lotOccupancyDB/deleteOccupancyTypePrint.ts +++ b/helpers/lotOccupancyDB/deleteOccupancyTypePrint.ts @@ -11,8 +11,6 @@ export async function deleteOccupancyTypePrint( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const result = database .prepare( `update OccupancyTypePrints @@ -23,7 +21,7 @@ export async function deleteOccupancyTypePrint( ) .run( requestSession.user!.userName, - rightNowMillis, + Date.now(), occupancyTypeId, printEJS ) diff --git a/helpers/lotOccupancyDB/deleteWorkOrderLot.js b/helpers/lotOccupancyDB/deleteWorkOrderLot.js index 160dbe26..9831f63f 100644 --- a/helpers/lotOccupancyDB/deleteWorkOrderLot.js +++ b/helpers/lotOccupancyDB/deleteWorkOrderLot.js @@ -1,14 +1,13 @@ import { acquireConnection } from './pool.js'; export async function deleteWorkOrderLot(workOrderId, lotId, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const result = database .prepare(`update WorkOrderLots set recordDelete_userName = ?, recordDelete_timeMillis = ? where workOrderId = ? and lotId = ?`) - .run(requestSession.user.userName, rightNowMillis, workOrderId, lotId); + .run(requestSession.user.userName, Date.now(), workOrderId, lotId); database.release(); return result.changes > 0; } diff --git a/helpers/lotOccupancyDB/deleteWorkOrderLot.ts b/helpers/lotOccupancyDB/deleteWorkOrderLot.ts index a0e5dad2..dd53769a 100644 --- a/helpers/lotOccupancyDB/deleteWorkOrderLot.ts +++ b/helpers/lotOccupancyDB/deleteWorkOrderLot.ts @@ -9,8 +9,6 @@ export async function deleteWorkOrderLot( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const result = database .prepare( `update WorkOrderLots @@ -19,7 +17,7 @@ export async function deleteWorkOrderLot( where workOrderId = ? and lotId = ?` ) - .run(requestSession.user!.userName, rightNowMillis, workOrderId, lotId) + .run(requestSession.user!.userName, Date.now(), workOrderId, lotId) database.release() diff --git a/helpers/lotOccupancyDB/deleteWorkOrderLotOccupancy.js b/helpers/lotOccupancyDB/deleteWorkOrderLotOccupancy.js index 4930bb44..45be3e60 100644 --- a/helpers/lotOccupancyDB/deleteWorkOrderLotOccupancy.js +++ b/helpers/lotOccupancyDB/deleteWorkOrderLotOccupancy.js @@ -1,14 +1,13 @@ import { acquireConnection } from './pool.js'; export async function deleteWorkOrderLotOccupancy(workOrderId, lotOccupancyId, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const result = database .prepare(`update WorkOrderLotOccupancies set recordDelete_userName = ?, recordDelete_timeMillis = ? where workOrderId = ? and lotOccupancyId = ?`) - .run(requestSession.user.userName, rightNowMillis, workOrderId, lotOccupancyId); + .run(requestSession.user.userName, Date.now(), workOrderId, lotOccupancyId); database.release(); return result.changes > 0; } diff --git a/helpers/lotOccupancyDB/deleteWorkOrderLotOccupancy.ts b/helpers/lotOccupancyDB/deleteWorkOrderLotOccupancy.ts index 2ca696dd..03308534 100644 --- a/helpers/lotOccupancyDB/deleteWorkOrderLotOccupancy.ts +++ b/helpers/lotOccupancyDB/deleteWorkOrderLotOccupancy.ts @@ -9,8 +9,6 @@ export async function deleteWorkOrderLotOccupancy( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const result = database .prepare( `update WorkOrderLotOccupancies @@ -19,12 +17,7 @@ export async function deleteWorkOrderLotOccupancy( where workOrderId = ? and lotOccupancyId = ?` ) - .run( - requestSession.user!.userName, - rightNowMillis, - workOrderId, - lotOccupancyId - ) + .run(requestSession.user!.userName, Date.now(), workOrderId, lotOccupancyId) database.release() diff --git a/helpers/lotOccupancyDB/reopenWorkOrder.js b/helpers/lotOccupancyDB/reopenWorkOrder.js index 41836c35..4ef973c9 100644 --- a/helpers/lotOccupancyDB/reopenWorkOrder.js +++ b/helpers/lotOccupancyDB/reopenWorkOrder.js @@ -1,7 +1,6 @@ import { acquireConnection } from './pool.js'; export async function reopenWorkOrder(workOrderId, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const result = database .prepare(`update WorkOrders set workOrderCloseDate = null, @@ -9,7 +8,7 @@ export async function reopenWorkOrder(workOrderId, requestSession) { recordUpdate_timeMillis = ? where workOrderId = ? and workOrderCloseDate is not null`) - .run(requestSession.user.userName, rightNowMillis, workOrderId); + .run(requestSession.user.userName, Date.now(), workOrderId); database.release(); return result.changes > 0; } diff --git a/helpers/lotOccupancyDB/reopenWorkOrder.ts b/helpers/lotOccupancyDB/reopenWorkOrder.ts index 21453603..0ebabbc0 100644 --- a/helpers/lotOccupancyDB/reopenWorkOrder.ts +++ b/helpers/lotOccupancyDB/reopenWorkOrder.ts @@ -8,8 +8,6 @@ export async function reopenWorkOrder( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const result = database .prepare( `update WorkOrders @@ -19,7 +17,7 @@ export async function reopenWorkOrder( where workOrderId = ? and workOrderCloseDate is not null` ) - .run(requestSession.user!.userName, rightNowMillis, workOrderId) + .run(requestSession.user!.userName, Date.now(), workOrderId) database.release() diff --git a/helpers/lotOccupancyDB/reopenWorkOrderMilestone.js b/helpers/lotOccupancyDB/reopenWorkOrderMilestone.js index e197d10c..43346a13 100644 --- a/helpers/lotOccupancyDB/reopenWorkOrderMilestone.js +++ b/helpers/lotOccupancyDB/reopenWorkOrderMilestone.js @@ -1,7 +1,6 @@ import { acquireConnection } from './pool.js'; export async function reopenWorkOrderMilestone(workOrderMilestoneId, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const result = database .prepare(`update WorkOrderMilestones set workOrderMilestoneCompletionDate = null, @@ -10,7 +9,7 @@ export async function reopenWorkOrderMilestone(workOrderMilestoneId, requestSess recordUpdate_timeMillis = ? where workOrderMilestoneId = ? and workOrderMilestoneCompletionDate is not null`) - .run(requestSession.user.userName, rightNowMillis, workOrderMilestoneId); + .run(requestSession.user.userName, Date.now(), workOrderMilestoneId); database.release(); return result.changes > 0; } diff --git a/helpers/lotOccupancyDB/reopenWorkOrderMilestone.ts b/helpers/lotOccupancyDB/reopenWorkOrderMilestone.ts index 08e203f7..e0a13ab0 100644 --- a/helpers/lotOccupancyDB/reopenWorkOrderMilestone.ts +++ b/helpers/lotOccupancyDB/reopenWorkOrderMilestone.ts @@ -8,8 +8,6 @@ export async function reopenWorkOrderMilestone( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const result = database .prepare( `update WorkOrderMilestones @@ -20,7 +18,7 @@ export async function reopenWorkOrderMilestone( where workOrderMilestoneId = ? and workOrderMilestoneCompletionDate is not null` ) - .run(requestSession.user!.userName, rightNowMillis, workOrderMilestoneId) + .run(requestSession.user!.userName, Date.now(), workOrderMilestoneId) database.release() diff --git a/helpers/lotOccupancyDB/updateFee.js b/helpers/lotOccupancyDB/updateFee.js index 0259ad3d..5fd36e5e 100644 --- a/helpers/lotOccupancyDB/updateFee.js +++ b/helpers/lotOccupancyDB/updateFee.js @@ -1,7 +1,6 @@ import { acquireConnection } from './pool.js'; export async function updateFee(feeForm, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const result = database .prepare(`update Fees set feeCategoryId = ?, @@ -22,7 +21,7 @@ export async function updateFee(feeForm, requestSession) { and feeId = ?`) .run(feeForm.feeCategoryId, feeForm.feeName, feeForm.feeDescription, feeForm.occupancyTypeId === '' ? undefined : feeForm.occupancyTypeId, feeForm.lotTypeId === '' ? undefined : feeForm.lotTypeId, feeForm.feeAmount === undefined || feeForm.feeAmount === '' ? 0 - : feeForm.feeAmount, feeForm.feeFunction ?? undefined, feeForm.taxAmount ?? undefined, feeForm.taxPercentage ?? undefined, feeForm.includeQuantity === '' ? 0 : 1, feeForm.quantityUnit, feeForm.isRequired === '' ? 0 : 1, requestSession.user.userName, rightNowMillis, feeForm.feeId); + : feeForm.feeAmount, feeForm.feeFunction ?? undefined, feeForm.taxAmount ?? undefined, feeForm.taxPercentage ?? undefined, feeForm.includeQuantity === '' ? 0 : 1, feeForm.quantityUnit, feeForm.isRequired === '' ? 0 : 1, requestSession.user.userName, Date.now(), feeForm.feeId); database.release(); return result.changes > 0; } diff --git a/helpers/lotOccupancyDB/updateFee.ts b/helpers/lotOccupancyDB/updateFee.ts index 7a964c60..e2fa0d08 100644 --- a/helpers/lotOccupancyDB/updateFee.ts +++ b/helpers/lotOccupancyDB/updateFee.ts @@ -24,8 +24,6 @@ export async function updateFee( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const result = database .prepare( `update Fees @@ -62,7 +60,7 @@ export async function updateFee( feeForm.quantityUnit, feeForm.isRequired === '' ? 0 : 1, requestSession.user!.userName, - rightNowMillis, + Date.now(), feeForm.feeId ) diff --git a/helpers/lotOccupancyDB/updateLot.js b/helpers/lotOccupancyDB/updateLot.js index b73497cd..d6be13f4 100644 --- a/helpers/lotOccupancyDB/updateLot.js +++ b/helpers/lotOccupancyDB/updateLot.js @@ -3,7 +3,6 @@ import { addOrUpdateLotField } from './addOrUpdateLotField.js'; import { deleteLotField } from './deleteLotField.js'; export async function updateLot(lotForm, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const result = database .prepare(`update Lots set lotName = ?, @@ -17,7 +16,7 @@ export async function updateLot(lotForm, requestSession) { recordUpdate_timeMillis = ? where lotId = ? and recordDelete_timeMillis is null`) - .run(lotForm.lotName, lotForm.lotTypeId, lotForm.lotStatusId === '' ? undefined : lotForm.lotStatusId, lotForm.mapId === '' ? undefined : lotForm.mapId, lotForm.mapKey, lotForm.lotLatitude === '' ? undefined : lotForm.lotLatitude, lotForm.lotLongitude === '' ? undefined : lotForm.lotLongitude, requestSession.user.userName, rightNowMillis, lotForm.lotId); + .run(lotForm.lotName, lotForm.lotTypeId, lotForm.lotStatusId === '' ? undefined : lotForm.lotStatusId, lotForm.mapId === '' ? undefined : lotForm.mapId, lotForm.mapKey, lotForm.lotLatitude === '' ? undefined : lotForm.lotLatitude, lotForm.lotLongitude === '' ? undefined : lotForm.lotLongitude, requestSession.user.userName, Date.now(), lotForm.lotId); if (result.changes > 0) { const lotTypeFieldIds = (lotForm.lotTypeFieldIds ?? '').split(','); for (const lotTypeFieldId of lotTypeFieldIds) { diff --git a/helpers/lotOccupancyDB/updateLot.ts b/helpers/lotOccupancyDB/updateLot.ts index 15daa98a..cda43267 100644 --- a/helpers/lotOccupancyDB/updateLot.ts +++ b/helpers/lotOccupancyDB/updateLot.ts @@ -28,8 +28,6 @@ export async function updateLot( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const result = database .prepare( `update Lots @@ -54,7 +52,7 @@ export async function updateLot( lotForm.lotLatitude === '' ? undefined : lotForm.lotLatitude, lotForm.lotLongitude === '' ? undefined : lotForm.lotLongitude, requestSession.user!.userName, - rightNowMillis, + Date.now(), lotForm.lotId ) diff --git a/helpers/lotOccupancyDB/updateLotComment.js b/helpers/lotOccupancyDB/updateLotComment.js index 59459637..0deb3311 100644 --- a/helpers/lotOccupancyDB/updateLotComment.js +++ b/helpers/lotOccupancyDB/updateLotComment.js @@ -1,7 +1,6 @@ import { acquireConnection } from './pool.js'; import { dateStringToInteger, timeStringToInteger } from '@cityssm/utils-datetime'; export async function updateLotComment(commentForm, requestSession) { - const rightNowMillis = Date.now(); const database = await acquireConnection(); const result = database .prepare(`update LotComments @@ -12,7 +11,7 @@ export async function updateLotComment(commentForm, requestSession) { recordUpdate_timeMillis = ? where recordDelete_timeMillis is null and lotCommentId = ?`) - .run(dateStringToInteger(commentForm.lotCommentDateString), timeStringToInteger(commentForm.lotCommentTimeString), commentForm.lotComment, requestSession.user.userName, rightNowMillis, commentForm.lotCommentId); + .run(dateStringToInteger(commentForm.lotCommentDateString), timeStringToInteger(commentForm.lotCommentTimeString), commentForm.lotComment, requestSession.user.userName, Date.now(), commentForm.lotCommentId); database.release(); return result.changes > 0; } diff --git a/helpers/lotOccupancyDB/updateLotComment.ts b/helpers/lotOccupancyDB/updateLotComment.ts index b1c5aa96..4183914f 100644 --- a/helpers/lotOccupancyDB/updateLotComment.ts +++ b/helpers/lotOccupancyDB/updateLotComment.ts @@ -18,8 +18,6 @@ export async function updateLotComment( commentForm: UpdateLotCommentForm, requestSession: recordTypes.PartialSession ): Promise { - const rightNowMillis = Date.now() - const database = await acquireConnection() const result = database @@ -38,7 +36,7 @@ export async function updateLotComment( timeStringToInteger(commentForm.lotCommentTimeString), commentForm.lotComment, requestSession.user!.userName, - rightNowMillis, + Date.now(), commentForm.lotCommentId ) diff --git a/helpers/lotOccupancyDB/updateLotOccupancy.js b/helpers/lotOccupancyDB/updateLotOccupancy.js index 42c98af2..58096e81 100644 --- a/helpers/lotOccupancyDB/updateLotOccupancy.js +++ b/helpers/lotOccupancyDB/updateLotOccupancy.js @@ -4,7 +4,6 @@ import { addOrUpdateLotOccupancyField } from './addOrUpdateLotOccupancyField.js' import { deleteLotOccupancyField } from './deleteLotOccupancyField.js'; export async function updateLotOccupancy(lotOccupancyForm, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const result = database .prepare(`update LotOccupancies set occupancyTypeId = ?, @@ -17,7 +16,7 @@ export async function updateLotOccupancy(lotOccupancyForm, requestSession) { and recordDelete_timeMillis is null`) .run(lotOccupancyForm.occupancyTypeId, lotOccupancyForm.lotId === '' ? undefined : lotOccupancyForm.lotId, dateStringToInteger(lotOccupancyForm.occupancyStartDateString), lotOccupancyForm.occupancyEndDateString === '' ? undefined - : dateStringToInteger(lotOccupancyForm.occupancyEndDateString), requestSession.user.userName, rightNowMillis, lotOccupancyForm.lotOccupancyId); + : dateStringToInteger(lotOccupancyForm.occupancyEndDateString), requestSession.user.userName, Date.now(), lotOccupancyForm.lotOccupancyId); if (result.changes > 0) { const occupancyTypeFieldIds = (lotOccupancyForm.occupancyTypeFieldIds ?? '').split(','); for (const occupancyTypeFieldId of occupancyTypeFieldIds) { diff --git a/helpers/lotOccupancyDB/updateLotOccupancy.ts b/helpers/lotOccupancyDB/updateLotOccupancy.ts index c3afcf1d..5936c6dd 100644 --- a/helpers/lotOccupancyDB/updateLotOccupancy.ts +++ b/helpers/lotOccupancyDB/updateLotOccupancy.ts @@ -28,8 +28,6 @@ export async function updateLotOccupancy( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const result = database .prepare( `update LotOccupancies @@ -50,7 +48,7 @@ export async function updateLotOccupancy( ? undefined : dateStringToInteger(lotOccupancyForm.occupancyEndDateString), requestSession.user!.userName, - rightNowMillis, + Date.now(), lotOccupancyForm.lotOccupancyId ) diff --git a/helpers/lotOccupancyDB/updateLotOccupancyComment.js b/helpers/lotOccupancyDB/updateLotOccupancyComment.js index 8f48fe02..cab89a72 100644 --- a/helpers/lotOccupancyDB/updateLotOccupancyComment.js +++ b/helpers/lotOccupancyDB/updateLotOccupancyComment.js @@ -1,7 +1,6 @@ import { acquireConnection } from './pool.js'; import { dateStringToInteger, timeStringToInteger } from '@cityssm/utils-datetime'; export async function updateLotOccupancyComment(commentForm, requestSession) { - const rightNowMillis = Date.now(); const database = await acquireConnection(); const result = database .prepare(`update LotOccupancyComments @@ -12,7 +11,7 @@ export async function updateLotOccupancyComment(commentForm, requestSession) { recordUpdate_timeMillis = ? where recordDelete_timeMillis is null and lotOccupancyCommentId = ?`) - .run(dateStringToInteger(commentForm.lotOccupancyCommentDateString), timeStringToInteger(commentForm.lotOccupancyCommentTimeString), commentForm.lotOccupancyComment, requestSession.user.userName, rightNowMillis, commentForm.lotOccupancyCommentId); + .run(dateStringToInteger(commentForm.lotOccupancyCommentDateString), timeStringToInteger(commentForm.lotOccupancyCommentTimeString), commentForm.lotOccupancyComment, requestSession.user.userName, Date.now(), commentForm.lotOccupancyCommentId); database.release(); return result.changes > 0; } diff --git a/helpers/lotOccupancyDB/updateLotOccupancyComment.ts b/helpers/lotOccupancyDB/updateLotOccupancyComment.ts index 9cd52961..870ae5a9 100644 --- a/helpers/lotOccupancyDB/updateLotOccupancyComment.ts +++ b/helpers/lotOccupancyDB/updateLotOccupancyComment.ts @@ -18,8 +18,6 @@ export async function updateLotOccupancyComment( commentForm: UpdateLotOccupancyCommentForm, requestSession: recordTypes.PartialSession ): Promise { - const rightNowMillis = Date.now() - const database = await acquireConnection() const result = database @@ -38,7 +36,7 @@ export async function updateLotOccupancyComment( timeStringToInteger(commentForm.lotOccupancyCommentTimeString), commentForm.lotOccupancyComment, requestSession.user!.userName, - rightNowMillis, + Date.now(), commentForm.lotOccupancyCommentId ) diff --git a/helpers/lotOccupancyDB/updateLotOccupancyFeeQuantity.js b/helpers/lotOccupancyDB/updateLotOccupancyFeeQuantity.js index 8714c06e..9d344c81 100644 --- a/helpers/lotOccupancyDB/updateLotOccupancyFeeQuantity.js +++ b/helpers/lotOccupancyDB/updateLotOccupancyFeeQuantity.js @@ -1,6 +1,5 @@ import { acquireConnection } from './pool.js'; export async function updateLotOccupancyFeeQuantity(feeQuantityForm, requestSession) { - const rightNowMillis = Date.now(); const database = await acquireConnection(); const result = database .prepare(`update LotOccupancyFees @@ -10,7 +9,7 @@ export async function updateLotOccupancyFeeQuantity(feeQuantityForm, requestSess where recordDelete_timeMillis is null and lotOccupancyId = ? and feeId = ?`) - .run(feeQuantityForm.quantity, requestSession.user.userName, rightNowMillis, feeQuantityForm.lotOccupancyId, feeQuantityForm.feeId); + .run(feeQuantityForm.quantity, requestSession.user.userName, Date.now(), feeQuantityForm.lotOccupancyId, feeQuantityForm.feeId); database.release(); return result.changes > 0; } diff --git a/helpers/lotOccupancyDB/updateLotOccupancyFeeQuantity.ts b/helpers/lotOccupancyDB/updateLotOccupancyFeeQuantity.ts index 5e82c3fb..c0b0ca2e 100644 --- a/helpers/lotOccupancyDB/updateLotOccupancyFeeQuantity.ts +++ b/helpers/lotOccupancyDB/updateLotOccupancyFeeQuantity.ts @@ -12,8 +12,6 @@ export async function updateLotOccupancyFeeQuantity( feeQuantityForm: UpdateLotOccupancyFeeQuantityForm, requestSession: recordTypes.PartialSession ): Promise { - const rightNowMillis = Date.now() - const database = await acquireConnection() const result = database @@ -29,7 +27,7 @@ export async function updateLotOccupancyFeeQuantity( .run( feeQuantityForm.quantity, requestSession.user!.userName, - rightNowMillis, + Date.now(), feeQuantityForm.lotOccupancyId, feeQuantityForm.feeId ) diff --git a/helpers/lotOccupancyDB/updateLotOccupancyOccupant.js b/helpers/lotOccupancyDB/updateLotOccupancyOccupant.js index 60ac3e14..d0508d48 100644 --- a/helpers/lotOccupancyDB/updateLotOccupancyOccupant.js +++ b/helpers/lotOccupancyDB/updateLotOccupancyOccupant.js @@ -1,7 +1,6 @@ import { acquireConnection } from './pool.js'; export async function updateLotOccupancyOccupant(lotOccupancyOccupantForm, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const results = database .prepare(`update LotOccupancyOccupants set occupantName = ?, @@ -20,7 +19,7 @@ export async function updateLotOccupancyOccupant(lotOccupancyOccupantForm, reque where recordDelete_timeMillis is null and lotOccupancyId = ? and lotOccupantIndex = ?`) - .run(lotOccupancyOccupantForm.occupantName, lotOccupancyOccupantForm.occupantFamilyName, lotOccupancyOccupantForm.occupantAddress1, lotOccupancyOccupantForm.occupantAddress2, lotOccupancyOccupantForm.occupantCity, lotOccupancyOccupantForm.occupantProvince, lotOccupancyOccupantForm.occupantPostalCode, lotOccupancyOccupantForm.occupantPhoneNumber, lotOccupancyOccupantForm.occupantEmailAddress, lotOccupancyOccupantForm.occupantComment, lotOccupancyOccupantForm.lotOccupantTypeId, requestSession.user.userName, rightNowMillis, lotOccupancyOccupantForm.lotOccupancyId, lotOccupancyOccupantForm.lotOccupantIndex); + .run(lotOccupancyOccupantForm.occupantName, lotOccupancyOccupantForm.occupantFamilyName, lotOccupancyOccupantForm.occupantAddress1, lotOccupancyOccupantForm.occupantAddress2, lotOccupancyOccupantForm.occupantCity, lotOccupancyOccupantForm.occupantProvince, lotOccupancyOccupantForm.occupantPostalCode, lotOccupancyOccupantForm.occupantPhoneNumber, lotOccupancyOccupantForm.occupantEmailAddress, lotOccupancyOccupantForm.occupantComment, lotOccupancyOccupantForm.lotOccupantTypeId, requestSession.user.userName, Date.now(), lotOccupancyOccupantForm.lotOccupancyId, lotOccupancyOccupantForm.lotOccupantIndex); database.release(); return results.changes > 0; } diff --git a/helpers/lotOccupancyDB/updateLotOccupancyOccupant.ts b/helpers/lotOccupancyDB/updateLotOccupancyOccupant.ts index 46346dfa..1a03d545 100644 --- a/helpers/lotOccupancyDB/updateLotOccupancyOccupant.ts +++ b/helpers/lotOccupancyDB/updateLotOccupancyOccupant.ts @@ -24,8 +24,6 @@ export async function updateLotOccupancyOccupant( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const results = database .prepare( `update LotOccupancyOccupants @@ -59,7 +57,7 @@ export async function updateLotOccupancyOccupant( lotOccupancyOccupantForm.occupantComment, lotOccupancyOccupantForm.lotOccupantTypeId, requestSession.user!.userName, - rightNowMillis, + Date.now(), lotOccupancyOccupantForm.lotOccupancyId, lotOccupancyOccupantForm.lotOccupantIndex ) diff --git a/helpers/lotOccupancyDB/updateLotOccupantType.js b/helpers/lotOccupancyDB/updateLotOccupantType.js index 497fd1dc..4cd293d0 100644 --- a/helpers/lotOccupancyDB/updateLotOccupantType.js +++ b/helpers/lotOccupancyDB/updateLotOccupantType.js @@ -2,7 +2,6 @@ import { acquireConnection } from './pool.js'; import { clearCacheByTableName } from '../functions.cache.js'; export async function updateLotOccupantType(lotOccupantTypeForm, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const result = database .prepare(`update LotOccupantTypes set lotOccupantType = ?, @@ -12,7 +11,7 @@ export async function updateLotOccupantType(lotOccupantTypeForm, requestSession) recordUpdate_timeMillis = ? where lotOccupantTypeId = ? and recordDelete_timeMillis is null`) - .run(lotOccupantTypeForm.lotOccupantType, lotOccupantTypeForm.fontAwesomeIconClass, lotOccupantTypeForm.occupantCommentTitle, requestSession.user.userName, rightNowMillis, lotOccupantTypeForm.lotOccupantTypeId); + .run(lotOccupantTypeForm.lotOccupantType, lotOccupantTypeForm.fontAwesomeIconClass, lotOccupantTypeForm.occupantCommentTitle, requestSession.user.userName, Date.now(), lotOccupantTypeForm.lotOccupantTypeId); database.release(); clearCacheByTableName('LotOccupantTypes'); return result.changes > 0; diff --git a/helpers/lotOccupancyDB/updateLotOccupantType.ts b/helpers/lotOccupancyDB/updateLotOccupantType.ts index a47c0b70..13cf7e7d 100644 --- a/helpers/lotOccupancyDB/updateLotOccupantType.ts +++ b/helpers/lotOccupancyDB/updateLotOccupantType.ts @@ -17,8 +17,6 @@ export async function updateLotOccupantType( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const result = database .prepare( `update LotOccupantTypes @@ -35,7 +33,7 @@ export async function updateLotOccupantType( lotOccupantTypeForm.fontAwesomeIconClass, lotOccupantTypeForm.occupantCommentTitle, requestSession.user!.userName, - rightNowMillis, + Date.now(), lotOccupantTypeForm.lotOccupantTypeId ) diff --git a/helpers/lotOccupancyDB/updateLotTypeField.js b/helpers/lotOccupancyDB/updateLotTypeField.js index 003bd000..70b14a5c 100644 --- a/helpers/lotOccupancyDB/updateLotTypeField.js +++ b/helpers/lotOccupancyDB/updateLotTypeField.js @@ -2,7 +2,6 @@ import { acquireConnection } from './pool.js'; import { clearCacheByTableName } from '../functions.cache.js'; export async function updateLotTypeField(lotTypeFieldForm, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const result = database .prepare(`update LotTypeFields set lotTypeField = ?, @@ -15,7 +14,7 @@ export async function updateLotTypeField(lotTypeFieldForm, requestSession) { recordUpdate_timeMillis = ? where lotTypeFieldId = ? and recordDelete_timeMillis is null`) - .run(lotTypeFieldForm.lotTypeField, Number.parseInt(lotTypeFieldForm.isRequired, 10), lotTypeFieldForm.minimumLength ?? 0, lotTypeFieldForm.maximumLength ?? 100, lotTypeFieldForm.pattern ?? '', lotTypeFieldForm.lotTypeFieldValues, requestSession.user.userName, rightNowMillis, lotTypeFieldForm.lotTypeFieldId); + .run(lotTypeFieldForm.lotTypeField, Number.parseInt(lotTypeFieldForm.isRequired, 10), lotTypeFieldForm.minimumLength ?? 0, lotTypeFieldForm.maximumLength ?? 100, lotTypeFieldForm.pattern ?? '', lotTypeFieldForm.lotTypeFieldValues, requestSession.user.userName, Date.now(), lotTypeFieldForm.lotTypeFieldId); database.release(); clearCacheByTableName('LotTypeFields'); return result.changes > 0; diff --git a/helpers/lotOccupancyDB/updateLotTypeField.ts b/helpers/lotOccupancyDB/updateLotTypeField.ts index 918e5c82..a02a8d7f 100644 --- a/helpers/lotOccupancyDB/updateLotTypeField.ts +++ b/helpers/lotOccupancyDB/updateLotTypeField.ts @@ -20,8 +20,6 @@ export async function updateLotTypeField( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const result = database .prepare( `update LotTypeFields @@ -44,7 +42,7 @@ export async function updateLotTypeField( lotTypeFieldForm.pattern ?? '', lotTypeFieldForm.lotTypeFieldValues, requestSession.user!.userName, - rightNowMillis, + Date.now(), lotTypeFieldForm.lotTypeFieldId ) diff --git a/helpers/lotOccupancyDB/updateMap.js b/helpers/lotOccupancyDB/updateMap.js index b0d108a4..3f0d6edf 100644 --- a/helpers/lotOccupancyDB/updateMap.js +++ b/helpers/lotOccupancyDB/updateMap.js @@ -1,7 +1,6 @@ import { acquireConnection } from './pool.js'; export async function updateMap(mapForm, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const result = database .prepare(`update Maps set mapName = ?, @@ -19,7 +18,7 @@ export async function updateMap(mapForm, requestSession) { recordUpdate_timeMillis = ? where mapId = ? and recordDelete_timeMillis is null`) - .run(mapForm.mapName, mapForm.mapDescription, mapForm.mapSVG, mapForm.mapLatitude === '' ? undefined : mapForm.mapLatitude, mapForm.mapLongitude === '' ? undefined : mapForm.mapLongitude, mapForm.mapAddress1, mapForm.mapAddress2, mapForm.mapCity, mapForm.mapProvince, mapForm.mapPostalCode, mapForm.mapPhoneNumber, requestSession.user.userName, rightNowMillis, mapForm.mapId); + .run(mapForm.mapName, mapForm.mapDescription, mapForm.mapSVG, mapForm.mapLatitude === '' ? undefined : mapForm.mapLatitude, mapForm.mapLongitude === '' ? undefined : mapForm.mapLongitude, mapForm.mapAddress1, mapForm.mapAddress2, mapForm.mapCity, mapForm.mapProvince, mapForm.mapPostalCode, mapForm.mapPhoneNumber, requestSession.user.userName, Date.now(), mapForm.mapId); database.release(); return result.changes > 0; } diff --git a/helpers/lotOccupancyDB/updateMap.ts b/helpers/lotOccupancyDB/updateMap.ts index 5ec98a9e..5dc4ff73 100644 --- a/helpers/lotOccupancyDB/updateMap.ts +++ b/helpers/lotOccupancyDB/updateMap.ts @@ -23,8 +23,6 @@ export async function updateMap( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const result = database .prepare( `update Maps @@ -57,7 +55,7 @@ export async function updateMap( mapForm.mapPostalCode, mapForm.mapPhoneNumber, requestSession.user!.userName, - rightNowMillis, + Date.now(), mapForm.mapId ) diff --git a/helpers/lotOccupancyDB/updateOccupancyTypeField.js b/helpers/lotOccupancyDB/updateOccupancyTypeField.js index 36587d00..bf72087b 100644 --- a/helpers/lotOccupancyDB/updateOccupancyTypeField.js +++ b/helpers/lotOccupancyDB/updateOccupancyTypeField.js @@ -2,7 +2,6 @@ import { acquireConnection } from './pool.js'; import { clearCacheByTableName } from '../functions.cache.js'; export async function updateOccupancyTypeField(occupancyTypeFieldForm, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const result = database .prepare(`update OccupancyTypeFields set occupancyTypeField = ?, @@ -15,7 +14,7 @@ export async function updateOccupancyTypeField(occupancyTypeFieldForm, requestSe recordUpdate_timeMillis = ? where occupancyTypeFieldId = ? and recordDelete_timeMillis is null`) - .run(occupancyTypeFieldForm.occupancyTypeField, Number.parseInt(occupancyTypeFieldForm.isRequired, 10), occupancyTypeFieldForm.minimumLength ?? 0, occupancyTypeFieldForm.maximumLength ?? 100, occupancyTypeFieldForm.pattern ?? '', occupancyTypeFieldForm.occupancyTypeFieldValues, requestSession.user.userName, rightNowMillis, occupancyTypeFieldForm.occupancyTypeFieldId); + .run(occupancyTypeFieldForm.occupancyTypeField, Number.parseInt(occupancyTypeFieldForm.isRequired, 10), occupancyTypeFieldForm.minimumLength ?? 0, occupancyTypeFieldForm.maximumLength ?? 100, occupancyTypeFieldForm.pattern ?? '', occupancyTypeFieldForm.occupancyTypeFieldValues, requestSession.user.userName, Date.now(), occupancyTypeFieldForm.occupancyTypeFieldId); database.release(); clearCacheByTableName('OccupancyTypeFields'); return result.changes > 0; diff --git a/helpers/lotOccupancyDB/updateOccupancyTypeField.ts b/helpers/lotOccupancyDB/updateOccupancyTypeField.ts index 32f6cd32..054788d5 100644 --- a/helpers/lotOccupancyDB/updateOccupancyTypeField.ts +++ b/helpers/lotOccupancyDB/updateOccupancyTypeField.ts @@ -20,8 +20,6 @@ export async function updateOccupancyTypeField( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const result = database .prepare( `update OccupancyTypeFields @@ -44,7 +42,7 @@ export async function updateOccupancyTypeField( occupancyTypeFieldForm.pattern ?? '', occupancyTypeFieldForm.occupancyTypeFieldValues, requestSession.user!.userName, - rightNowMillis, + Date.now(), occupancyTypeFieldForm.occupancyTypeFieldId ) diff --git a/helpers/lotOccupancyDB/updateRecord.js b/helpers/lotOccupancyDB/updateRecord.js index 10f42f40..b62b01a2 100644 --- a/helpers/lotOccupancyDB/updateRecord.js +++ b/helpers/lotOccupancyDB/updateRecord.js @@ -12,7 +12,6 @@ recordNameIdColumns.set('WorkOrderMilestoneTypes', [ recordNameIdColumns.set('WorkOrderTypes', ['workOrderType', 'workOrderTypeId']); export async function updateRecord(recordTable, recordId, recordName, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const result = database .prepare(`update ${recordTable} set ${recordNameIdColumns.get(recordTable)[0]} = ?, @@ -20,7 +19,7 @@ export async function updateRecord(recordTable, recordId, recordName, requestSes recordUpdate_timeMillis = ? where recordDelete_timeMillis is null and ${recordNameIdColumns.get(recordTable)[1]} = ?`) - .run(recordName, requestSession.user.userName, rightNowMillis, recordId); + .run(recordName, requestSession.user.userName, Date.now(), recordId); database.release(); clearCacheByTableName(recordTable); return result.changes > 0; diff --git a/helpers/lotOccupancyDB/updateRecord.ts b/helpers/lotOccupancyDB/updateRecord.ts index 7fed98a3..c206ba31 100644 --- a/helpers/lotOccupancyDB/updateRecord.ts +++ b/helpers/lotOccupancyDB/updateRecord.ts @@ -31,8 +31,6 @@ export async function updateRecord( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const result = database .prepare( `update ${recordTable} @@ -42,7 +40,7 @@ export async function updateRecord( where recordDelete_timeMillis is null and ${recordNameIdColumns.get(recordTable)![1]} = ?` ) - .run(recordName, requestSession.user!.userName, rightNowMillis, recordId) + .run(recordName, requestSession.user!.userName, Date.now(), recordId) database.release() diff --git a/helpers/lotOccupancyDB/updateWorkOrder.js b/helpers/lotOccupancyDB/updateWorkOrder.js index b11d7d33..50742119 100644 --- a/helpers/lotOccupancyDB/updateWorkOrder.js +++ b/helpers/lotOccupancyDB/updateWorkOrder.js @@ -2,7 +2,6 @@ import { acquireConnection } from './pool.js'; import { dateStringToInteger } from '@cityssm/utils-datetime'; export async function updateWorkOrder(workOrderForm, requestSession) { const database = await acquireConnection(); - const rightNowMillis = Date.now(); const result = database .prepare(`update WorkOrders set workOrderNumber = ?, @@ -13,7 +12,7 @@ export async function updateWorkOrder(workOrderForm, requestSession) { recordUpdate_timeMillis = ? where workOrderId = ? and recordDelete_timeMillis is null`) - .run(workOrderForm.workOrderNumber, workOrderForm.workOrderTypeId, workOrderForm.workOrderDescription, dateStringToInteger(workOrderForm.workOrderOpenDateString), requestSession.user.userName, rightNowMillis, workOrderForm.workOrderId); + .run(workOrderForm.workOrderNumber, workOrderForm.workOrderTypeId, workOrderForm.workOrderDescription, dateStringToInteger(workOrderForm.workOrderOpenDateString), requestSession.user.userName, Date.now(), workOrderForm.workOrderId); database.release(); return result.changes > 0; } diff --git a/helpers/lotOccupancyDB/updateWorkOrder.ts b/helpers/lotOccupancyDB/updateWorkOrder.ts index fe2bf729..e6863f0d 100644 --- a/helpers/lotOccupancyDB/updateWorkOrder.ts +++ b/helpers/lotOccupancyDB/updateWorkOrder.ts @@ -18,8 +18,6 @@ export async function updateWorkOrder( ): Promise { const database = await acquireConnection() - const rightNowMillis = Date.now() - const result = database .prepare( `update WorkOrders @@ -38,7 +36,7 @@ export async function updateWorkOrder( workOrderForm.workOrderDescription, dateStringToInteger(workOrderForm.workOrderOpenDateString), requestSession.user!.userName, - rightNowMillis, + Date.now(), workOrderForm.workOrderId ) diff --git a/helpers/lotOccupancyDB/updateWorkOrderComment.js b/helpers/lotOccupancyDB/updateWorkOrderComment.js index e4c253de..2f312c32 100644 --- a/helpers/lotOccupancyDB/updateWorkOrderComment.js +++ b/helpers/lotOccupancyDB/updateWorkOrderComment.js @@ -1,7 +1,6 @@ import { acquireConnection } from './pool.js'; import { dateStringToInteger, timeStringToInteger } from '@cityssm/utils-datetime'; export async function updateWorkOrderComment(commentForm, requestSession) { - const rightNowMillis = Date.now(); const database = await acquireConnection(); const result = database .prepare(`update WorkOrderComments @@ -12,7 +11,7 @@ export async function updateWorkOrderComment(commentForm, requestSession) { recordUpdate_timeMillis = ? where recordDelete_timeMillis is null and workOrderCommentId = ?`) - .run(dateStringToInteger(commentForm.workOrderCommentDateString), timeStringToInteger(commentForm.workOrderCommentTimeString), commentForm.workOrderComment, requestSession.user.userName, rightNowMillis, commentForm.workOrderCommentId); + .run(dateStringToInteger(commentForm.workOrderCommentDateString), timeStringToInteger(commentForm.workOrderCommentTimeString), commentForm.workOrderComment, requestSession.user.userName, Date.now(), commentForm.workOrderCommentId); database.release(); return result.changes > 0; } diff --git a/helpers/lotOccupancyDB/updateWorkOrderComment.ts b/helpers/lotOccupancyDB/updateWorkOrderComment.ts index 43c3f184..49dcaa10 100644 --- a/helpers/lotOccupancyDB/updateWorkOrderComment.ts +++ b/helpers/lotOccupancyDB/updateWorkOrderComment.ts @@ -18,8 +18,6 @@ export async function updateWorkOrderComment( commentForm: UpdateWorkOrderCommentForm, requestSession: recordTypes.PartialSession ): Promise { - const rightNowMillis = Date.now() - const database = await acquireConnection() const result = database @@ -38,7 +36,7 @@ export async function updateWorkOrderComment( timeStringToInteger(commentForm.workOrderCommentTimeString), commentForm.workOrderComment, requestSession.user!.userName, - rightNowMillis, + Date.now(), commentForm.workOrderCommentId ) diff --git a/helpers/lotOccupancyDB/updateWorkOrderMilestone.js b/helpers/lotOccupancyDB/updateWorkOrderMilestone.js index 4df72701..7941dffb 100644 --- a/helpers/lotOccupancyDB/updateWorkOrderMilestone.js +++ b/helpers/lotOccupancyDB/updateWorkOrderMilestone.js @@ -1,7 +1,6 @@ import { acquireConnection } from './pool.js'; import { dateStringToInteger, timeStringToInteger } from '@cityssm/utils-datetime'; export async function updateWorkOrderMilestone(milestoneForm, requestSession) { - const rightNow = new Date(); const database = await acquireConnection(); const result = database .prepare(`update WorkOrderMilestones @@ -18,7 +17,7 @@ export async function updateWorkOrderMilestone(milestoneForm, requestSession) { ? 0 : dateStringToInteger(milestoneForm.workOrderMilestoneDateString), (milestoneForm.workOrderMilestoneTimeString ?? '') === '' ? 0 - : timeStringToInteger(milestoneForm.workOrderMilestoneTimeString), milestoneForm.workOrderMilestoneDescription, requestSession.user.userName, rightNow.getTime(), milestoneForm.workOrderMilestoneId); + : timeStringToInteger(milestoneForm.workOrderMilestoneTimeString), milestoneForm.workOrderMilestoneDescription, requestSession.user.userName, Date.now(), milestoneForm.workOrderMilestoneId); database.release(); return result.changes > 0; } diff --git a/helpers/lotOccupancyDB/updateWorkOrderMilestone.ts b/helpers/lotOccupancyDB/updateWorkOrderMilestone.ts index 02850e35..c309dd47 100644 --- a/helpers/lotOccupancyDB/updateWorkOrderMilestone.ts +++ b/helpers/lotOccupancyDB/updateWorkOrderMilestone.ts @@ -19,8 +19,6 @@ export async function updateWorkOrderMilestone( milestoneForm: UpdateWorkOrderMilestoneForm, requestSession: recordTypes.PartialSession ): Promise { - const rightNow = new Date() - const database = await acquireConnection() const result = database @@ -47,7 +45,7 @@ export async function updateWorkOrderMilestone( milestoneForm.workOrderMilestoneDescription, requestSession.user!.userName, - rightNow.getTime(), + Date.now(), milestoneForm.workOrderMilestoneId )