linting
parent
a7ce5a99cb
commit
c460d073e7
|
|
@ -14,7 +14,9 @@ export default function addBurialSiteTypeField(addForm, user) {
|
|||
recordCreate_userName, recordCreate_timeMillis,
|
||||
recordUpdate_userName, recordUpdate_timeMillis)
|
||||
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();
|
||||
clearCacheByTableName('BurialSiteTypeFields');
|
||||
return result.lastInsertRowid;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ export default function addBurialSiteTypeField(
|
|||
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,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import { type DateString, type TimeString } from '@cityssm/utils-datetime';
|
||||
export interface AddTransactionForm {
|
||||
contractId: number | string;
|
||||
transactionDateString?: string;
|
||||
transactionTimeString?: string;
|
||||
transactionDateString?: '' | DateString;
|
||||
transactionTimeString?: '' | TimeString;
|
||||
externalReceiptNumber: string;
|
||||
transactionAmount: number | string;
|
||||
transactionNote: string;
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ export default function addContractTransaction(contractTransactionForm, user) {
|
|||
transactionIndex = maxIndexResult.transactionIndex + 1;
|
||||
}
|
||||
const rightNow = new Date();
|
||||
const transactionDate = contractTransactionForm.transactionDateString
|
||||
? dateStringToInteger(contractTransactionForm.transactionDateString)
|
||||
: dateToInteger(rightNow);
|
||||
const transactionTime = contractTransactionForm.transactionTimeString
|
||||
? timeStringToInteger(contractTransactionForm.transactionTimeString)
|
||||
: dateToTimeInteger(rightNow);
|
||||
const transactionDate = contractTransactionForm.transactionDateString === ''
|
||||
? dateToInteger(rightNow)
|
||||
: dateStringToInteger(contractTransactionForm.transactionDateString);
|
||||
const transactionTime = contractTransactionForm.transactionTimeString === ''
|
||||
? dateToTimeInteger(rightNow)
|
||||
: timeStringToInteger(contractTransactionForm.transactionTimeString);
|
||||
database
|
||||
.prepare(`insert into ContractTransactions (
|
||||
contractId, transactionIndex,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import {
|
||||
type DateString,
|
||||
type TimeString,
|
||||
dateStringToInteger,
|
||||
dateToInteger,
|
||||
dateToTimeInteger,
|
||||
|
|
@ -11,8 +13,8 @@ import { sunriseDB } from '../helpers/database.helpers.js'
|
|||
export interface AddTransactionForm {
|
||||
contractId: number | string
|
||||
|
||||
transactionDateString?: string
|
||||
transactionTimeString?: string
|
||||
transactionDateString?: '' | DateString
|
||||
transactionTimeString?: '' | TimeString
|
||||
|
||||
externalReceiptNumber: string
|
||||
transactionAmount: number | string
|
||||
|
|
@ -45,13 +47,19 @@ export default function addContractTransaction(
|
|||
|
||||
const rightNow = new Date()
|
||||
|
||||
const transactionDate = contractTransactionForm.transactionDateString
|
||||
? dateStringToInteger(contractTransactionForm.transactionDateString)
|
||||
: dateToInteger(rightNow)
|
||||
const transactionDate =
|
||||
contractTransactionForm.transactionDateString === ''
|
||||
? dateToInteger(rightNow)
|
||||
: dateStringToInteger(
|
||||
contractTransactionForm.transactionDateString as DateString
|
||||
)
|
||||
|
||||
const transactionTime = contractTransactionForm.transactionTimeString
|
||||
? timeStringToInteger(contractTransactionForm.transactionTimeString)
|
||||
: dateToTimeInteger(rightNow)
|
||||
const transactionTime =
|
||||
contractTransactionForm.transactionTimeString === ''
|
||||
? dateToTimeInteger(rightNow)
|
||||
: timeStringToInteger(
|
||||
contractTransactionForm.transactionTimeString as TimeString
|
||||
)
|
||||
|
||||
database
|
||||
.prepare(
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
export interface AddContractTypeFieldForm {
|
||||
contractTypeId?: number | string;
|
||||
contractTypeField: string;
|
||||
fieldValues?: string;
|
||||
fieldType?: string;
|
||||
fieldValues?: string;
|
||||
isRequired?: string;
|
||||
maxLength?: number | string;
|
||||
minLength?: number | string;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ export default function addContractTypeField(addForm, user) {
|
|||
recordCreate_userName, recordCreate_timeMillis,
|
||||
recordUpdate_userName, recordUpdate_timeMillis)
|
||||
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();
|
||||
clearCacheByTableName('ContractTypeFields');
|
||||
return result.lastInsertRowid;
|
||||
|
|
|
|||
|
|
@ -5,9 +5,11 @@ import { clearCacheByTableName } from '../helpers/functions.cache.js'
|
|||
|
||||
export interface AddContractTypeFieldForm {
|
||||
contractTypeId?: number | string
|
||||
|
||||
contractTypeField: string
|
||||
fieldValues?: string
|
||||
|
||||
fieldType?: string
|
||||
fieldValues?: string
|
||||
isRequired?: string
|
||||
maxLength?: number | string
|
||||
minLength?: number | string
|
||||
|
|
@ -43,6 +45,7 @@ export default function addContractTypeField(
|
|||
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,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import { clearCacheByTableName } from '../helpers/functions.cache.js'
|
|||
export interface AddContractTypePrintForm {
|
||||
contractTypeId: number | string
|
||||
printEJS: string
|
||||
|
||||
orderNumber?: number
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
export interface AddForm {
|
||||
funeralHomeName: string;
|
||||
funeralHomeKey: string;
|
||||
funeralHomeName: string;
|
||||
funeralHomeAddress1: string;
|
||||
funeralHomeAddress2: string;
|
||||
funeralHomeCity: string;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import sqlite from 'better-sqlite3'
|
|||
import { sunriseDB } from '../helpers/database.helpers.js'
|
||||
|
||||
export interface AddForm {
|
||||
funeralHomeName: string
|
||||
funeralHomeKey: string
|
||||
funeralHomeName: string
|
||||
|
||||
funeralHomeAddress1: string
|
||||
funeralHomeAddress2: string
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
export interface AddWorkOrderForm {
|
||||
workOrderTypeId: number | string;
|
||||
workOrderNumber?: string;
|
||||
workOrderDescription: string;
|
||||
workOrderOpenDateString?: string;
|
||||
workOrderNumber?: string;
|
||||
workOrderTypeId: number | string;
|
||||
workOrderCloseDateString?: string;
|
||||
workOrderOpenDateString?: string;
|
||||
contractId?: string;
|
||||
}
|
||||
export default function addWorkOrder(workOrderForm: AddWorkOrderForm, user: User): number;
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ export default function addWorkOrder(workOrderForm, user) {
|
|||
const workOrderId = result.lastInsertRowid;
|
||||
if ((workOrderForm.contractId ?? '') !== '') {
|
||||
addWorkOrderContract({
|
||||
contractId: workOrderForm.contractId,
|
||||
workOrderId,
|
||||
contractId: workOrderForm.contractId
|
||||
}, user, database);
|
||||
}
|
||||
database.close();
|
||||
|
|
|
|||
|
|
@ -11,11 +11,14 @@ import addWorkOrderContract from './addWorkOrderContract.js'
|
|||
import getNextWorkOrderNumber from './getNextWorkOrderNumber.js'
|
||||
|
||||
export interface AddWorkOrderForm {
|
||||
workOrderTypeId: number | string
|
||||
workOrderNumber?: string
|
||||
workOrderDescription: string
|
||||
workOrderOpenDateString?: string
|
||||
workOrderNumber?: string
|
||||
|
||||
workOrderTypeId: number | string
|
||||
|
||||
workOrderCloseDateString?: string
|
||||
workOrderOpenDateString?: string
|
||||
|
||||
contractId?: string
|
||||
}
|
||||
|
||||
|
|
@ -67,8 +70,8 @@ export default function addWorkOrder(
|
|||
if ((workOrderForm.contractId ?? '') !== '') {
|
||||
addWorkOrderContract(
|
||||
{
|
||||
contractId: workOrderForm.contractId as string,
|
||||
workOrderId,
|
||||
contractId: workOrderForm.contractId as string
|
||||
},
|
||||
user,
|
||||
database
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
export interface AddForm {
|
||||
workOrderId: number | string;
|
||||
burialSiteId: number | string;
|
||||
workOrderId: number | string;
|
||||
}
|
||||
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'
|
||||
|
||||
export interface AddForm {
|
||||
workOrderId: number | string
|
||||
burialSiteId: number | string
|
||||
workOrderId: number | string
|
||||
}
|
||||
|
||||
export default function addWorkOrderBurialSite(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
export interface AddWorkOrderCommentForm {
|
||||
workOrderId: string;
|
||||
comment: string;
|
||||
workOrderId: string;
|
||||
}
|
||||
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'
|
||||
|
||||
export interface AddWorkOrderCommentForm {
|
||||
workOrderId: string
|
||||
comment: string
|
||||
workOrderId: string
|
||||
}
|
||||
|
||||
export default function addWorkOrderComment(
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ export default function cleanupDatabase(user) {
|
|||
.run(recordDeleteTimeMillisMin).changes;
|
||||
/*
|
||||
* Burial Site Contract Fees/Transactions
|
||||
* - Maintain financials, do not delete related.
|
||||
* - Maintain financial data, do not delete related.
|
||||
*/
|
||||
purgedRecordCount += database
|
||||
.prepare('delete from ContractFees where recordDelete_timeMillis <= ?')
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ export default function cleanupDatabase(user: User): {
|
|||
|
||||
/*
|
||||
* Burial Site Contract Fees/Transactions
|
||||
* - Maintain financials, do not delete related.
|
||||
* - Maintain financial data, do not delete related.
|
||||
*/
|
||||
|
||||
purgedRecordCount += database
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { type DateString } from '@cityssm/utils-datetime';
|
||||
export interface CloseWorkOrderForm {
|
||||
workOrderId: number | string;
|
||||
workOrderCloseDateString?: string;
|
||||
workOrderCloseDateString?: '' | DateString;
|
||||
}
|
||||
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 { sunriseDB } from '../helpers/database.helpers.js'
|
||||
|
|
@ -6,7 +10,7 @@ import { sunriseDB } from '../helpers/database.helpers.js'
|
|||
export interface CloseWorkOrderForm {
|
||||
workOrderId: number | string
|
||||
|
||||
workOrderCloseDateString?: string
|
||||
workOrderCloseDateString?: '' | DateString
|
||||
}
|
||||
|
||||
export default function closeWorkOrder(
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ export default async function copyContract(
|
|||
funeralDirectorName: oldContract.funeralDirectorName,
|
||||
funeralHomeId: oldContract.funeralHomeId ?? '',
|
||||
funeralTimeString: oldContract.funeralTimeString ?? '',
|
||||
|
||||
purchaserAddress1: oldContract.purchaserAddress1,
|
||||
purchaserAddress2: oldContract.purchaserAddress2,
|
||||
purchaserCity: oldContract.purchaserCity,
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@ export interface GetBurialSitesOptions {
|
|||
includeContractCount?: boolean;
|
||||
}
|
||||
export default function getBurialSites(filters: GetBurialSitesFilters, options: GetBurialSitesOptions, connectedDatabase?: sqlite.Database): {
|
||||
count: number;
|
||||
burialSites: BurialSite[];
|
||||
count: number;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { sunriseDB } from '../helpers/database.helpers.js';
|
|||
import { getBurialSiteNameWhereClause } from '../helpers/functions.sqlFilters.js';
|
||||
export default function getBurialSites(filters, options, connectedDatabase) {
|
||||
const database = connectedDatabase ?? sqlite(sunriseDB, { readonly: true });
|
||||
const { sqlWhereClause, sqlParameters } = buildWhereClause(filters);
|
||||
const { sqlParameters, sqlWhereClause } = buildWhereClause(filters);
|
||||
const currentDate = dateToInteger(new Date());
|
||||
let count = 0;
|
||||
if (options.limit !== -1) {
|
||||
|
|
@ -71,8 +71,8 @@ export default function getBurialSites(filters, options, connectedDatabase) {
|
|||
database.close();
|
||||
}
|
||||
return {
|
||||
count,
|
||||
burialSites
|
||||
burialSites,
|
||||
count
|
||||
};
|
||||
}
|
||||
function buildWhereClause(filters) {
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ export default function getBurialSites(
|
|||
filters: GetBurialSitesFilters,
|
||||
options: GetBurialSitesOptions,
|
||||
connectedDatabase?: sqlite.Database
|
||||
): { count: number; burialSites: BurialSite[] } {
|
||||
): { burialSites: BurialSite[]; count: number } {
|
||||
const database = connectedDatabase ?? sqlite(sunriseDB, { readonly: true })
|
||||
|
||||
const { sqlWhereClause, sqlParameters } = buildWhereClause(filters)
|
||||
const { sqlParameters, sqlWhereClause } = buildWhereClause(filters)
|
||||
|
||||
const currentDate = dateToInteger(new Date())
|
||||
|
||||
|
|
@ -120,8 +120,8 @@ export default function getBurialSites(
|
|||
}
|
||||
|
||||
return {
|
||||
count,
|
||||
burialSites
|
||||
burialSites,
|
||||
count
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -603,8 +603,8 @@ async function importFromWorkOrderCSV() {
|
|||
const workOrderContainsBurialSite = workOrder?.workOrderBurialSites?.find((possibleLot) => possibleLot.burialSiteId === burialSite?.burialSiteId);
|
||||
if (!workOrderContainsBurialSite) {
|
||||
addWorkOrderBurialSite({
|
||||
workOrderId: workOrder?.workOrderId,
|
||||
burialSiteId: burialSite?.burialSiteId
|
||||
burialSiteId: burialSite?.burialSiteId,
|
||||
workOrderId: workOrder?.workOrderId
|
||||
}, user);
|
||||
workOrder?.workOrderBurialSites?.push(burialSite);
|
||||
}
|
||||
|
|
@ -633,8 +633,8 @@ async function importFromWorkOrderCSV() {
|
|||
const contractId = addContract({
|
||||
burialSiteId: burialSite ? burialSite.burialSiteId : '',
|
||||
contractTypeId: contractType.contractTypeId,
|
||||
contractStartDateString,
|
||||
contractEndDateString: '',
|
||||
contractStartDateString,
|
||||
funeralHomeId,
|
||||
funeralDirectorName: workOrderRow.WO_FUNERAL_HOME,
|
||||
funeralDateString: workOrderRow.WO_FUNERAL_YR === ''
|
||||
|
|
@ -656,8 +656,8 @@ async function importFromWorkOrderCSV() {
|
|||
intermentContainerTypeId
|
||||
}, user);
|
||||
addWorkOrderContract({
|
||||
workOrderId: workOrder?.workOrderId,
|
||||
contractId
|
||||
contractId,
|
||||
workOrderId: workOrder?.workOrderId
|
||||
}, user);
|
||||
// Milestones
|
||||
let hasIncompleteMilestones = !workOrderRow.WO_CONFIRMATION_IN;
|
||||
|
|
|
|||
|
|
@ -959,8 +959,8 @@ async function importFromWorkOrderCSV(): Promise<void> {
|
|||
if (!workOrderContainsBurialSite) {
|
||||
addWorkOrderBurialSite(
|
||||
{
|
||||
workOrderId: workOrder?.workOrderId as number,
|
||||
burialSiteId: burialSite?.burialSiteId as number
|
||||
burialSiteId: burialSite?.burialSiteId as number,
|
||||
workOrderId: workOrder?.workOrderId as number
|
||||
},
|
||||
user
|
||||
)
|
||||
|
|
@ -1011,8 +1011,9 @@ async function importFromWorkOrderCSV(): Promise<void> {
|
|||
{
|
||||
burialSiteId: burialSite ? burialSite.burialSiteId : '',
|
||||
contractTypeId: contractType.contractTypeId,
|
||||
contractStartDateString,
|
||||
|
||||
contractEndDateString: '',
|
||||
contractStartDateString,
|
||||
|
||||
funeralHomeId,
|
||||
funeralDirectorName: workOrderRow.WO_FUNERAL_HOME,
|
||||
|
|
@ -1052,8 +1053,8 @@ async function importFromWorkOrderCSV(): Promise<void> {
|
|||
|
||||
addWorkOrderContract(
|
||||
{
|
||||
workOrderId: workOrder?.workOrderId as number,
|
||||
contractId
|
||||
contractId,
|
||||
workOrderId: workOrder?.workOrderId as number
|
||||
},
|
||||
user
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue