linting
parent
a7ce5a99cb
commit
c460d073e7
|
|
@ -14,7 +14,9 @@ export default function addBurialSiteTypeField(addForm, user) {
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
||||||
.run(addForm.burialSiteTypeId, addForm.burialSiteTypeField, addForm.fieldType ?? 'text', addForm.fieldValues ?? '', addForm.isRequired === '' ? 0 : 1, addForm.pattern ?? '', addForm.minLength ?? 0, addForm.maxLength ?? 100, addForm.orderNumber ?? -1, user.userName, rightNowMillis, user.userName, rightNowMillis);
|
.run(addForm.burialSiteTypeId, addForm.burialSiteTypeField, addForm.fieldType ?? 'text', addForm.fieldValues ?? '', addForm.isRequired === '' ? 0 : 1, addForm.pattern ?? '', addForm.minLength ?? 0,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
||||||
|
addForm.maxLength ?? 100, addForm.orderNumber ?? -1, user.userName, rightNowMillis, user.userName, rightNowMillis);
|
||||||
database.close();
|
database.close();
|
||||||
clearCacheByTableName('BurialSiteTypeFields');
|
clearCacheByTableName('BurialSiteTypeFields');
|
||||||
return result.lastInsertRowid;
|
return result.lastInsertRowid;
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ export default function addBurialSiteTypeField(
|
||||||
addForm.isRequired === '' ? 0 : 1,
|
addForm.isRequired === '' ? 0 : 1,
|
||||||
addForm.pattern ?? '',
|
addForm.pattern ?? '',
|
||||||
addForm.minLength ?? 0,
|
addForm.minLength ?? 0,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
||||||
addForm.maxLength ?? 100,
|
addForm.maxLength ?? 100,
|
||||||
addForm.orderNumber ?? -1,
|
addForm.orderNumber ?? -1,
|
||||||
user.userName,
|
user.userName,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
|
import { type DateString, type TimeString } from '@cityssm/utils-datetime';
|
||||||
export interface AddTransactionForm {
|
export interface AddTransactionForm {
|
||||||
contractId: number | string;
|
contractId: number | string;
|
||||||
transactionDateString?: string;
|
transactionDateString?: '' | DateString;
|
||||||
transactionTimeString?: string;
|
transactionTimeString?: '' | TimeString;
|
||||||
externalReceiptNumber: string;
|
externalReceiptNumber: string;
|
||||||
transactionAmount: number | string;
|
transactionAmount: number | string;
|
||||||
transactionNote: string;
|
transactionNote: string;
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,12 @@ export default function addContractTransaction(contractTransactionForm, user) {
|
||||||
transactionIndex = maxIndexResult.transactionIndex + 1;
|
transactionIndex = maxIndexResult.transactionIndex + 1;
|
||||||
}
|
}
|
||||||
const rightNow = new Date();
|
const rightNow = new Date();
|
||||||
const transactionDate = contractTransactionForm.transactionDateString
|
const transactionDate = contractTransactionForm.transactionDateString === ''
|
||||||
? dateStringToInteger(contractTransactionForm.transactionDateString)
|
? dateToInteger(rightNow)
|
||||||
: dateToInteger(rightNow);
|
: dateStringToInteger(contractTransactionForm.transactionDateString);
|
||||||
const transactionTime = contractTransactionForm.transactionTimeString
|
const transactionTime = contractTransactionForm.transactionTimeString === ''
|
||||||
? timeStringToInteger(contractTransactionForm.transactionTimeString)
|
? dateToTimeInteger(rightNow)
|
||||||
: dateToTimeInteger(rightNow);
|
: timeStringToInteger(contractTransactionForm.transactionTimeString);
|
||||||
database
|
database
|
||||||
.prepare(`insert into ContractTransactions (
|
.prepare(`insert into ContractTransactions (
|
||||||
contractId, transactionIndex,
|
contractId, transactionIndex,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
import {
|
import {
|
||||||
|
type DateString,
|
||||||
|
type TimeString,
|
||||||
dateStringToInteger,
|
dateStringToInteger,
|
||||||
dateToInteger,
|
dateToInteger,
|
||||||
dateToTimeInteger,
|
dateToTimeInteger,
|
||||||
|
|
@ -11,8 +13,8 @@ import { sunriseDB } from '../helpers/database.helpers.js'
|
||||||
export interface AddTransactionForm {
|
export interface AddTransactionForm {
|
||||||
contractId: number | string
|
contractId: number | string
|
||||||
|
|
||||||
transactionDateString?: string
|
transactionDateString?: '' | DateString
|
||||||
transactionTimeString?: string
|
transactionTimeString?: '' | TimeString
|
||||||
|
|
||||||
externalReceiptNumber: string
|
externalReceiptNumber: string
|
||||||
transactionAmount: number | string
|
transactionAmount: number | string
|
||||||
|
|
@ -45,13 +47,19 @@ export default function addContractTransaction(
|
||||||
|
|
||||||
const rightNow = new Date()
|
const rightNow = new Date()
|
||||||
|
|
||||||
const transactionDate = contractTransactionForm.transactionDateString
|
const transactionDate =
|
||||||
? dateStringToInteger(contractTransactionForm.transactionDateString)
|
contractTransactionForm.transactionDateString === ''
|
||||||
: dateToInteger(rightNow)
|
? dateToInteger(rightNow)
|
||||||
|
: dateStringToInteger(
|
||||||
|
contractTransactionForm.transactionDateString as DateString
|
||||||
|
)
|
||||||
|
|
||||||
const transactionTime = contractTransactionForm.transactionTimeString
|
const transactionTime =
|
||||||
? timeStringToInteger(contractTransactionForm.transactionTimeString)
|
contractTransactionForm.transactionTimeString === ''
|
||||||
: dateToTimeInteger(rightNow)
|
? dateToTimeInteger(rightNow)
|
||||||
|
: timeStringToInteger(
|
||||||
|
contractTransactionForm.transactionTimeString as TimeString
|
||||||
|
)
|
||||||
|
|
||||||
database
|
database
|
||||||
.prepare(
|
.prepare(
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
export interface AddContractTypeFieldForm {
|
export interface AddContractTypeFieldForm {
|
||||||
contractTypeId?: number | string;
|
contractTypeId?: number | string;
|
||||||
contractTypeField: string;
|
contractTypeField: string;
|
||||||
fieldValues?: string;
|
|
||||||
fieldType?: string;
|
fieldType?: string;
|
||||||
|
fieldValues?: string;
|
||||||
isRequired?: string;
|
isRequired?: string;
|
||||||
maxLength?: number | string;
|
maxLength?: number | string;
|
||||||
minLength?: number | string;
|
minLength?: number | string;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,9 @@ export default function addContractTypeField(addForm, user) {
|
||||||
recordCreate_userName, recordCreate_timeMillis,
|
recordCreate_userName, recordCreate_timeMillis,
|
||||||
recordUpdate_userName, recordUpdate_timeMillis)
|
recordUpdate_userName, recordUpdate_timeMillis)
|
||||||
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
||||||
.run(addForm.contractTypeId ?? undefined, addForm.contractTypeField, addForm.fieldType ?? 'text', addForm.fieldValues ?? '', addForm.isRequired === '' ? 0 : 1, addForm.pattern ?? '', addForm.minLength ?? 0, addForm.maxLength ?? 100, addForm.orderNumber ?? -1, user.userName, rightNowMillis, user.userName, rightNowMillis);
|
.run(addForm.contractTypeId ?? undefined, addForm.contractTypeField, addForm.fieldType ?? 'text', addForm.fieldValues ?? '', addForm.isRequired === '' ? 0 : 1, addForm.pattern ?? '', addForm.minLength ?? 0,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
||||||
|
addForm.maxLength ?? 100, addForm.orderNumber ?? -1, user.userName, rightNowMillis, user.userName, rightNowMillis);
|
||||||
database.close();
|
database.close();
|
||||||
clearCacheByTableName('ContractTypeFields');
|
clearCacheByTableName('ContractTypeFields');
|
||||||
return result.lastInsertRowid;
|
return result.lastInsertRowid;
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,11 @@ import { clearCacheByTableName } from '../helpers/functions.cache.js'
|
||||||
|
|
||||||
export interface AddContractTypeFieldForm {
|
export interface AddContractTypeFieldForm {
|
||||||
contractTypeId?: number | string
|
contractTypeId?: number | string
|
||||||
|
|
||||||
contractTypeField: string
|
contractTypeField: string
|
||||||
fieldValues?: string
|
|
||||||
fieldType?: string
|
fieldType?: string
|
||||||
|
fieldValues?: string
|
||||||
isRequired?: string
|
isRequired?: string
|
||||||
maxLength?: number | string
|
maxLength?: number | string
|
||||||
minLength?: number | string
|
minLength?: number | string
|
||||||
|
|
@ -43,6 +45,7 @@ export default function addContractTypeField(
|
||||||
addForm.isRequired === '' ? 0 : 1,
|
addForm.isRequired === '' ? 0 : 1,
|
||||||
addForm.pattern ?? '',
|
addForm.pattern ?? '',
|
||||||
addForm.minLength ?? 0,
|
addForm.minLength ?? 0,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
||||||
addForm.maxLength ?? 100,
|
addForm.maxLength ?? 100,
|
||||||
addForm.orderNumber ?? -1,
|
addForm.orderNumber ?? -1,
|
||||||
user.userName,
|
user.userName,
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,11 @@ export default function addContractTypePrint(addForm, user) {
|
||||||
let result = database
|
let result = database
|
||||||
.prepare(`update ContractTypePrints
|
.prepare(`update ContractTypePrints
|
||||||
set recordUpdate_userName = ?,
|
set recordUpdate_userName = ?,
|
||||||
recordUpdate_timeMillis = ?,
|
recordUpdate_timeMillis = ?,
|
||||||
recordDelete_userName = null,
|
recordDelete_userName = null,
|
||||||
recordDelete_timeMillis = null
|
recordDelete_timeMillis = null
|
||||||
where contractTypeId = ?
|
where contractTypeId = ?
|
||||||
and printEJS = ?`)
|
and printEJS = ?`)
|
||||||
.run(user.userName, rightNowMillis, addForm.contractTypeId, addForm.printEJS);
|
.run(user.userName, rightNowMillis, addForm.contractTypeId, addForm.printEJS);
|
||||||
if (result.changes === 0) {
|
if (result.changes === 0) {
|
||||||
result = database
|
result = database
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { clearCacheByTableName } from '../helpers/functions.cache.js'
|
||||||
export interface AddContractTypePrintForm {
|
export interface AddContractTypePrintForm {
|
||||||
contractTypeId: number | string
|
contractTypeId: number | string
|
||||||
printEJS: string
|
printEJS: string
|
||||||
|
|
||||||
orderNumber?: number
|
orderNumber?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -21,11 +22,11 @@ export default function addContractTypePrint(
|
||||||
.prepare(
|
.prepare(
|
||||||
`update ContractTypePrints
|
`update ContractTypePrints
|
||||||
set recordUpdate_userName = ?,
|
set recordUpdate_userName = ?,
|
||||||
recordUpdate_timeMillis = ?,
|
recordUpdate_timeMillis = ?,
|
||||||
recordDelete_userName = null,
|
recordDelete_userName = null,
|
||||||
recordDelete_timeMillis = null
|
recordDelete_timeMillis = null
|
||||||
where contractTypeId = ?
|
where contractTypeId = ?
|
||||||
and printEJS = ?`
|
and printEJS = ?`
|
||||||
)
|
)
|
||||||
.run(
|
.run(
|
||||||
user.userName,
|
user.userName,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
export interface AddForm {
|
export interface AddForm {
|
||||||
funeralHomeName: string;
|
|
||||||
funeralHomeKey: string;
|
funeralHomeKey: string;
|
||||||
|
funeralHomeName: string;
|
||||||
funeralHomeAddress1: string;
|
funeralHomeAddress1: string;
|
||||||
funeralHomeAddress2: string;
|
funeralHomeAddress2: string;
|
||||||
funeralHomeCity: string;
|
funeralHomeCity: string;
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ import sqlite from 'better-sqlite3'
|
||||||
import { sunriseDB } from '../helpers/database.helpers.js'
|
import { sunriseDB } from '../helpers/database.helpers.js'
|
||||||
|
|
||||||
export interface AddForm {
|
export interface AddForm {
|
||||||
funeralHomeName: string
|
|
||||||
funeralHomeKey: string
|
funeralHomeKey: string
|
||||||
|
funeralHomeName: string
|
||||||
|
|
||||||
funeralHomeAddress1: string
|
funeralHomeAddress1: string
|
||||||
funeralHomeAddress2: string
|
funeralHomeAddress2: string
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,12 @@ export default function addOrUpdateBurialSiteField(fieldForm, user, connectedDat
|
||||||
let result = database
|
let result = database
|
||||||
.prepare(`update BurialSiteFields
|
.prepare(`update BurialSiteFields
|
||||||
set fieldValue = ?,
|
set fieldValue = ?,
|
||||||
recordUpdate_userName = ?,
|
recordUpdate_userName = ?,
|
||||||
recordUpdate_timeMillis = ?,
|
recordUpdate_timeMillis = ?,
|
||||||
recordDelete_userName = null,
|
recordDelete_userName = null,
|
||||||
recordDelete_timeMillis = null
|
recordDelete_timeMillis = null
|
||||||
where burialSiteId = ?
|
where burialSiteId = ?
|
||||||
and burialSiteTypeFieldId = ?`)
|
and burialSiteTypeFieldId = ?`)
|
||||||
.run(fieldForm.fieldValue, user.userName, rightNowMillis, fieldForm.burialSiteId, fieldForm.burialSiteTypeFieldId);
|
.run(fieldForm.fieldValue, user.userName, rightNowMillis, fieldForm.burialSiteId, fieldForm.burialSiteTypeFieldId);
|
||||||
if (result.changes === 0) {
|
if (result.changes === 0) {
|
||||||
result = database
|
result = database
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,12 @@ export default function addOrUpdateBurialSiteField(
|
||||||
.prepare(
|
.prepare(
|
||||||
`update BurialSiteFields
|
`update BurialSiteFields
|
||||||
set fieldValue = ?,
|
set fieldValue = ?,
|
||||||
recordUpdate_userName = ?,
|
recordUpdate_userName = ?,
|
||||||
recordUpdate_timeMillis = ?,
|
recordUpdate_timeMillis = ?,
|
||||||
recordDelete_userName = null,
|
recordDelete_userName = null,
|
||||||
recordDelete_timeMillis = null
|
recordDelete_timeMillis = null
|
||||||
where burialSiteId = ?
|
where burialSiteId = ?
|
||||||
and burialSiteTypeFieldId = ?`
|
and burialSiteTypeFieldId = ?`
|
||||||
)
|
)
|
||||||
.run(
|
.run(
|
||||||
fieldForm.fieldValue,
|
fieldForm.fieldValue,
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,12 @@ export default function addOrUpdateContractField(fieldForm, user, connectedDatab
|
||||||
let result = database
|
let result = database
|
||||||
.prepare(`update ContractFields
|
.prepare(`update ContractFields
|
||||||
set fieldValue = ?,
|
set fieldValue = ?,
|
||||||
recordUpdate_userName = ?,
|
recordUpdate_userName = ?,
|
||||||
recordUpdate_timeMillis = ?,
|
recordUpdate_timeMillis = ?,
|
||||||
recordDelete_userName = null,
|
recordDelete_userName = null,
|
||||||
recordDelete_timeMillis = null
|
recordDelete_timeMillis = null
|
||||||
where contractId = ?
|
where contractId = ?
|
||||||
and contractTypeFieldId = ?`)
|
and contractTypeFieldId = ?`)
|
||||||
.run(fieldForm.fieldValue, user.userName, rightNowMillis, fieldForm.contractId, fieldForm.contractTypeFieldId);
|
.run(fieldForm.fieldValue, user.userName, rightNowMillis, fieldForm.contractId, fieldForm.contractTypeFieldId);
|
||||||
if (result.changes === 0) {
|
if (result.changes === 0) {
|
||||||
result = database
|
result = database
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,12 @@ export default function addOrUpdateContractField(
|
||||||
.prepare(
|
.prepare(
|
||||||
`update ContractFields
|
`update ContractFields
|
||||||
set fieldValue = ?,
|
set fieldValue = ?,
|
||||||
recordUpdate_userName = ?,
|
recordUpdate_userName = ?,
|
||||||
recordUpdate_timeMillis = ?,
|
recordUpdate_timeMillis = ?,
|
||||||
recordDelete_userName = null,
|
recordDelete_userName = null,
|
||||||
recordDelete_timeMillis = null
|
recordDelete_timeMillis = null
|
||||||
where contractId = ?
|
where contractId = ?
|
||||||
and contractTypeFieldId = ?`
|
and contractTypeFieldId = ?`
|
||||||
)
|
)
|
||||||
.run(
|
.run(
|
||||||
fieldForm.fieldValue,
|
fieldForm.fieldValue,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
export interface AddWorkOrderForm {
|
export interface AddWorkOrderForm {
|
||||||
workOrderTypeId: number | string;
|
|
||||||
workOrderNumber?: string;
|
|
||||||
workOrderDescription: string;
|
workOrderDescription: string;
|
||||||
workOrderOpenDateString?: string;
|
workOrderNumber?: string;
|
||||||
|
workOrderTypeId: number | string;
|
||||||
workOrderCloseDateString?: string;
|
workOrderCloseDateString?: string;
|
||||||
|
workOrderOpenDateString?: string;
|
||||||
contractId?: string;
|
contractId?: string;
|
||||||
}
|
}
|
||||||
export default function addWorkOrder(workOrderForm: AddWorkOrderForm, user: User): number;
|
export default function addWorkOrder(workOrderForm: AddWorkOrderForm, user: User): number;
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@ export default function addWorkOrder(workOrderForm, user) {
|
||||||
const workOrderId = result.lastInsertRowid;
|
const workOrderId = result.lastInsertRowid;
|
||||||
if ((workOrderForm.contractId ?? '') !== '') {
|
if ((workOrderForm.contractId ?? '') !== '') {
|
||||||
addWorkOrderContract({
|
addWorkOrderContract({
|
||||||
|
contractId: workOrderForm.contractId,
|
||||||
workOrderId,
|
workOrderId,
|
||||||
contractId: workOrderForm.contractId
|
|
||||||
}, user, database);
|
}, user, database);
|
||||||
}
|
}
|
||||||
database.close();
|
database.close();
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,14 @@ import addWorkOrderContract from './addWorkOrderContract.js'
|
||||||
import getNextWorkOrderNumber from './getNextWorkOrderNumber.js'
|
import getNextWorkOrderNumber from './getNextWorkOrderNumber.js'
|
||||||
|
|
||||||
export interface AddWorkOrderForm {
|
export interface AddWorkOrderForm {
|
||||||
workOrderTypeId: number | string
|
|
||||||
workOrderNumber?: string
|
|
||||||
workOrderDescription: string
|
workOrderDescription: string
|
||||||
workOrderOpenDateString?: string
|
workOrderNumber?: string
|
||||||
|
|
||||||
|
workOrderTypeId: number | string
|
||||||
|
|
||||||
workOrderCloseDateString?: string
|
workOrderCloseDateString?: string
|
||||||
|
workOrderOpenDateString?: string
|
||||||
|
|
||||||
contractId?: string
|
contractId?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,8 +70,8 @@ export default function addWorkOrder(
|
||||||
if ((workOrderForm.contractId ?? '') !== '') {
|
if ((workOrderForm.contractId ?? '') !== '') {
|
||||||
addWorkOrderContract(
|
addWorkOrderContract(
|
||||||
{
|
{
|
||||||
|
contractId: workOrderForm.contractId as string,
|
||||||
workOrderId,
|
workOrderId,
|
||||||
contractId: workOrderForm.contractId as string
|
|
||||||
},
|
},
|
||||||
user,
|
user,
|
||||||
database
|
database
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
export interface AddForm {
|
export interface AddForm {
|
||||||
workOrderId: number | string;
|
|
||||||
burialSiteId: number | string;
|
burialSiteId: number | string;
|
||||||
|
workOrderId: number | string;
|
||||||
}
|
}
|
||||||
export default function addWorkOrderBurialSite(workOrderLotForm: AddForm, user: User): boolean;
|
export default function addWorkOrderBurialSite(workOrderLotForm: AddForm, user: User): boolean;
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ import sqlite from 'better-sqlite3'
|
||||||
import { sunriseDB } from '../helpers/database.helpers.js'
|
import { sunriseDB } from '../helpers/database.helpers.js'
|
||||||
|
|
||||||
export interface AddForm {
|
export interface AddForm {
|
||||||
workOrderId: number | string
|
|
||||||
burialSiteId: number | string
|
burialSiteId: number | string
|
||||||
|
workOrderId: number | string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function addWorkOrderBurialSite(
|
export default function addWorkOrderBurialSite(
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
export interface AddWorkOrderCommentForm {
|
export interface AddWorkOrderCommentForm {
|
||||||
workOrderId: string;
|
|
||||||
comment: string;
|
comment: string;
|
||||||
|
workOrderId: string;
|
||||||
}
|
}
|
||||||
export default function addWorkOrderComment(workOrderCommentForm: AddWorkOrderCommentForm, user: User): number;
|
export default function addWorkOrderComment(workOrderCommentForm: AddWorkOrderCommentForm, user: User): number;
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import sqlite from 'better-sqlite3'
|
||||||
import { sunriseDB } from '../helpers/database.helpers.js'
|
import { sunriseDB } from '../helpers/database.helpers.js'
|
||||||
|
|
||||||
export interface AddWorkOrderCommentForm {
|
export interface AddWorkOrderCommentForm {
|
||||||
workOrderId: string
|
|
||||||
comment: string
|
comment: string
|
||||||
|
workOrderId: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function addWorkOrderComment(
|
export default function addWorkOrderComment(
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,10 @@ export default function cleanupDatabase(user) {
|
||||||
inactivatedRecordCount += database
|
inactivatedRecordCount += database
|
||||||
.prepare(`update WorkOrderComments
|
.prepare(`update WorkOrderComments
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and workOrderId in (
|
and workOrderId in (
|
||||||
select workOrderId from WorkOrders where recordDelete_timeMillis is not null)`)
|
select workOrderId from WorkOrders where recordDelete_timeMillis is not null)`)
|
||||||
.run(user.userName, rightNowMillis).changes;
|
.run(user.userName, rightNowMillis).changes;
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare('delete from WorkOrderComments where recordDelete_timeMillis <= ?')
|
.prepare('delete from WorkOrderComments where recordDelete_timeMillis <= ?')
|
||||||
|
|
@ -29,10 +29,10 @@ export default function cleanupDatabase(user) {
|
||||||
inactivatedRecordCount += database
|
inactivatedRecordCount += database
|
||||||
.prepare(`update WorkOrderContracts
|
.prepare(`update WorkOrderContracts
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and workOrderId in (
|
and workOrderId in (
|
||||||
select workOrderId from WorkOrders where recordDelete_timeMillis is not null)`)
|
select workOrderId from WorkOrders where recordDelete_timeMillis is not null)`)
|
||||||
.run(user.userName, rightNowMillis).changes;
|
.run(user.userName, rightNowMillis).changes;
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare('delete from WorkOrderContracts where recordDelete_timeMillis <= ?')
|
.prepare('delete from WorkOrderContracts where recordDelete_timeMillis <= ?')
|
||||||
|
|
@ -43,10 +43,10 @@ export default function cleanupDatabase(user) {
|
||||||
inactivatedRecordCount += database
|
inactivatedRecordCount += database
|
||||||
.prepare(`update WorkOrderBurialSites
|
.prepare(`update WorkOrderBurialSites
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and workOrderId in (
|
and workOrderId in (
|
||||||
select workOrderId from WorkOrders where recordDelete_timeMillis is not null)`)
|
select workOrderId from WorkOrders where recordDelete_timeMillis is not null)`)
|
||||||
.run(user.userName, rightNowMillis).changes;
|
.run(user.userName, rightNowMillis).changes;
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare('delete from WorkOrderBurialSites where recordDelete_timeMillis <= ?')
|
.prepare('delete from WorkOrderBurialSites where recordDelete_timeMillis <= ?')
|
||||||
|
|
@ -57,10 +57,10 @@ export default function cleanupDatabase(user) {
|
||||||
inactivatedRecordCount += database
|
inactivatedRecordCount += database
|
||||||
.prepare(`update WorkOrderMilestones
|
.prepare(`update WorkOrderMilestones
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and workOrderId in (
|
and workOrderId in (
|
||||||
select workOrderId from WorkOrders where recordDelete_timeMillis is not null)`)
|
select workOrderId from WorkOrders where recordDelete_timeMillis is not null)`)
|
||||||
.run(user.userName, rightNowMillis).changes;
|
.run(user.userName, rightNowMillis).changes;
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare('delete from WorkOrderMilestones where recordDelete_timeMillis <= ?')
|
.prepare('delete from WorkOrderMilestones where recordDelete_timeMillis <= ?')
|
||||||
|
|
@ -71,10 +71,10 @@ export default function cleanupDatabase(user) {
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare(`delete from WorkOrders
|
.prepare(`delete from WorkOrders
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and workOrderId not in (select workOrderId from WorkOrderComments)
|
and workOrderId not in (select workOrderId from WorkOrderComments)
|
||||||
and workOrderId not in (select workOrderId from WorkOrderContracts)
|
and workOrderId not in (select workOrderId from WorkOrderContracts)
|
||||||
and workOrderId not in (select workOrderId from WorkOrderBurialSites)
|
and workOrderId not in (select workOrderId from WorkOrderBurialSites)
|
||||||
and workOrderId not in (select workOrderId from WorkOrderMilestones)`)
|
and workOrderId not in (select workOrderId from WorkOrderMilestones)`)
|
||||||
.run(recordDeleteTimeMillisMin).changes;
|
.run(recordDeleteTimeMillisMin).changes;
|
||||||
/*
|
/*
|
||||||
* Work Order Milestone Types
|
* Work Order Milestone Types
|
||||||
|
|
@ -82,8 +82,8 @@ export default function cleanupDatabase(user) {
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare(`delete from WorkOrderMilestoneTypes
|
.prepare(`delete from WorkOrderMilestoneTypes
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and workOrderMilestoneTypeId not in (
|
and workOrderMilestoneTypeId not in (
|
||||||
select workOrderMilestoneTypeId from WorkOrderMilestones)`)
|
select workOrderMilestoneTypeId from WorkOrderMilestones)`)
|
||||||
.run(recordDeleteTimeMillisMin).changes;
|
.run(recordDeleteTimeMillisMin).changes;
|
||||||
/*
|
/*
|
||||||
* Work Order Types
|
* Work Order Types
|
||||||
|
|
@ -91,7 +91,7 @@ export default function cleanupDatabase(user) {
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare(`delete from WorkOrderTypes
|
.prepare(`delete from WorkOrderTypes
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and workOrderTypeId not in (select workOrderTypeId from WorkOrders)`)
|
and workOrderTypeId not in (select workOrderTypeId from WorkOrders)`)
|
||||||
.run(recordDeleteTimeMillisMin).changes;
|
.run(recordDeleteTimeMillisMin).changes;
|
||||||
/*
|
/*
|
||||||
* Burial Site Contract Comments
|
* Burial Site Contract Comments
|
||||||
|
|
@ -99,10 +99,10 @@ export default function cleanupDatabase(user) {
|
||||||
inactivatedRecordCount += database
|
inactivatedRecordCount += database
|
||||||
.prepare(`update ContractComments
|
.prepare(`update ContractComments
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and contractId in (
|
and contractId in (
|
||||||
select contractId from Contracts where recordDelete_timeMillis is not null)`)
|
select contractId from Contracts where recordDelete_timeMillis is not null)`)
|
||||||
.run(user.userName, rightNowMillis).changes;
|
.run(user.userName, rightNowMillis).changes;
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare('delete from ContractComments where recordDelete_timeMillis <= ?')
|
.prepare('delete from ContractComments where recordDelete_timeMillis <= ?')
|
||||||
|
|
@ -113,16 +113,16 @@ export default function cleanupDatabase(user) {
|
||||||
inactivatedRecordCount += database
|
inactivatedRecordCount += database
|
||||||
.prepare(`update ContractFields
|
.prepare(`update ContractFields
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and contractId in (select contractId from Contracts where recordDelete_timeMillis is not null)`)
|
and contractId in (select contractId from Contracts where recordDelete_timeMillis is not null)`)
|
||||||
.run(user.userName, rightNowMillis).changes;
|
.run(user.userName, rightNowMillis).changes;
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare('delete from ContractFields where recordDelete_timeMillis <= ?')
|
.prepare('delete from ContractFields where recordDelete_timeMillis <= ?')
|
||||||
.run(recordDeleteTimeMillisMin).changes;
|
.run(recordDeleteTimeMillisMin).changes;
|
||||||
/*
|
/*
|
||||||
* Burial Site Contract Fees/Transactions
|
* Burial Site Contract Fees/Transactions
|
||||||
* - Maintain financials, do not delete related.
|
* - Maintain financial data, do not delete related.
|
||||||
*/
|
*/
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare('delete from ContractFees where recordDelete_timeMillis <= ?')
|
.prepare('delete from ContractFees where recordDelete_timeMillis <= ?')
|
||||||
|
|
@ -136,12 +136,12 @@ export default function cleanupDatabase(user) {
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare(`delete from Contracts
|
.prepare(`delete from Contracts
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and contractId not in (select contractId from ContractComments)
|
and contractId not in (select contractId from ContractComments)
|
||||||
and contractId not in (select contractId from ContractFees)
|
and contractId not in (select contractId from ContractFees)
|
||||||
and contractId not in (select contractId from ContractFields)
|
and contractId not in (select contractId from ContractFields)
|
||||||
and contractId not in (select contractId from ContractInterments)
|
and contractId not in (select contractId from ContractInterments)
|
||||||
and contractId not in (select contractId from ContractTransactions)
|
and contractId not in (select contractId from ContractTransactions)
|
||||||
and contractId not in (select contractId from WorkOrderContracts)`)
|
and contractId not in (select contractId from WorkOrderContracts)`)
|
||||||
.run(recordDeleteTimeMillisMin).changes;
|
.run(recordDeleteTimeMillisMin).changes;
|
||||||
/*
|
/*
|
||||||
* Fees
|
* Fees
|
||||||
|
|
@ -149,14 +149,14 @@ export default function cleanupDatabase(user) {
|
||||||
inactivatedRecordCount += database
|
inactivatedRecordCount += database
|
||||||
.prepare(`update Fees
|
.prepare(`update Fees
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and feeCategoryId in (select feeCategoryId from FeeCategories where recordDelete_timeMillis is not null)`)
|
and feeCategoryId in (select feeCategoryId from FeeCategories where recordDelete_timeMillis is not null)`)
|
||||||
.run(user.userName, rightNowMillis).changes;
|
.run(user.userName, rightNowMillis).changes;
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare(`delete from Fees
|
.prepare(`delete from Fees
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and feeId not in (select feeId from ContractFees)`)
|
and feeId not in (select feeId from ContractFees)`)
|
||||||
.run(recordDeleteTimeMillisMin).changes;
|
.run(recordDeleteTimeMillisMin).changes;
|
||||||
/*
|
/*
|
||||||
* Fee Categories
|
* Fee Categories
|
||||||
|
|
@ -164,7 +164,7 @@ export default function cleanupDatabase(user) {
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare(`delete from FeeCategories
|
.prepare(`delete from FeeCategories
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and feeCategoryId not in (select feeCategoryId from Fees)`)
|
and feeCategoryId not in (select feeCategoryId from Fees)`)
|
||||||
.run(recordDeleteTimeMillisMin).changes;
|
.run(recordDeleteTimeMillisMin).changes;
|
||||||
/*
|
/*
|
||||||
* Contract Type Fields
|
* Contract Type Fields
|
||||||
|
|
@ -172,14 +172,14 @@ export default function cleanupDatabase(user) {
|
||||||
inactivatedRecordCount += database
|
inactivatedRecordCount += database
|
||||||
.prepare(`update ContractTypeFields
|
.prepare(`update ContractTypeFields
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and contractTypeId in (select contractTypeId from ContractTypes where recordDelete_timeMillis is not null)`)
|
and contractTypeId in (select contractTypeId from ContractTypes where recordDelete_timeMillis is not null)`)
|
||||||
.run(user.userName, rightNowMillis).changes;
|
.run(user.userName, rightNowMillis).changes;
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare(`delete from ContractTypeFields
|
.prepare(`delete from ContractTypeFields
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and contractTypeFieldId not in (select contractTypeFieldId from ContractFields)`)
|
and contractTypeFieldId not in (select contractTypeFieldId from ContractFields)`)
|
||||||
.run(recordDeleteTimeMillisMin).changes;
|
.run(recordDeleteTimeMillisMin).changes;
|
||||||
/*
|
/*
|
||||||
* Contract Type Prints
|
* Contract Type Prints
|
||||||
|
|
@ -187,9 +187,9 @@ export default function cleanupDatabase(user) {
|
||||||
inactivatedRecordCount += database
|
inactivatedRecordCount += database
|
||||||
.prepare(`update ContractTypePrints
|
.prepare(`update ContractTypePrints
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and contractTypeId in (select contractTypeId from ContractTypes where recordDelete_timeMillis is not null)`)
|
and contractTypeId in (select contractTypeId from ContractTypes where recordDelete_timeMillis is not null)`)
|
||||||
.run(user.userName, rightNowMillis).changes;
|
.run(user.userName, rightNowMillis).changes;
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare('delete from ContractTypePrints where recordDelete_timeMillis <= ?')
|
.prepare('delete from ContractTypePrints where recordDelete_timeMillis <= ?')
|
||||||
|
|
@ -200,10 +200,10 @@ export default function cleanupDatabase(user) {
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare(`delete from ContractTypes
|
.prepare(`delete from ContractTypes
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and contractTypeId not in (select contractTypeId from ContractTypeFields)
|
and contractTypeId not in (select contractTypeId from ContractTypeFields)
|
||||||
and contractTypeId not in (select contractTypeId from ContractTypePrints)
|
and contractTypeId not in (select contractTypeId from ContractTypePrints)
|
||||||
and contractTypeId not in (select contractTypeId from Contracts)
|
and contractTypeId not in (select contractTypeId from Contracts)
|
||||||
and contractTypeId not in (select contractTypeId from Fees)`)
|
and contractTypeId not in (select contractTypeId from Fees)`)
|
||||||
.run(recordDeleteTimeMillisMin).changes;
|
.run(recordDeleteTimeMillisMin).changes;
|
||||||
/*
|
/*
|
||||||
* Burial Site Comments
|
* Burial Site Comments
|
||||||
|
|
@ -211,9 +211,9 @@ export default function cleanupDatabase(user) {
|
||||||
inactivatedRecordCount += database
|
inactivatedRecordCount += database
|
||||||
.prepare(`update BurialSiteComments
|
.prepare(`update BurialSiteComments
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and burialSiteId in (select burialSiteId from BurialSites where recordDelete_timeMillis is not null)`)
|
and burialSiteId in (select burialSiteId from BurialSites where recordDelete_timeMillis is not null)`)
|
||||||
.run(user.userName, rightNowMillis).changes;
|
.run(user.userName, rightNowMillis).changes;
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare('delete from BurialSiteComments where recordDelete_timeMillis <= ?')
|
.prepare('delete from BurialSiteComments where recordDelete_timeMillis <= ?')
|
||||||
|
|
@ -224,9 +224,9 @@ export default function cleanupDatabase(user) {
|
||||||
inactivatedRecordCount += database
|
inactivatedRecordCount += database
|
||||||
.prepare(`update BurialSiteFields
|
.prepare(`update BurialSiteFields
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and burialSiteId in (select burialSiteId from BurialSites where recordDelete_timeMillis is not null)`)
|
and burialSiteId in (select burialSiteId from BurialSites where recordDelete_timeMillis is not null)`)
|
||||||
.run(user.userName, rightNowMillis).changes;
|
.run(user.userName, rightNowMillis).changes;
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare('delete from BurialSiteFields where recordDelete_timeMillis <= ?')
|
.prepare('delete from BurialSiteFields where recordDelete_timeMillis <= ?')
|
||||||
|
|
@ -237,17 +237,17 @@ export default function cleanupDatabase(user) {
|
||||||
inactivatedRecordCount += database
|
inactivatedRecordCount += database
|
||||||
.prepare(`update BurialSites
|
.prepare(`update BurialSites
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and cemeteryId in (select cemeteryId from Cemeteries where recordDelete_timeMillis is not null)`)
|
and cemeteryId in (select cemeteryId from Cemeteries where recordDelete_timeMillis is not null)`)
|
||||||
.run(user.userName, rightNowMillis).changes;
|
.run(user.userName, rightNowMillis).changes;
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare(`delete from BurialSites
|
.prepare(`delete from BurialSites
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and burialSiteId not in (select burialSiteId from BurialSiteComments)
|
and burialSiteId not in (select burialSiteId from BurialSiteComments)
|
||||||
and burialSiteId not in (select burialSiteId from BurialSiteFields)
|
and burialSiteId not in (select burialSiteId from BurialSiteFields)
|
||||||
and burialSiteId not in (select burialSiteId from Contracts)
|
and burialSiteId not in (select burialSiteId from Contracts)
|
||||||
and burialSiteId not in (select burialSiteId from WorkOrderBurialSites)`)
|
and burialSiteId not in (select burialSiteId from WorkOrderBurialSites)`)
|
||||||
.run(recordDeleteTimeMillisMin).changes;
|
.run(recordDeleteTimeMillisMin).changes;
|
||||||
/*
|
/*
|
||||||
* Burial Site Statuses
|
* Burial Site Statuses
|
||||||
|
|
@ -255,7 +255,7 @@ export default function cleanupDatabase(user) {
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare(`delete from BurialSiteStatuses
|
.prepare(`delete from BurialSiteStatuses
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and burialSiteStatusId not in (select burialSiteStatusId from BurialSites)`)
|
and burialSiteStatusId not in (select burialSiteStatusId from BurialSites)`)
|
||||||
.run(recordDeleteTimeMillisMin).changes;
|
.run(recordDeleteTimeMillisMin).changes;
|
||||||
/*
|
/*
|
||||||
* Burial Site Type Fields
|
* Burial Site Type Fields
|
||||||
|
|
@ -263,14 +263,14 @@ export default function cleanupDatabase(user) {
|
||||||
inactivatedRecordCount += database
|
inactivatedRecordCount += database
|
||||||
.prepare(`update BurialSiteTypeFields
|
.prepare(`update BurialSiteTypeFields
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and burialSiteTypeId in (select burialSiteTypeId from BurialSiteTypes where recordDelete_timeMillis is not null)`)
|
and burialSiteTypeId in (select burialSiteTypeId from BurialSiteTypes where recordDelete_timeMillis is not null)`)
|
||||||
.run(user.userName, rightNowMillis).changes;
|
.run(user.userName, rightNowMillis).changes;
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare(`delete from BurialSiteTypeFields
|
.prepare(`delete from BurialSiteTypeFields
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and burialSiteTypeFieldId not in (select burialSiteTypeFieldId from BurialSiteFields)`)
|
and burialSiteTypeFieldId not in (select burialSiteTypeFieldId from BurialSiteFields)`)
|
||||||
.run(recordDeleteTimeMillisMin).changes;
|
.run(recordDeleteTimeMillisMin).changes;
|
||||||
/*
|
/*
|
||||||
* Burial Site Types
|
* Burial Site Types
|
||||||
|
|
@ -278,7 +278,7 @@ export default function cleanupDatabase(user) {
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
.prepare(`delete from BurialSiteTypes
|
.prepare(`delete from BurialSiteTypes
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and burialSiteTypeId not in (select burialSiteTypeId from BurialSites)`)
|
and burialSiteTypeId not in (select burialSiteTypeId from BurialSites)`)
|
||||||
.run(recordDeleteTimeMillisMin).changes;
|
.run(recordDeleteTimeMillisMin).changes;
|
||||||
database.close();
|
database.close();
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,10 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`update WorkOrderComments
|
`update WorkOrderComments
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and workOrderId in (
|
and workOrderId in (
|
||||||
select workOrderId from WorkOrders where recordDelete_timeMillis is not null)`
|
select workOrderId from WorkOrders where recordDelete_timeMillis is not null)`
|
||||||
)
|
)
|
||||||
.run(user.userName, rightNowMillis).changes
|
.run(user.userName, rightNowMillis).changes
|
||||||
|
|
||||||
|
|
@ -45,10 +45,10 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`update WorkOrderContracts
|
`update WorkOrderContracts
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and workOrderId in (
|
and workOrderId in (
|
||||||
select workOrderId from WorkOrders where recordDelete_timeMillis is not null)`
|
select workOrderId from WorkOrders where recordDelete_timeMillis is not null)`
|
||||||
)
|
)
|
||||||
.run(user.userName, rightNowMillis).changes
|
.run(user.userName, rightNowMillis).changes
|
||||||
|
|
||||||
|
|
@ -66,10 +66,10 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`update WorkOrderBurialSites
|
`update WorkOrderBurialSites
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and workOrderId in (
|
and workOrderId in (
|
||||||
select workOrderId from WorkOrders where recordDelete_timeMillis is not null)`
|
select workOrderId from WorkOrders where recordDelete_timeMillis is not null)`
|
||||||
)
|
)
|
||||||
.run(user.userName, rightNowMillis).changes
|
.run(user.userName, rightNowMillis).changes
|
||||||
|
|
||||||
|
|
@ -87,10 +87,10 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`update WorkOrderMilestones
|
`update WorkOrderMilestones
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and workOrderId in (
|
and workOrderId in (
|
||||||
select workOrderId from WorkOrders where recordDelete_timeMillis is not null)`
|
select workOrderId from WorkOrders where recordDelete_timeMillis is not null)`
|
||||||
)
|
)
|
||||||
.run(user.userName, rightNowMillis).changes
|
.run(user.userName, rightNowMillis).changes
|
||||||
|
|
||||||
|
|
@ -108,10 +108,10 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`delete from WorkOrders
|
`delete from WorkOrders
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and workOrderId not in (select workOrderId from WorkOrderComments)
|
and workOrderId not in (select workOrderId from WorkOrderComments)
|
||||||
and workOrderId not in (select workOrderId from WorkOrderContracts)
|
and workOrderId not in (select workOrderId from WorkOrderContracts)
|
||||||
and workOrderId not in (select workOrderId from WorkOrderBurialSites)
|
and workOrderId not in (select workOrderId from WorkOrderBurialSites)
|
||||||
and workOrderId not in (select workOrderId from WorkOrderMilestones)`
|
and workOrderId not in (select workOrderId from WorkOrderMilestones)`
|
||||||
)
|
)
|
||||||
.run(recordDeleteTimeMillisMin).changes
|
.run(recordDeleteTimeMillisMin).changes
|
||||||
|
|
||||||
|
|
@ -123,8 +123,8 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`delete from WorkOrderMilestoneTypes
|
`delete from WorkOrderMilestoneTypes
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and workOrderMilestoneTypeId not in (
|
and workOrderMilestoneTypeId not in (
|
||||||
select workOrderMilestoneTypeId from WorkOrderMilestones)`
|
select workOrderMilestoneTypeId from WorkOrderMilestones)`
|
||||||
)
|
)
|
||||||
.run(recordDeleteTimeMillisMin).changes
|
.run(recordDeleteTimeMillisMin).changes
|
||||||
|
|
||||||
|
|
@ -136,7 +136,7 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`delete from WorkOrderTypes
|
`delete from WorkOrderTypes
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and workOrderTypeId not in (select workOrderTypeId from WorkOrders)`
|
and workOrderTypeId not in (select workOrderTypeId from WorkOrders)`
|
||||||
)
|
)
|
||||||
.run(recordDeleteTimeMillisMin).changes
|
.run(recordDeleteTimeMillisMin).changes
|
||||||
|
|
||||||
|
|
@ -148,10 +148,10 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`update ContractComments
|
`update ContractComments
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and contractId in (
|
and contractId in (
|
||||||
select contractId from Contracts where recordDelete_timeMillis is not null)`
|
select contractId from Contracts where recordDelete_timeMillis is not null)`
|
||||||
)
|
)
|
||||||
.run(user.userName, rightNowMillis).changes
|
.run(user.userName, rightNowMillis).changes
|
||||||
|
|
||||||
|
|
@ -167,9 +167,9 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`update ContractFields
|
`update ContractFields
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and contractId in (select contractId from Contracts where recordDelete_timeMillis is not null)`
|
and contractId in (select contractId from Contracts where recordDelete_timeMillis is not null)`
|
||||||
)
|
)
|
||||||
.run(user.userName, rightNowMillis).changes
|
.run(user.userName, rightNowMillis).changes
|
||||||
|
|
||||||
|
|
@ -179,7 +179,7 @@ export default function cleanupDatabase(user: User): {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Burial Site Contract Fees/Transactions
|
* Burial Site Contract Fees/Transactions
|
||||||
* - Maintain financials, do not delete related.
|
* - Maintain financial data, do not delete related.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
purgedRecordCount += database
|
purgedRecordCount += database
|
||||||
|
|
@ -200,12 +200,12 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`delete from Contracts
|
`delete from Contracts
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and contractId not in (select contractId from ContractComments)
|
and contractId not in (select contractId from ContractComments)
|
||||||
and contractId not in (select contractId from ContractFees)
|
and contractId not in (select contractId from ContractFees)
|
||||||
and contractId not in (select contractId from ContractFields)
|
and contractId not in (select contractId from ContractFields)
|
||||||
and contractId not in (select contractId from ContractInterments)
|
and contractId not in (select contractId from ContractInterments)
|
||||||
and contractId not in (select contractId from ContractTransactions)
|
and contractId not in (select contractId from ContractTransactions)
|
||||||
and contractId not in (select contractId from WorkOrderContracts)`
|
and contractId not in (select contractId from WorkOrderContracts)`
|
||||||
)
|
)
|
||||||
.run(recordDeleteTimeMillisMin).changes
|
.run(recordDeleteTimeMillisMin).changes
|
||||||
|
|
||||||
|
|
@ -217,9 +217,9 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`update Fees
|
`update Fees
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and feeCategoryId in (select feeCategoryId from FeeCategories where recordDelete_timeMillis is not null)`
|
and feeCategoryId in (select feeCategoryId from FeeCategories where recordDelete_timeMillis is not null)`
|
||||||
)
|
)
|
||||||
.run(user.userName, rightNowMillis).changes
|
.run(user.userName, rightNowMillis).changes
|
||||||
|
|
||||||
|
|
@ -227,7 +227,7 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`delete from Fees
|
`delete from Fees
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and feeId not in (select feeId from ContractFees)`
|
and feeId not in (select feeId from ContractFees)`
|
||||||
)
|
)
|
||||||
.run(recordDeleteTimeMillisMin).changes
|
.run(recordDeleteTimeMillisMin).changes
|
||||||
|
|
||||||
|
|
@ -239,7 +239,7 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`delete from FeeCategories
|
`delete from FeeCategories
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and feeCategoryId not in (select feeCategoryId from Fees)`
|
and feeCategoryId not in (select feeCategoryId from Fees)`
|
||||||
)
|
)
|
||||||
.run(recordDeleteTimeMillisMin).changes
|
.run(recordDeleteTimeMillisMin).changes
|
||||||
|
|
||||||
|
|
@ -251,9 +251,9 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`update ContractTypeFields
|
`update ContractTypeFields
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and contractTypeId in (select contractTypeId from ContractTypes where recordDelete_timeMillis is not null)`
|
and contractTypeId in (select contractTypeId from ContractTypes where recordDelete_timeMillis is not null)`
|
||||||
)
|
)
|
||||||
.run(user.userName, rightNowMillis).changes
|
.run(user.userName, rightNowMillis).changes
|
||||||
|
|
||||||
|
|
@ -261,7 +261,7 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`delete from ContractTypeFields
|
`delete from ContractTypeFields
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and contractTypeFieldId not in (select contractTypeFieldId from ContractFields)`
|
and contractTypeFieldId not in (select contractTypeFieldId from ContractFields)`
|
||||||
)
|
)
|
||||||
.run(recordDeleteTimeMillisMin).changes
|
.run(recordDeleteTimeMillisMin).changes
|
||||||
|
|
||||||
|
|
@ -273,9 +273,9 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`update ContractTypePrints
|
`update ContractTypePrints
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and contractTypeId in (select contractTypeId from ContractTypes where recordDelete_timeMillis is not null)`
|
and contractTypeId in (select contractTypeId from ContractTypes where recordDelete_timeMillis is not null)`
|
||||||
)
|
)
|
||||||
.run(user.userName, rightNowMillis).changes
|
.run(user.userName, rightNowMillis).changes
|
||||||
|
|
||||||
|
|
@ -293,10 +293,10 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`delete from ContractTypes
|
`delete from ContractTypes
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and contractTypeId not in (select contractTypeId from ContractTypeFields)
|
and contractTypeId not in (select contractTypeId from ContractTypeFields)
|
||||||
and contractTypeId not in (select contractTypeId from ContractTypePrints)
|
and contractTypeId not in (select contractTypeId from ContractTypePrints)
|
||||||
and contractTypeId not in (select contractTypeId from Contracts)
|
and contractTypeId not in (select contractTypeId from Contracts)
|
||||||
and contractTypeId not in (select contractTypeId from Fees)`
|
and contractTypeId not in (select contractTypeId from Fees)`
|
||||||
)
|
)
|
||||||
.run(recordDeleteTimeMillisMin).changes
|
.run(recordDeleteTimeMillisMin).changes
|
||||||
|
|
||||||
|
|
@ -308,9 +308,9 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`update BurialSiteComments
|
`update BurialSiteComments
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and burialSiteId in (select burialSiteId from BurialSites where recordDelete_timeMillis is not null)`
|
and burialSiteId in (select burialSiteId from BurialSites where recordDelete_timeMillis is not null)`
|
||||||
)
|
)
|
||||||
.run(user.userName, rightNowMillis).changes
|
.run(user.userName, rightNowMillis).changes
|
||||||
|
|
||||||
|
|
@ -328,9 +328,9 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`update BurialSiteFields
|
`update BurialSiteFields
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and burialSiteId in (select burialSiteId from BurialSites where recordDelete_timeMillis is not null)`
|
and burialSiteId in (select burialSiteId from BurialSites where recordDelete_timeMillis is not null)`
|
||||||
)
|
)
|
||||||
.run(user.userName, rightNowMillis).changes
|
.run(user.userName, rightNowMillis).changes
|
||||||
|
|
||||||
|
|
@ -346,9 +346,9 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`update BurialSites
|
`update BurialSites
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and cemeteryId in (select cemeteryId from Cemeteries where recordDelete_timeMillis is not null)`
|
and cemeteryId in (select cemeteryId from Cemeteries where recordDelete_timeMillis is not null)`
|
||||||
)
|
)
|
||||||
.run(user.userName, rightNowMillis).changes
|
.run(user.userName, rightNowMillis).changes
|
||||||
|
|
||||||
|
|
@ -356,10 +356,10 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`delete from BurialSites
|
`delete from BurialSites
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and burialSiteId not in (select burialSiteId from BurialSiteComments)
|
and burialSiteId not in (select burialSiteId from BurialSiteComments)
|
||||||
and burialSiteId not in (select burialSiteId from BurialSiteFields)
|
and burialSiteId not in (select burialSiteId from BurialSiteFields)
|
||||||
and burialSiteId not in (select burialSiteId from Contracts)
|
and burialSiteId not in (select burialSiteId from Contracts)
|
||||||
and burialSiteId not in (select burialSiteId from WorkOrderBurialSites)`
|
and burialSiteId not in (select burialSiteId from WorkOrderBurialSites)`
|
||||||
)
|
)
|
||||||
.run(recordDeleteTimeMillisMin).changes
|
.run(recordDeleteTimeMillisMin).changes
|
||||||
|
|
||||||
|
|
@ -371,7 +371,7 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`delete from BurialSiteStatuses
|
`delete from BurialSiteStatuses
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and burialSiteStatusId not in (select burialSiteStatusId from BurialSites)`
|
and burialSiteStatusId not in (select burialSiteStatusId from BurialSites)`
|
||||||
)
|
)
|
||||||
.run(recordDeleteTimeMillisMin).changes
|
.run(recordDeleteTimeMillisMin).changes
|
||||||
|
|
||||||
|
|
@ -383,9 +383,9 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`update BurialSiteTypeFields
|
`update BurialSiteTypeFields
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and burialSiteTypeId in (select burialSiteTypeId from BurialSiteTypes where recordDelete_timeMillis is not null)`
|
and burialSiteTypeId in (select burialSiteTypeId from BurialSiteTypes where recordDelete_timeMillis is not null)`
|
||||||
)
|
)
|
||||||
.run(user.userName, rightNowMillis).changes
|
.run(user.userName, rightNowMillis).changes
|
||||||
|
|
||||||
|
|
@ -393,7 +393,7 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`delete from BurialSiteTypeFields
|
`delete from BurialSiteTypeFields
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and burialSiteTypeFieldId not in (select burialSiteTypeFieldId from BurialSiteFields)`
|
and burialSiteTypeFieldId not in (select burialSiteTypeFieldId from BurialSiteFields)`
|
||||||
)
|
)
|
||||||
.run(recordDeleteTimeMillisMin).changes
|
.run(recordDeleteTimeMillisMin).changes
|
||||||
|
|
||||||
|
|
@ -405,7 +405,7 @@ export default function cleanupDatabase(user: User): {
|
||||||
.prepare(
|
.prepare(
|
||||||
`delete from BurialSiteTypes
|
`delete from BurialSiteTypes
|
||||||
where recordDelete_timeMillis <= ?
|
where recordDelete_timeMillis <= ?
|
||||||
and burialSiteTypeId not in (select burialSiteTypeId from BurialSites)`
|
and burialSiteTypeId not in (select burialSiteTypeId from BurialSites)`
|
||||||
)
|
)
|
||||||
.run(recordDeleteTimeMillisMin).changes
|
.run(recordDeleteTimeMillisMin).changes
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
import { type DateString } from '@cityssm/utils-datetime';
|
||||||
export interface CloseWorkOrderForm {
|
export interface CloseWorkOrderForm {
|
||||||
workOrderId: number | string;
|
workOrderId: number | string;
|
||||||
workOrderCloseDateString?: string;
|
workOrderCloseDateString?: '' | DateString;
|
||||||
}
|
}
|
||||||
export default function closeWorkOrder(workOrderForm: CloseWorkOrderForm, user: User): boolean;
|
export default function closeWorkOrder(workOrderForm: CloseWorkOrderForm, user: User): boolean;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
import { dateStringToInteger, dateToInteger } from '@cityssm/utils-datetime'
|
import {
|
||||||
|
type DateString,
|
||||||
|
dateStringToInteger,
|
||||||
|
dateToInteger
|
||||||
|
} from '@cityssm/utils-datetime'
|
||||||
import sqlite from 'better-sqlite3'
|
import sqlite from 'better-sqlite3'
|
||||||
|
|
||||||
import { sunriseDB } from '../helpers/database.helpers.js'
|
import { sunriseDB } from '../helpers/database.helpers.js'
|
||||||
|
|
@ -6,7 +10,7 @@ import { sunriseDB } from '../helpers/database.helpers.js'
|
||||||
export interface CloseWorkOrderForm {
|
export interface CloseWorkOrderForm {
|
||||||
workOrderId: number | string
|
workOrderId: number | string
|
||||||
|
|
||||||
workOrderCloseDateString?: string
|
workOrderCloseDateString?: '' | DateString
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function closeWorkOrder(
|
export default function closeWorkOrder(
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ export default async function copyContract(
|
||||||
funeralDirectorName: oldContract.funeralDirectorName,
|
funeralDirectorName: oldContract.funeralDirectorName,
|
||||||
funeralHomeId: oldContract.funeralHomeId ?? '',
|
funeralHomeId: oldContract.funeralHomeId ?? '',
|
||||||
funeralTimeString: oldContract.funeralTimeString ?? '',
|
funeralTimeString: oldContract.funeralTimeString ?? '',
|
||||||
|
|
||||||
purchaserAddress1: oldContract.purchaserAddress1,
|
purchaserAddress1: oldContract.purchaserAddress1,
|
||||||
purchaserAddress2: oldContract.purchaserAddress2,
|
purchaserAddress2: oldContract.purchaserAddress2,
|
||||||
purchaserCity: oldContract.purchaserCity,
|
purchaserCity: oldContract.purchaserCity,
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ export function deleteBurialSite(burialSiteId, user) {
|
||||||
.prepare(`select contractId
|
.prepare(`select contractId
|
||||||
from Contracts
|
from Contracts
|
||||||
where burialSiteId = ?
|
where burialSiteId = ?
|
||||||
and recordDelete_timeMillis is null
|
and recordDelete_timeMillis is null
|
||||||
and (contractEndDate is null or contractEndDate >= ?)`)
|
and (contractEndDate is null or contractEndDate >= ?)`)
|
||||||
.pluck()
|
.pluck()
|
||||||
.get(burialSiteId, currentDateInteger);
|
.get(burialSiteId, currentDateInteger);
|
||||||
if (activeContract !== undefined) {
|
if (activeContract !== undefined) {
|
||||||
|
|
@ -26,9 +26,9 @@ export function deleteBurialSite(burialSiteId, user) {
|
||||||
database
|
database
|
||||||
.prepare(`update BurialSites
|
.prepare(`update BurialSites
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where burialSiteId = ?
|
where burialSiteId = ?
|
||||||
and recordDelete_timeMillis is null`)
|
and recordDelete_timeMillis is null`)
|
||||||
.run(user.userName, rightNowMillis, burialSiteId);
|
.run(user.userName, rightNowMillis, burialSiteId);
|
||||||
/*
|
/*
|
||||||
* Delete fields and comments
|
* Delete fields and comments
|
||||||
|
|
@ -36,16 +36,16 @@ export function deleteBurialSite(burialSiteId, user) {
|
||||||
database
|
database
|
||||||
.prepare(`update BurialSiteFields
|
.prepare(`update BurialSiteFields
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where burialSiteId = ?
|
where burialSiteId = ?
|
||||||
and recordDelete_timeMillis is null`)
|
and recordDelete_timeMillis is null`)
|
||||||
.run(user.userName, rightNowMillis, burialSiteId);
|
.run(user.userName, rightNowMillis, burialSiteId);
|
||||||
database
|
database
|
||||||
.prepare(`update BurialSiteComments
|
.prepare(`update BurialSiteComments
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where burialSiteId = ?
|
where burialSiteId = ?
|
||||||
and recordDelete_timeMillis is null`)
|
and recordDelete_timeMillis is null`)
|
||||||
.run(user.userName, rightNowMillis, burialSiteId);
|
.run(user.userName, rightNowMillis, burialSiteId);
|
||||||
database.close();
|
database.close();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ export function deleteBurialSite(burialSiteId: number, user: User): boolean {
|
||||||
`select contractId
|
`select contractId
|
||||||
from Contracts
|
from Contracts
|
||||||
where burialSiteId = ?
|
where burialSiteId = ?
|
||||||
and recordDelete_timeMillis is null
|
and recordDelete_timeMillis is null
|
||||||
and (contractEndDate is null or contractEndDate >= ?)`
|
and (contractEndDate is null or contractEndDate >= ?)`
|
||||||
)
|
)
|
||||||
.pluck()
|
.pluck()
|
||||||
.get(burialSiteId, currentDateInteger) as number | undefined
|
.get(burialSiteId, currentDateInteger) as number | undefined
|
||||||
|
|
@ -38,9 +38,9 @@ export function deleteBurialSite(burialSiteId: number, user: User): boolean {
|
||||||
.prepare(
|
.prepare(
|
||||||
`update BurialSites
|
`update BurialSites
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where burialSiteId = ?
|
where burialSiteId = ?
|
||||||
and recordDelete_timeMillis is null`
|
and recordDelete_timeMillis is null`
|
||||||
)
|
)
|
||||||
.run(user.userName, rightNowMillis, burialSiteId)
|
.run(user.userName, rightNowMillis, burialSiteId)
|
||||||
|
|
||||||
|
|
@ -52,9 +52,9 @@ export function deleteBurialSite(burialSiteId: number, user: User): boolean {
|
||||||
.prepare(
|
.prepare(
|
||||||
`update BurialSiteFields
|
`update BurialSiteFields
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where burialSiteId = ?
|
where burialSiteId = ?
|
||||||
and recordDelete_timeMillis is null`
|
and recordDelete_timeMillis is null`
|
||||||
)
|
)
|
||||||
.run(user.userName, rightNowMillis, burialSiteId)
|
.run(user.userName, rightNowMillis, burialSiteId)
|
||||||
|
|
||||||
|
|
@ -62,9 +62,9 @@ export function deleteBurialSite(burialSiteId: number, user: User): boolean {
|
||||||
.prepare(
|
.prepare(
|
||||||
`update BurialSiteComments
|
`update BurialSiteComments
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where burialSiteId = ?
|
where burialSiteId = ?
|
||||||
and recordDelete_timeMillis is null`
|
and recordDelete_timeMillis is null`
|
||||||
)
|
)
|
||||||
.run(user.userName, rightNowMillis, burialSiteId)
|
.run(user.userName, rightNowMillis, burialSiteId)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ export default function deleteBurialSiteField(burialSiteId, burialSiteTypeFieldI
|
||||||
const result = database
|
const result = database
|
||||||
.prepare(`update BurialSiteFields
|
.prepare(`update BurialSiteFields
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where burialSiteId = ?
|
where burialSiteId = ?
|
||||||
and burialSiteTypeFieldId = ?`)
|
and burialSiteTypeFieldId = ?`)
|
||||||
.run(user.userName, Date.now(), burialSiteId, burialSiteTypeFieldId);
|
.run(user.userName, Date.now(), burialSiteId, burialSiteTypeFieldId);
|
||||||
if (connectedDatabase === undefined) {
|
if (connectedDatabase === undefined) {
|
||||||
database.close();
|
database.close();
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@ export default function deleteBurialSiteField(
|
||||||
.prepare(
|
.prepare(
|
||||||
`update BurialSiteFields
|
`update BurialSiteFields
|
||||||
set recordDelete_userName = ?,
|
set recordDelete_userName = ?,
|
||||||
recordDelete_timeMillis = ?
|
recordDelete_timeMillis = ?
|
||||||
where burialSiteId = ?
|
where burialSiteId = ?
|
||||||
and burialSiteTypeFieldId = ?`
|
and burialSiteTypeFieldId = ?`
|
||||||
)
|
)
|
||||||
.run(user.userName, Date.now(), burialSiteId, burialSiteTypeFieldId)
|
.run(user.userName, Date.now(), burialSiteId, burialSiteTypeFieldId)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@ export interface GetBurialSitesOptions {
|
||||||
includeContractCount?: boolean;
|
includeContractCount?: boolean;
|
||||||
}
|
}
|
||||||
export default function getBurialSites(filters: GetBurialSitesFilters, options: GetBurialSitesOptions, connectedDatabase?: sqlite.Database): {
|
export default function getBurialSites(filters: GetBurialSitesFilters, options: GetBurialSitesOptions, connectedDatabase?: sqlite.Database): {
|
||||||
count: number;
|
|
||||||
burialSites: BurialSite[];
|
burialSites: BurialSite[];
|
||||||
|
count: number;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { sunriseDB } from '../helpers/database.helpers.js';
|
||||||
import { getBurialSiteNameWhereClause } from '../helpers/functions.sqlFilters.js';
|
import { getBurialSiteNameWhereClause } from '../helpers/functions.sqlFilters.js';
|
||||||
export default function getBurialSites(filters, options, connectedDatabase) {
|
export default function getBurialSites(filters, options, connectedDatabase) {
|
||||||
const database = connectedDatabase ?? sqlite(sunriseDB, { readonly: true });
|
const database = connectedDatabase ?? sqlite(sunriseDB, { readonly: true });
|
||||||
const { sqlWhereClause, sqlParameters } = buildWhereClause(filters);
|
const { sqlParameters, sqlWhereClause } = buildWhereClause(filters);
|
||||||
const currentDate = dateToInteger(new Date());
|
const currentDate = dateToInteger(new Date());
|
||||||
let count = 0;
|
let count = 0;
|
||||||
if (options.limit !== -1) {
|
if (options.limit !== -1) {
|
||||||
|
|
@ -71,8 +71,8 @@ export default function getBurialSites(filters, options, connectedDatabase) {
|
||||||
database.close();
|
database.close();
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
count,
|
burialSites,
|
||||||
burialSites
|
count
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function buildWhereClause(filters) {
|
function buildWhereClause(filters) {
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,10 @@ export default function getBurialSites(
|
||||||
filters: GetBurialSitesFilters,
|
filters: GetBurialSitesFilters,
|
||||||
options: GetBurialSitesOptions,
|
options: GetBurialSitesOptions,
|
||||||
connectedDatabase?: sqlite.Database
|
connectedDatabase?: sqlite.Database
|
||||||
): { count: number; burialSites: BurialSite[] } {
|
): { burialSites: BurialSite[]; count: number } {
|
||||||
const database = connectedDatabase ?? sqlite(sunriseDB, { readonly: true })
|
const database = connectedDatabase ?? sqlite(sunriseDB, { readonly: true })
|
||||||
|
|
||||||
const { sqlWhereClause, sqlParameters } = buildWhereClause(filters)
|
const { sqlParameters, sqlWhereClause } = buildWhereClause(filters)
|
||||||
|
|
||||||
const currentDate = dateToInteger(new Date())
|
const currentDate = dateToInteger(new Date())
|
||||||
|
|
||||||
|
|
@ -120,8 +120,8 @@ export default function getBurialSites(
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
count,
|
burialSites,
|
||||||
burialSites
|
count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -603,8 +603,8 @@ async function importFromWorkOrderCSV() {
|
||||||
const workOrderContainsBurialSite = workOrder?.workOrderBurialSites?.find((possibleLot) => possibleLot.burialSiteId === burialSite?.burialSiteId);
|
const workOrderContainsBurialSite = workOrder?.workOrderBurialSites?.find((possibleLot) => possibleLot.burialSiteId === burialSite?.burialSiteId);
|
||||||
if (!workOrderContainsBurialSite) {
|
if (!workOrderContainsBurialSite) {
|
||||||
addWorkOrderBurialSite({
|
addWorkOrderBurialSite({
|
||||||
workOrderId: workOrder?.workOrderId,
|
burialSiteId: burialSite?.burialSiteId,
|
||||||
burialSiteId: burialSite?.burialSiteId
|
workOrderId: workOrder?.workOrderId
|
||||||
}, user);
|
}, user);
|
||||||
workOrder?.workOrderBurialSites?.push(burialSite);
|
workOrder?.workOrderBurialSites?.push(burialSite);
|
||||||
}
|
}
|
||||||
|
|
@ -633,8 +633,8 @@ async function importFromWorkOrderCSV() {
|
||||||
const contractId = addContract({
|
const contractId = addContract({
|
||||||
burialSiteId: burialSite ? burialSite.burialSiteId : '',
|
burialSiteId: burialSite ? burialSite.burialSiteId : '',
|
||||||
contractTypeId: contractType.contractTypeId,
|
contractTypeId: contractType.contractTypeId,
|
||||||
contractStartDateString,
|
|
||||||
contractEndDateString: '',
|
contractEndDateString: '',
|
||||||
|
contractStartDateString,
|
||||||
funeralHomeId,
|
funeralHomeId,
|
||||||
funeralDirectorName: workOrderRow.WO_FUNERAL_HOME,
|
funeralDirectorName: workOrderRow.WO_FUNERAL_HOME,
|
||||||
funeralDateString: workOrderRow.WO_FUNERAL_YR === ''
|
funeralDateString: workOrderRow.WO_FUNERAL_YR === ''
|
||||||
|
|
@ -656,8 +656,8 @@ async function importFromWorkOrderCSV() {
|
||||||
intermentContainerTypeId
|
intermentContainerTypeId
|
||||||
}, user);
|
}, user);
|
||||||
addWorkOrderContract({
|
addWorkOrderContract({
|
||||||
workOrderId: workOrder?.workOrderId,
|
contractId,
|
||||||
contractId
|
workOrderId: workOrder?.workOrderId
|
||||||
}, user);
|
}, user);
|
||||||
// Milestones
|
// Milestones
|
||||||
let hasIncompleteMilestones = !workOrderRow.WO_CONFIRMATION_IN;
|
let hasIncompleteMilestones = !workOrderRow.WO_CONFIRMATION_IN;
|
||||||
|
|
|
||||||
|
|
@ -959,8 +959,8 @@ async function importFromWorkOrderCSV(): Promise<void> {
|
||||||
if (!workOrderContainsBurialSite) {
|
if (!workOrderContainsBurialSite) {
|
||||||
addWorkOrderBurialSite(
|
addWorkOrderBurialSite(
|
||||||
{
|
{
|
||||||
workOrderId: workOrder?.workOrderId as number,
|
burialSiteId: burialSite?.burialSiteId as number,
|
||||||
burialSiteId: burialSite?.burialSiteId as number
|
workOrderId: workOrder?.workOrderId as number
|
||||||
},
|
},
|
||||||
user
|
user
|
||||||
)
|
)
|
||||||
|
|
@ -1011,8 +1011,9 @@ async function importFromWorkOrderCSV(): Promise<void> {
|
||||||
{
|
{
|
||||||
burialSiteId: burialSite ? burialSite.burialSiteId : '',
|
burialSiteId: burialSite ? burialSite.burialSiteId : '',
|
||||||
contractTypeId: contractType.contractTypeId,
|
contractTypeId: contractType.contractTypeId,
|
||||||
contractStartDateString,
|
|
||||||
contractEndDateString: '',
|
contractEndDateString: '',
|
||||||
|
contractStartDateString,
|
||||||
|
|
||||||
funeralHomeId,
|
funeralHomeId,
|
||||||
funeralDirectorName: workOrderRow.WO_FUNERAL_HOME,
|
funeralDirectorName: workOrderRow.WO_FUNERAL_HOME,
|
||||||
|
|
@ -1052,8 +1053,8 @@ async function importFromWorkOrderCSV(): Promise<void> {
|
||||||
|
|
||||||
addWorkOrderContract(
|
addWorkOrderContract(
|
||||||
{
|
{
|
||||||
workOrderId: workOrder?.workOrderId as number,
|
contractId,
|
||||||
contractId
|
workOrderId: workOrder?.workOrderId as number
|
||||||
},
|
},
|
||||||
user
|
user
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue