linting
parent
e5cc63fe87
commit
3eb4958f65
|
|
@ -13,7 +13,8 @@ export function addRecord(recordTable, recordName, orderNumber, requestSession)
|
||||||
const rightNowMillis = Date.now();
|
const rightNowMillis = Date.now();
|
||||||
const result = database
|
const result = database
|
||||||
.prepare(`insert into ${recordTable} (
|
.prepare(`insert into ${recordTable} (
|
||||||
${recordNameColumns.get(recordTable)}, orderNumber,
|
${recordNameColumns.get(recordTable)},
|
||||||
|
orderNumber,
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
values (?, ?, ?, ?, ?, ?)`)
|
values (?, ?, ?, ?, ?, ?)`)
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,8 @@ export function addRecord(
|
||||||
const result = database
|
const result = database
|
||||||
.prepare(
|
.prepare(
|
||||||
`insert into ${recordTable} (
|
`insert into ${recordTable} (
|
||||||
${recordNameColumns.get(recordTable)!}, orderNumber,
|
${recordNameColumns.get(recordTable)!},
|
||||||
|
orderNumber,
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
values (?, ?, ?, ?, ?, ?)`
|
values (?, ?, ?, ?, ?, ?)`
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,12 @@ export function addWorkOrderComment(workOrderCommentForm, requestSession) {
|
||||||
const rightNow = new Date();
|
const rightNow = new Date();
|
||||||
const result = database
|
const result = database
|
||||||
.prepare(`insert into WorkOrderComments (
|
.prepare(`insert into WorkOrderComments (
|
||||||
workOrderId,
|
workOrderId,
|
||||||
workOrderCommentDate, workOrderCommentTime,
|
workOrderCommentDate, workOrderCommentTime,
|
||||||
workOrderComment,
|
workOrderComment,
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
values (?, ?, ?, ?, ?, ?, ?, ?)`)
|
values (?, ?, ?, ?, ?, ?, ?, ?)`)
|
||||||
.run(workOrderCommentForm.workOrderId, dateTimeFunctions.dateToInteger(rightNow), dateTimeFunctions.dateToTimeInteger(rightNow), workOrderCommentForm.workOrderComment, requestSession.user.userName, rightNow.getTime(), requestSession.user.userName, rightNow.getTime());
|
.run(workOrderCommentForm.workOrderId, dateTimeFunctions.dateToInteger(rightNow), dateTimeFunctions.dateToTimeInteger(rightNow), workOrderCommentForm.workOrderComment, requestSession.user.userName, rightNow.getTime(), requestSession.user.userName, rightNow.getTime());
|
||||||
database.close();
|
database.close();
|
||||||
return result.lastInsertRowid;
|
return result.lastInsertRowid;
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,12 @@ export function addWorkOrderComment(
|
||||||
const result = database
|
const result = database
|
||||||
.prepare(
|
.prepare(
|
||||||
`insert into WorkOrderComments (
|
`insert into WorkOrderComments (
|
||||||
workOrderId,
|
workOrderId,
|
||||||
workOrderCommentDate, workOrderCommentTime,
|
workOrderCommentDate, workOrderCommentTime,
|
||||||
workOrderComment,
|
workOrderComment,
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
values (?, ?, ?, ?, ?, ?, ?, ?)`
|
values (?, ?, ?, ?, ?, ?, ?, ?)`
|
||||||
)
|
)
|
||||||
.run(
|
.run(
|
||||||
workOrderCommentForm.workOrderId,
|
workOrderCommentForm.workOrderId,
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ export function addWorkOrderLot(workOrderLotForm, requestSession) {
|
||||||
else {
|
else {
|
||||||
database
|
database
|
||||||
.prepare(`insert into WorkOrderLots (
|
.prepare(`insert into WorkOrderLots (
|
||||||
workOrderId, lotId,
|
workOrderId, lotId,
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
values (?, ?, ?, ?, ?, ?)`)
|
values (?, ?, ?, ?, ?, ?)`)
|
||||||
.run(workOrderLotForm.workOrderId, workOrderLotForm.lotId, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
.run(workOrderLotForm.workOrderId, workOrderLotForm.lotId, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
||||||
}
|
}
|
||||||
database.close();
|
database.close();
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,10 @@ export function addWorkOrderLot(
|
||||||
database
|
database
|
||||||
.prepare(
|
.prepare(
|
||||||
`insert into WorkOrderLots (
|
`insert into WorkOrderLots (
|
||||||
workOrderId, lotId,
|
workOrderId, lotId,
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
values (?, ?, ?, ?, ?, ?)`
|
values (?, ?, ?, ?, ?, ?)`
|
||||||
)
|
)
|
||||||
.run(
|
.run(
|
||||||
workOrderLotForm.workOrderId,
|
workOrderLotForm.workOrderId,
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,10 @@ export function copyLotOccupancy(oldLotOccupancyId, requestSession) {
|
||||||
for (const occupancyField of oldLotOccupancy.lotOccupancyFields ?? []) {
|
for (const occupancyField of oldLotOccupancy.lotOccupancyFields ?? []) {
|
||||||
database
|
database
|
||||||
.prepare(`insert into LotOccupancyFields (
|
.prepare(`insert into LotOccupancyFields (
|
||||||
lotOccupancyId, occupancyTypeFieldId, lotOccupancyFieldValue,
|
lotOccupancyId, occupancyTypeFieldId, lotOccupancyFieldValue,
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
values (?, ?, ?, ?, ?, ?, ?)`)
|
values (?, ?, ?, ?, ?, ?, ?)`)
|
||||||
.run(newLotOccupancyId, occupancyField.occupancyTypeFieldId, occupancyField.lotOccupancyFieldValue, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
.run(newLotOccupancyId, occupancyField.occupancyTypeFieldId, occupancyField.lotOccupancyFieldValue, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
||||||
}
|
}
|
||||||
for (const occupant of oldLotOccupancy.lotOccupancyOccupants ?? []) {
|
for (const occupant of oldLotOccupancy.lotOccupancyOccupants ?? []) {
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,10 @@ export function copyLotOccupancy(
|
||||||
database
|
database
|
||||||
.prepare(
|
.prepare(
|
||||||
`insert into LotOccupancyFields (
|
`insert into LotOccupancyFields (
|
||||||
lotOccupancyId, occupancyTypeFieldId, lotOccupancyFieldValue,
|
lotOccupancyId, occupancyTypeFieldId, lotOccupancyFieldValue,
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
values (?, ?, ?, ?, ?, ?, ?)`
|
values (?, ?, ?, ?, ?, ?, ?)`
|
||||||
)
|
)
|
||||||
.run(
|
.run(
|
||||||
newLotOccupancyId,
|
newLotOccupancyId,
|
||||||
|
|
|
||||||
|
|
@ -45,18 +45,18 @@ export function deleteRecord(recordTable, recordId, requestSession) {
|
||||||
const rightNowMillis = Date.now();
|
const rightNowMillis = Date.now();
|
||||||
const result = database
|
const result = database
|
||||||
.prepare(`update ${recordTable}
|
.prepare(`update ${recordTable}
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where ${recordIdColumns.get(recordTable)} = ?
|
where ${recordIdColumns.get(recordTable)} = ?
|
||||||
and recordDelete_timeMillis is null`)
|
and recordDelete_timeMillis is null`)
|
||||||
.run(requestSession.user.userName, rightNowMillis, recordId);
|
.run(requestSession.user.userName, rightNowMillis, recordId);
|
||||||
for (const relatedTable of relatedTables.get(recordTable) ?? []) {
|
for (const relatedTable of relatedTables.get(recordTable) ?? []) {
|
||||||
database
|
database
|
||||||
.prepare(`update ${relatedTable}
|
.prepare(`update ${relatedTable}
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where ${recordIdColumns.get(recordTable)} = ?
|
where ${recordIdColumns.get(recordTable)} = ?
|
||||||
and recordDelete_timeMillis is null`)
|
and recordDelete_timeMillis is null`)
|
||||||
.run(requestSession.user.userName, rightNowMillis, recordId);
|
.run(requestSession.user.userName, rightNowMillis, recordId);
|
||||||
}
|
}
|
||||||
database.close();
|
database.close();
|
||||||
|
|
|
||||||
|
|
@ -79,10 +79,10 @@ export function deleteRecord(
|
||||||
const result = database
|
const result = database
|
||||||
.prepare(
|
.prepare(
|
||||||
`update ${recordTable}
|
`update ${recordTable}
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where ${recordIdColumns.get(recordTable)!} = ?
|
where ${recordIdColumns.get(recordTable)!} = ?
|
||||||
and recordDelete_timeMillis is null`
|
and recordDelete_timeMillis is null`
|
||||||
)
|
)
|
||||||
.run(requestSession.user!.userName, rightNowMillis, recordId)
|
.run(requestSession.user!.userName, rightNowMillis, recordId)
|
||||||
|
|
||||||
|
|
@ -90,10 +90,10 @@ export function deleteRecord(
|
||||||
database
|
database
|
||||||
.prepare(
|
.prepare(
|
||||||
`update ${relatedTable}
|
`update ${relatedTable}
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where ${recordIdColumns.get(recordTable)!} = ?
|
where ${recordIdColumns.get(recordTable)!} = ?
|
||||||
and recordDelete_timeMillis is null`
|
and recordDelete_timeMillis is null`
|
||||||
)
|
)
|
||||||
.run(requestSession.user!.userName, rightNowMillis, recordId)
|
.run(requestSession.user!.userName, rightNowMillis, recordId)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,18 +83,18 @@ export function getLotOccupancies(filters, options, connectedDatabase) {
|
||||||
if (count !== 0) {
|
if (count !== 0) {
|
||||||
lotOccupancies = database
|
lotOccupancies = database
|
||||||
.prepare(`select o.lotOccupancyId,
|
.prepare(`select o.lotOccupancyId,
|
||||||
o.occupancyTypeId, t.occupancyType,
|
o.occupancyTypeId, t.occupancyType,
|
||||||
o.lotId, lt.lotType, l.lotName,
|
o.lotId, lt.lotType, l.lotName,
|
||||||
l.mapId, m.mapName,
|
l.mapId, m.mapName,
|
||||||
o.occupancyStartDate, userFn_dateIntegerToString(o.occupancyStartDate) as occupancyStartDateString,
|
o.occupancyStartDate, userFn_dateIntegerToString(o.occupancyStartDate) as occupancyStartDateString,
|
||||||
o.occupancyEndDate, userFn_dateIntegerToString(o.occupancyEndDate) as occupancyEndDateString
|
o.occupancyEndDate, userFn_dateIntegerToString(o.occupancyEndDate) as occupancyEndDateString
|
||||||
from LotOccupancies o
|
from LotOccupancies o
|
||||||
left join OccupancyTypes t on o.occupancyTypeId = t.occupancyTypeId
|
left join OccupancyTypes t on o.occupancyTypeId = t.occupancyTypeId
|
||||||
left join Lots l on o.lotId = l.lotId
|
left join Lots l on o.lotId = l.lotId
|
||||||
left join LotTypes lt on l.lotTypeId = lt.lotTypeId
|
left join LotTypes lt on l.lotTypeId = lt.lotTypeId
|
||||||
left join Maps m on l.mapId = m.mapId
|
left join Maps m on l.mapId = m.mapId
|
||||||
${sqlWhereClause}
|
${sqlWhereClause}
|
||||||
order by o.occupancyStartDate desc, ifnull(o.occupancyEndDate, 99999999) desc, l.lotName, o.lotId, o.lotOccupancyId desc` +
|
order by o.occupancyStartDate desc, ifnull(o.occupancyEndDate, 99999999) desc, l.lotName, o.lotId, o.lotOccupancyId desc` +
|
||||||
(isLimited ? ` limit ${options.limit} offset ${options.offset}` : ''))
|
(isLimited ? ` limit ${options.limit} offset ${options.offset}` : ''))
|
||||||
.all(sqlParameters);
|
.all(sqlParameters);
|
||||||
if (!isLimited) {
|
if (!isLimited) {
|
||||||
|
|
|
||||||
|
|
@ -167,18 +167,18 @@ export function getLotOccupancies(
|
||||||
lotOccupancies = database
|
lotOccupancies = database
|
||||||
.prepare(
|
.prepare(
|
||||||
`select o.lotOccupancyId,
|
`select o.lotOccupancyId,
|
||||||
o.occupancyTypeId, t.occupancyType,
|
o.occupancyTypeId, t.occupancyType,
|
||||||
o.lotId, lt.lotType, l.lotName,
|
o.lotId, lt.lotType, l.lotName,
|
||||||
l.mapId, m.mapName,
|
l.mapId, m.mapName,
|
||||||
o.occupancyStartDate, userFn_dateIntegerToString(o.occupancyStartDate) as occupancyStartDateString,
|
o.occupancyStartDate, userFn_dateIntegerToString(o.occupancyStartDate) as occupancyStartDateString,
|
||||||
o.occupancyEndDate, userFn_dateIntegerToString(o.occupancyEndDate) as occupancyEndDateString
|
o.occupancyEndDate, userFn_dateIntegerToString(o.occupancyEndDate) as occupancyEndDateString
|
||||||
from LotOccupancies o
|
from LotOccupancies o
|
||||||
left join OccupancyTypes t on o.occupancyTypeId = t.occupancyTypeId
|
left join OccupancyTypes t on o.occupancyTypeId = t.occupancyTypeId
|
||||||
left join Lots l on o.lotId = l.lotId
|
left join Lots l on o.lotId = l.lotId
|
||||||
left join LotTypes lt on l.lotTypeId = lt.lotTypeId
|
left join LotTypes lt on l.lotTypeId = lt.lotTypeId
|
||||||
left join Maps m on l.mapId = m.mapId
|
left join Maps m on l.mapId = m.mapId
|
||||||
${sqlWhereClause}
|
${sqlWhereClause}
|
||||||
order by o.occupancyStartDate desc, ifnull(o.occupancyEndDate, 99999999) desc, l.lotName, o.lotId, o.lotOccupancyId desc` +
|
order by o.occupancyStartDate desc, ifnull(o.occupancyEndDate, 99999999) desc, l.lotName, o.lotId, o.lotOccupancyId desc` +
|
||||||
(isLimited ? ` limit ${options.limit} offset ${options.offset}` : '')
|
(isLimited ? ` limit ${options.limit} offset ${options.offset}` : '')
|
||||||
)
|
)
|
||||||
.all(sqlParameters)
|
.all(sqlParameters)
|
||||||
|
|
|
||||||
|
|
@ -10,14 +10,14 @@ export function getLotOccupancyComments(lotOccupancyId, connectedDatabase) {
|
||||||
database.function('userFn_timeIntegerToString', timeIntegerToString);
|
database.function('userFn_timeIntegerToString', timeIntegerToString);
|
||||||
const lotComments = database
|
const lotComments = database
|
||||||
.prepare(`select lotOccupancyCommentId,
|
.prepare(`select lotOccupancyCommentId,
|
||||||
lotOccupancyCommentDate, userFn_dateIntegerToString(lotOccupancyCommentDate) as lotOccupancyCommentDateString,
|
lotOccupancyCommentDate, userFn_dateIntegerToString(lotOccupancyCommentDate) as lotOccupancyCommentDateString,
|
||||||
lotOccupancyCommentTime, userFn_timeIntegerToString(lotOccupancyCommentTime) as lotOccupancyCommentTimeString,
|
lotOccupancyCommentTime, userFn_timeIntegerToString(lotOccupancyCommentTime) as lotOccupancyCommentTimeString,
|
||||||
lotOccupancyComment,
|
lotOccupancyComment,
|
||||||
recordCreate_userName, recordUpdate_userName
|
recordCreate_userName, recordUpdate_userName
|
||||||
from LotOccupancyComments
|
from LotOccupancyComments
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and lotOccupancyId = ?
|
and lotOccupancyId = ?
|
||||||
order by lotOccupancyCommentDate desc, lotOccupancyCommentTime desc, lotOccupancyCommentId desc`)
|
order by lotOccupancyCommentDate desc, lotOccupancyCommentTime desc, lotOccupancyCommentId desc`)
|
||||||
.all(lotOccupancyId);
|
.all(lotOccupancyId);
|
||||||
if (!connectedDatabase) {
|
if (!connectedDatabase) {
|
||||||
database.close();
|
database.close();
|
||||||
|
|
|
||||||
|
|
@ -25,14 +25,14 @@ export function getLotOccupancyComments(
|
||||||
const lotComments = database
|
const lotComments = database
|
||||||
.prepare(
|
.prepare(
|
||||||
`select lotOccupancyCommentId,
|
`select lotOccupancyCommentId,
|
||||||
lotOccupancyCommentDate, userFn_dateIntegerToString(lotOccupancyCommentDate) as lotOccupancyCommentDateString,
|
lotOccupancyCommentDate, userFn_dateIntegerToString(lotOccupancyCommentDate) as lotOccupancyCommentDateString,
|
||||||
lotOccupancyCommentTime, userFn_timeIntegerToString(lotOccupancyCommentTime) as lotOccupancyCommentTimeString,
|
lotOccupancyCommentTime, userFn_timeIntegerToString(lotOccupancyCommentTime) as lotOccupancyCommentTimeString,
|
||||||
lotOccupancyComment,
|
lotOccupancyComment,
|
||||||
recordCreate_userName, recordUpdate_userName
|
recordCreate_userName, recordUpdate_userName
|
||||||
from LotOccupancyComments
|
from LotOccupancyComments
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and lotOccupancyId = ?
|
and lotOccupancyId = ?
|
||||||
order by lotOccupancyCommentDate desc, lotOccupancyCommentTime desc, lotOccupancyCommentId desc`
|
order by lotOccupancyCommentDate desc, lotOccupancyCommentTime desc, lotOccupancyCommentId desc`
|
||||||
)
|
)
|
||||||
.all(lotOccupancyId)
|
.all(lotOccupancyId)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,18 +7,18 @@ export function getLotOccupancyOccupants(lotOccupancyId, connectedDatabase) {
|
||||||
});
|
});
|
||||||
const lotOccupancyOccupants = database
|
const lotOccupancyOccupants = database
|
||||||
.prepare(`select o.lotOccupancyId, o.lotOccupantIndex,
|
.prepare(`select o.lotOccupancyId, o.lotOccupantIndex,
|
||||||
o.occupantName,
|
o.occupantName,
|
||||||
o.occupantAddress1, o.occupantAddress2,
|
o.occupantAddress1, o.occupantAddress2,
|
||||||
o.occupantCity, o.occupantProvince, o.occupantPostalCode,
|
o.occupantCity, o.occupantProvince, o.occupantPostalCode,
|
||||||
o.occupantPhoneNumber, o.occupantEmailAddress,
|
o.occupantPhoneNumber, o.occupantEmailAddress,
|
||||||
o.occupantComment,
|
o.occupantComment,
|
||||||
o.lotOccupantTypeId, t.lotOccupantType,
|
o.lotOccupantTypeId, t.lotOccupantType,
|
||||||
t.fontAwesomeIconClass
|
t.fontAwesomeIconClass
|
||||||
from LotOccupancyOccupants o
|
from LotOccupancyOccupants o
|
||||||
left join LotOccupantTypes t on o.lotOccupantTypeId = t.lotOccupantTypeId
|
left join LotOccupantTypes t on o.lotOccupantTypeId = t.lotOccupantTypeId
|
||||||
where o.recordDelete_timeMillis is null
|
where o.recordDelete_timeMillis is null
|
||||||
and o.lotOccupancyId = ?
|
and o.lotOccupancyId = ?
|
||||||
order by t.orderNumber, t.lotOccupantType, o.occupantName, o.lotOccupantIndex`)
|
order by t.orderNumber, t.lotOccupantType, o.occupantName, o.lotOccupantIndex`)
|
||||||
.all(lotOccupancyId);
|
.all(lotOccupancyId);
|
||||||
if (!connectedDatabase) {
|
if (!connectedDatabase) {
|
||||||
database.close();
|
database.close();
|
||||||
|
|
|
||||||
|
|
@ -17,18 +17,18 @@ export function getLotOccupancyOccupants(
|
||||||
const lotOccupancyOccupants: recordTypes.LotOccupancyOccupant[] = database
|
const lotOccupancyOccupants: recordTypes.LotOccupancyOccupant[] = database
|
||||||
.prepare(
|
.prepare(
|
||||||
`select o.lotOccupancyId, o.lotOccupantIndex,
|
`select o.lotOccupancyId, o.lotOccupantIndex,
|
||||||
o.occupantName,
|
o.occupantName,
|
||||||
o.occupantAddress1, o.occupantAddress2,
|
o.occupantAddress1, o.occupantAddress2,
|
||||||
o.occupantCity, o.occupantProvince, o.occupantPostalCode,
|
o.occupantCity, o.occupantProvince, o.occupantPostalCode,
|
||||||
o.occupantPhoneNumber, o.occupantEmailAddress,
|
o.occupantPhoneNumber, o.occupantEmailAddress,
|
||||||
o.occupantComment,
|
o.occupantComment,
|
||||||
o.lotOccupantTypeId, t.lotOccupantType,
|
o.lotOccupantTypeId, t.lotOccupantType,
|
||||||
t.fontAwesomeIconClass
|
t.fontAwesomeIconClass
|
||||||
from LotOccupancyOccupants o
|
from LotOccupancyOccupants o
|
||||||
left join LotOccupantTypes t on o.lotOccupantTypeId = t.lotOccupantTypeId
|
left join LotOccupantTypes t on o.lotOccupantTypeId = t.lotOccupantTypeId
|
||||||
where o.recordDelete_timeMillis is null
|
where o.recordDelete_timeMillis is null
|
||||||
and o.lotOccupancyId = ?
|
and o.lotOccupancyId = ?
|
||||||
order by t.orderNumber, t.lotOccupantType, o.occupantName, o.lotOccupantIndex`
|
order by t.orderNumber, t.lotOccupantType, o.occupantName, o.lotOccupantIndex`
|
||||||
)
|
)
|
||||||
.all(lotOccupancyId)
|
.all(lotOccupancyId)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,13 @@ export function getLotOccupancyTransactions(lotOccupancyId, connectedDatabase) {
|
||||||
database.function('userFn_timeIntegerToString', timeIntegerToString);
|
database.function('userFn_timeIntegerToString', timeIntegerToString);
|
||||||
const lotOccupancyTransactions = database
|
const lotOccupancyTransactions = database
|
||||||
.prepare(`select lotOccupancyId, transactionIndex,
|
.prepare(`select lotOccupancyId, transactionIndex,
|
||||||
transactionDate, userFn_dateIntegerToString(transactionDate) as transactionDateString,
|
transactionDate, userFn_dateIntegerToString(transactionDate) as transactionDateString,
|
||||||
transactionTime, userFn_timeIntegerToString(transactionTime) as transactionTimeString,
|
transactionTime, userFn_timeIntegerToString(transactionTime) as transactionTimeString,
|
||||||
transactionAmount, externalReceiptNumber, transactionNote
|
transactionAmount, externalReceiptNumber, transactionNote
|
||||||
from LotOccupancyTransactions
|
from LotOccupancyTransactions
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and lotOccupancyId = ?
|
and lotOccupancyId = ?
|
||||||
order by transactionDate, transactionTime, transactionIndex`)
|
order by transactionDate, transactionTime, transactionIndex`)
|
||||||
.all(lotOccupancyId);
|
.all(lotOccupancyId);
|
||||||
if (!connectedDatabase) {
|
if (!connectedDatabase) {
|
||||||
database.close();
|
database.close();
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,13 @@ export function getLotOccupancyTransactions(
|
||||||
database
|
database
|
||||||
.prepare(
|
.prepare(
|
||||||
`select lotOccupancyId, transactionIndex,
|
`select lotOccupancyId, transactionIndex,
|
||||||
transactionDate, userFn_dateIntegerToString(transactionDate) as transactionDateString,
|
transactionDate, userFn_dateIntegerToString(transactionDate) as transactionDateString,
|
||||||
transactionTime, userFn_timeIntegerToString(transactionTime) as transactionTimeString,
|
transactionTime, userFn_timeIntegerToString(transactionTime) as transactionTimeString,
|
||||||
transactionAmount, externalReceiptNumber, transactionNote
|
transactionAmount, externalReceiptNumber, transactionNote
|
||||||
from LotOccupancyTransactions
|
from LotOccupancyTransactions
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and lotOccupancyId = ?
|
and lotOccupancyId = ?
|
||||||
order by transactionDate, transactionTime, transactionIndex`
|
order by transactionDate, transactionTime, transactionIndex`
|
||||||
)
|
)
|
||||||
.all(lotOccupancyId)
|
.all(lotOccupancyId)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,19 +9,19 @@ function buildWhereClause(filters) {
|
||||||
const lotNameFilters = getLotNameWhereClause(filters.lotName, filters.lotNameSearchType ?? '', 'l');
|
const lotNameFilters = getLotNameWhereClause(filters.lotName, filters.lotNameSearchType ?? '', 'l');
|
||||||
sqlWhereClause += lotNameFilters.sqlWhereClause;
|
sqlWhereClause += lotNameFilters.sqlWhereClause;
|
||||||
sqlParameters.push(...lotNameFilters.sqlParameters);
|
sqlParameters.push(...lotNameFilters.sqlParameters);
|
||||||
if (filters.mapId) {
|
if ((filters.mapId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.mapId = ?';
|
sqlWhereClause += ' and l.mapId = ?';
|
||||||
sqlParameters.push(filters.mapId);
|
sqlParameters.push(filters.mapId);
|
||||||
}
|
}
|
||||||
if (filters.lotTypeId) {
|
if ((filters.lotTypeId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.lotTypeId = ?';
|
sqlWhereClause += ' and l.lotTypeId = ?';
|
||||||
sqlParameters.push(filters.lotTypeId);
|
sqlParameters.push(filters.lotTypeId);
|
||||||
}
|
}
|
||||||
if (filters.lotStatusId) {
|
if ((filters.lotStatusId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.lotStatusId = ?';
|
sqlWhereClause += ' and l.lotStatusId = ?';
|
||||||
sqlParameters.push(filters.lotStatusId);
|
sqlParameters.push(filters.lotStatusId);
|
||||||
}
|
}
|
||||||
if (filters.occupancyStatus) {
|
if ((filters.occupancyStatus ?? '') !== '') {
|
||||||
if (filters.occupancyStatus === 'occupied') {
|
if (filters.occupancyStatus === 'occupied') {
|
||||||
sqlWhereClause += ' and lotOccupancyCount > 0';
|
sqlWhereClause += ' and lotOccupancyCount > 0';
|
||||||
}
|
}
|
||||||
|
|
@ -30,7 +30,7 @@ function buildWhereClause(filters) {
|
||||||
' and (lotOccupancyCount is null or lotOccupancyCount = 0)';
|
' and (lotOccupancyCount is null or lotOccupancyCount = 0)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (filters.workOrderId) {
|
if ((filters.workOrderId ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause +=
|
||||||
' and l.lotId in (select lotId from WorkOrderLots where recordDelete_timeMillis is null and workOrderId = ?)';
|
' and l.lotId in (select lotId from WorkOrderLots where recordDelete_timeMillis is null and workOrderId = ?)';
|
||||||
sqlParameters.push(filters.workOrderId);
|
sqlParameters.push(filters.workOrderId);
|
||||||
|
|
@ -50,20 +50,16 @@ export function getLots(filters, options, connectedDatabase) {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
if (options.limit !== -1) {
|
if (options.limit !== -1) {
|
||||||
count = database
|
count = database
|
||||||
.prepare('select count(*) as recordCount' +
|
.prepare(`select count(*) as recordCount
|
||||||
' from Lots l' +
|
from Lots l
|
||||||
(' left join (' +
|
left join (
|
||||||
'select lotId, count(lotOccupancyId) as lotOccupancyCount' +
|
select lotId, count(lotOccupancyId) as lotOccupancyCount from LotOccupancies
|
||||||
' from LotOccupancies' +
|
where recordDelete_timeMillis is null
|
||||||
' where recordDelete_timeMillis is null' +
|
and occupancyStartDate <= ${currentDate}
|
||||||
' and occupancyStartDate <= ' +
|
and (occupancyEndDate is null or occupancyEndDate >= ${currentDate})
|
||||||
currentDate +
|
group by lotId
|
||||||
' and (occupancyEndDate is null or occupancyEndDate >= ' +
|
) o on l.lotId = o.lotId
|
||||||
currentDate +
|
${sqlWhereClause}`)
|
||||||
')' +
|
|
||||||
' group by lotId' +
|
|
||||||
') o on l.lotId = o.lotId') +
|
|
||||||
sqlWhereClause)
|
|
||||||
.get(sqlParameters).recordCount;
|
.get(sqlParameters).recordCount;
|
||||||
}
|
}
|
||||||
let lots = [];
|
let lots = [];
|
||||||
|
|
|
||||||
|
|
@ -41,22 +41,22 @@ function buildWhereClause(filters: GetLotsFilters): {
|
||||||
sqlWhereClause += lotNameFilters.sqlWhereClause
|
sqlWhereClause += lotNameFilters.sqlWhereClause
|
||||||
sqlParameters.push(...lotNameFilters.sqlParameters)
|
sqlParameters.push(...lotNameFilters.sqlParameters)
|
||||||
|
|
||||||
if (filters.mapId) {
|
if ((filters.mapId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.mapId = ?'
|
sqlWhereClause += ' and l.mapId = ?'
|
||||||
sqlParameters.push(filters.mapId)
|
sqlParameters.push(filters.mapId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.lotTypeId) {
|
if ((filters.lotTypeId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.lotTypeId = ?'
|
sqlWhereClause += ' and l.lotTypeId = ?'
|
||||||
sqlParameters.push(filters.lotTypeId)
|
sqlParameters.push(filters.lotTypeId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.lotStatusId) {
|
if ((filters.lotStatusId ?? '') !== '') {
|
||||||
sqlWhereClause += ' and l.lotStatusId = ?'
|
sqlWhereClause += ' and l.lotStatusId = ?'
|
||||||
sqlParameters.push(filters.lotStatusId)
|
sqlParameters.push(filters.lotStatusId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.occupancyStatus) {
|
if ((filters.occupancyStatus ?? '') !== '') {
|
||||||
if (filters.occupancyStatus === 'occupied') {
|
if (filters.occupancyStatus === 'occupied') {
|
||||||
sqlWhereClause += ' and lotOccupancyCount > 0'
|
sqlWhereClause += ' and lotOccupancyCount > 0'
|
||||||
} else if (filters.occupancyStatus === 'unoccupied') {
|
} else if (filters.occupancyStatus === 'unoccupied') {
|
||||||
|
|
@ -65,7 +65,7 @@ function buildWhereClause(filters: GetLotsFilters): {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.workOrderId) {
|
if ((filters.workOrderId ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause +=
|
||||||
' and l.lotId in (select lotId from WorkOrderLots where recordDelete_timeMillis is null and workOrderId = ?)'
|
' and l.lotId in (select lotId from WorkOrderLots where recordDelete_timeMillis is null and workOrderId = ?)'
|
||||||
sqlParameters.push(filters.workOrderId)
|
sqlParameters.push(filters.workOrderId)
|
||||||
|
|
@ -100,20 +100,16 @@ export function getLots(
|
||||||
if (options.limit !== -1) {
|
if (options.limit !== -1) {
|
||||||
count = database
|
count = database
|
||||||
.prepare(
|
.prepare(
|
||||||
'select count(*) as recordCount' +
|
`select count(*) as recordCount
|
||||||
' from Lots l' +
|
from Lots l
|
||||||
(' left join (' +
|
left join (
|
||||||
'select lotId, count(lotOccupancyId) as lotOccupancyCount' +
|
select lotId, count(lotOccupancyId) as lotOccupancyCount from LotOccupancies
|
||||||
' from LotOccupancies' +
|
where recordDelete_timeMillis is null
|
||||||
' where recordDelete_timeMillis is null' +
|
and occupancyStartDate <= ${currentDate}
|
||||||
' and occupancyStartDate <= ' +
|
and (occupancyEndDate is null or occupancyEndDate >= ${currentDate})
|
||||||
currentDate +
|
group by lotId
|
||||||
' and (occupancyEndDate is null or occupancyEndDate >= ' +
|
) o on l.lotId = o.lotId
|
||||||
currentDate +
|
${sqlWhereClause}`
|
||||||
')' +
|
|
||||||
' group by lotId' +
|
|
||||||
') o on l.lotId = o.lotId') +
|
|
||||||
sqlWhereClause
|
|
||||||
)
|
)
|
||||||
.get(sqlParameters).recordCount
|
.get(sqlParameters).recordCount
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ export function getMaps() {
|
||||||
ifnull(l.lotCount,0) as lotCount
|
ifnull(l.lotCount,0) as lotCount
|
||||||
from Maps m
|
from Maps m
|
||||||
left join (
|
left join (
|
||||||
select mapId, count(lotId) as lotCount
|
select mapId, count(lotId) as lotCount
|
||||||
from Lots
|
from Lots
|
||||||
where recordDelete_timeMillis is null group by mapId
|
where recordDelete_timeMillis is null group by mapId
|
||||||
) l on m.mapId = l.mapId
|
) l on m.mapId = l.mapId
|
||||||
where m.recordDelete_timeMillis is null order by m.mapName, m.mapId`)
|
where m.recordDelete_timeMillis is null order by m.mapName, m.mapId`)
|
||||||
.all();
|
.all();
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@ export function getMaps(): recordTypes.Map[] {
|
||||||
ifnull(l.lotCount,0) as lotCount
|
ifnull(l.lotCount,0) as lotCount
|
||||||
from Maps m
|
from Maps m
|
||||||
left join (
|
left join (
|
||||||
select mapId, count(lotId) as lotCount
|
select mapId, count(lotId) as lotCount
|
||||||
from Lots
|
from Lots
|
||||||
where recordDelete_timeMillis is null group by mapId
|
where recordDelete_timeMillis is null group by mapId
|
||||||
) l on m.mapId = l.mapId
|
) l on m.mapId = l.mapId
|
||||||
where m.recordDelete_timeMillis is null order by m.mapName, m.mapId`
|
where m.recordDelete_timeMillis is null order by m.mapName, m.mapId`
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -940,9 +940,11 @@ function importFromWorkOrderCSV() {
|
||||||
}
|
}
|
||||||
console.timeEnd('importFromWorkOrderCSV');
|
console.timeEnd('importFromWorkOrderCSV');
|
||||||
}
|
}
|
||||||
|
console.log('Started ' + (new Date().toLocaleString()));
|
||||||
console.time('importFromCsv');
|
console.time('importFromCsv');
|
||||||
purgeTables();
|
purgeTables();
|
||||||
importFromMasterCSV();
|
importFromMasterCSV();
|
||||||
importFromPrepaidCSV();
|
importFromPrepaidCSV();
|
||||||
importFromWorkOrderCSV();
|
importFromWorkOrderCSV();
|
||||||
console.timeEnd('importFromCsv');
|
console.timeEnd('importFromCsv');
|
||||||
|
console.log('Finished ' + (new Date().toLocaleString()));
|
||||||
|
|
|
||||||
|
|
@ -1639,6 +1639,7 @@ function importFromWorkOrderCSV(): void {
|
||||||
console.timeEnd('importFromWorkOrderCSV')
|
console.timeEnd('importFromWorkOrderCSV')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('Started ' + (new Date().toLocaleString()))
|
||||||
console.time('importFromCsv')
|
console.time('importFromCsv')
|
||||||
|
|
||||||
purgeTables()
|
purgeTables()
|
||||||
|
|
@ -1648,3 +1649,4 @@ importFromPrepaidCSV()
|
||||||
importFromWorkOrderCSV()
|
importFromWorkOrderCSV()
|
||||||
|
|
||||||
console.timeEnd('importFromCsv')
|
console.timeEnd('importFromCsv')
|
||||||
|
console.log('Finished ' + (new Date().toLocaleString()))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue