pull/11/head
Dan Gowans 2025-04-15 14:48:26 -04:00
parent 2176158847
commit 6cb36c4548
75 changed files with 290 additions and 234 deletions

2
app.js
View File

@ -12,9 +12,9 @@ import createError from 'http-errors';
import FileStore from 'session-file-store'; import FileStore from 'session-file-store';
import { DEBUG_NAMESPACE } from './debug.config.js'; import { DEBUG_NAMESPACE } from './debug.config.js';
import * as permissionHandlers from './handlers/permissions.js'; import * as permissionHandlers from './handlers/permissions.js';
import { getSafeRedirectURL } from './helpers/authentication.helpers.js';
import * as configFunctions from './helpers/config.helpers.js'; import * as configFunctions from './helpers/config.helpers.js';
import { useTestDatabases } from './helpers/database.helpers.js'; import { useTestDatabases } from './helpers/database.helpers.js';
import { getSafeRedirectURL } from './helpers/functions.authentication.js';
import * as printFunctions from './helpers/functions.print.js'; import * as printFunctions from './helpers/functions.print.js';
import routerAdmin from './routes/admin.js'; import routerAdmin from './routes/admin.js';
import routerApi from './routes/api.js'; import routerApi from './routes/api.js';

2
app.ts
View File

@ -14,9 +14,9 @@ import FileStore from 'session-file-store'
import { DEBUG_NAMESPACE } from './debug.config.js' import { DEBUG_NAMESPACE } from './debug.config.js'
import * as permissionHandlers from './handlers/permissions.js' import * as permissionHandlers from './handlers/permissions.js'
import { getSafeRedirectURL } from './helpers/authentication.helpers.js'
import * as configFunctions from './helpers/config.helpers.js' import * as configFunctions from './helpers/config.helpers.js'
import { useTestDatabases } from './helpers/database.helpers.js' import { useTestDatabases } from './helpers/database.helpers.js'
import { getSafeRedirectURL } from './helpers/functions.authentication.js'
import * as printFunctions from './helpers/functions.print.js' import * as printFunctions from './helpers/functions.print.js'
import routerAdmin from './routes/admin.js' import routerAdmin from './routes/admin.js'
import routerApi from './routes/api.js' import routerApi from './routes/api.js'

View File

@ -1,12 +1,12 @@
export interface AddBurialSiteTypeFieldForm { export interface AddBurialSiteTypeFieldForm {
burialSiteTypeId: string | number; burialSiteTypeId: number | string;
burialSiteTypeField: string; burialSiteTypeField: string;
fieldType?: string; fieldType?: string;
fieldValues?: string; fieldValues?: string;
isRequired?: string; isRequired?: string;
pattern?: string; pattern?: string;
minLength?: string | number; minLength?: number | string;
maxLength?: string | number; maxLength?: number | string;
orderNumber?: number; orderNumber?: number;
} }
export default function addBurialSiteTypeField(addForm: AddBurialSiteTypeFieldForm, user: User): Promise<number>; export default function addBurialSiteTypeField(addForm: AddBurialSiteTypeFieldForm, user: User): Promise<number>;

View File

@ -3,14 +3,14 @@ import { clearCacheByTableName } from '../helpers/functions.cache.js'
import { acquireConnection } from './pool.js' import { acquireConnection } from './pool.js'
export interface AddBurialSiteTypeFieldForm { export interface AddBurialSiteTypeFieldForm {
burialSiteTypeId: string | number burialSiteTypeId: number | string
burialSiteTypeField: string burialSiteTypeField: string
fieldType?: string fieldType?: string
fieldValues?: string fieldValues?: string
isRequired?: string isRequired?: string
pattern?: string pattern?: string
minLength?: string | number minLength?: number | string
maxLength?: string | number maxLength?: number | string
orderNumber?: number orderNumber?: number
} }

View File

@ -3,8 +3,8 @@ export interface UpdateBurialSiteTypeFieldForm {
burialSiteTypeField: string; burialSiteTypeField: string;
isRequired: '0' | '1'; isRequired: '0' | '1';
fieldType?: string; fieldType?: string;
minLength?: string;
maxLength?: string; maxLength?: string;
minLength?: string;
pattern?: string; pattern?: string;
fieldValues: string; fieldValues: string;
} }

View File

@ -7,8 +7,8 @@ export interface UpdateBurialSiteTypeFieldForm {
burialSiteTypeField: string burialSiteTypeField: string
isRequired: '0' | '1' isRequired: '0' | '1'
fieldType?: string fieldType?: string
minLength?: string
maxLength?: string maxLength?: string
minLength?: string
pattern?: string pattern?: string
fieldValues: string fieldValues: string
} }

View File

@ -14,4 +14,11 @@ export interface UpdateCemeteryForm {
cemeteryLongitude: string; cemeteryLongitude: string;
cemeterySvg: string; cemeterySvg: string;
} }
/**
* Updates a cemetery in the database.
* Be sure to rebuild burial site names after updating a cemetery.
* @param updateForm - The form data from the update cemetery form.
* @param user - The user who is updating the cemetery.
* @returns `true` if the cemetery was updated successfully, `false` otherwise.
*/
export default function updateCemetery(updateForm: UpdateCemeteryForm, user: User): Promise<boolean>; export default function updateCemetery(updateForm: UpdateCemeteryForm, user: User): Promise<boolean>;

View File

@ -1,4 +1,11 @@
import { acquireConnection } from './pool.js'; import { acquireConnection } from './pool.js';
/**
* Updates a cemetery in the database.
* Be sure to rebuild burial site names after updating a cemetery.
* @param updateForm - The form data from the update cemetery form.
* @param user - The user who is updating the cemetery.
* @returns `true` if the cemetery was updated successfully, `false` otherwise.
*/
export default async function updateCemetery(updateForm, user) { export default async function updateCemetery(updateForm, user) {
const database = await acquireConnection(); const database = await acquireConnection();
const result = database const result = database

View File

@ -21,6 +21,13 @@ export interface UpdateCemeteryForm {
cemeterySvg: string cemeterySvg: string
} }
/**
* Updates a cemetery in the database.
* Be sure to rebuild burial site names after updating a cemetery.
* @param updateForm - The form data from the update cemetery form.
* @param user - The user who is updating the cemetery.
* @returns `true` if the cemetery was updated successfully, `false` otherwise.
*/
export default async function updateCemetery( export default async function updateCemetery(
updateForm: UpdateCemeteryForm, updateForm: UpdateCemeteryForm,
user: User user: User

View File

@ -1,23 +1,23 @@
import { type DateString, type TimeString } from '@cityssm/utils-datetime'; import { type DateString, type TimeString } from '@cityssm/utils-datetime';
export interface UpdateContractForm { export interface UpdateContractForm {
contractId: string | number; contractId: number | string;
contractTypeId: string | number; burialSiteId: number | string;
burialSiteId: string | number; contractTypeId: number | string;
contractEndDateString: '' | DateString;
contractStartDateString: DateString; contractStartDateString: DateString;
contractEndDateString: DateString | ''; funeralHomeId?: number | string;
funeralHomeId?: string | number; committalTypeId?: number | string;
funeralDateString: '' | DateString;
funeralDirectorName: string; funeralDirectorName: string;
funeralDateString: DateString | ''; funeralTimeString: '' | TimeString;
funeralTimeString: TimeString | '';
committalTypeId?: string | number;
purchaserName?: string; purchaserName?: string;
purchaserAddress1?: string; purchaserAddress1?: string;
purchaserAddress2?: string; purchaserAddress2?: string;
purchaserCity?: string; purchaserCity?: string;
purchaserProvince?: string;
purchaserPostalCode?: string; purchaserPostalCode?: string;
purchaserPhoneNumber?: string; purchaserProvince?: string;
purchaserEmail?: string; purchaserEmail?: string;
purchaserPhoneNumber?: string;
purchaserRelationship?: string; purchaserRelationship?: string;
contractTypeFieldIds?: string; contractTypeFieldIds?: string;
[fieldValue_contractTypeFieldId: `fieldValue_${string}`]: unknown; [fieldValue_contractTypeFieldId: `fieldValue_${string}`]: unknown;

View File

@ -10,27 +10,31 @@ import deleteContractField from './deleteContractField.js'
import { acquireConnection } from './pool.js' import { acquireConnection } from './pool.js'
export interface UpdateContractForm { export interface UpdateContractForm {
contractId: string | number contractId: number | string
contractTypeId: string | number
burialSiteId: string | number
burialSiteId: number | string
contractTypeId: number | string
contractEndDateString: '' | DateString
contractStartDateString: DateString contractStartDateString: DateString
contractEndDateString: DateString | ''
funeralHomeId?: string | number funeralHomeId?: number | string
committalTypeId?: number | string
funeralDateString: '' | DateString
funeralDirectorName: string funeralDirectorName: string
funeralDateString: DateString | '' funeralTimeString: '' | TimeString
funeralTimeString: TimeString | ''
committalTypeId?: string | number
purchaserName?: string purchaserName?: string
purchaserAddress1?: string purchaserAddress1?: string
purchaserAddress2?: string purchaserAddress2?: string
purchaserCity?: string purchaserCity?: string
purchaserProvince?: string
purchaserPostalCode?: string purchaserPostalCode?: string
purchaserPhoneNumber?: string purchaserProvince?: string
purchaserEmail?: string purchaserEmail?: string
purchaserPhoneNumber?: string
purchaserRelationship?: string purchaserRelationship?: string
contractTypeFieldIds?: string contractTypeFieldIds?: string

View File

@ -1,6 +1,6 @@
import { type DateString, type TimeString } from '@cityssm/utils-datetime'; import { type DateString, type TimeString } from '@cityssm/utils-datetime';
export interface UpdateForm { export interface UpdateForm {
contractCommentId: string | number; contractCommentId: number | string;
commentDateString: DateString; commentDateString: DateString;
commentTimeString: TimeString; commentTimeString: TimeString;
comment: string; comment: string;

View File

@ -8,7 +8,7 @@ import {
import { acquireConnection } from './pool.js' import { acquireConnection } from './pool.js'
export interface UpdateForm { export interface UpdateForm {
contractCommentId: string | number contractCommentId: number | string
commentDateString: DateString commentDateString: DateString
commentTimeString: TimeString commentTimeString: TimeString
comment: string comment: string

View File

@ -1,6 +1,6 @@
export interface UpdateBurialSiteFeeForm { export interface UpdateBurialSiteFeeForm {
contractId: string | number; contractId: number | string;
feeId: string | number; feeId: number | string;
quantity: string | number; quantity: number | string;
} }
export default function updateContractFeeQuantity(feeQuantityForm: UpdateBurialSiteFeeForm, user: User): Promise<boolean>; export default function updateContractFeeQuantity(feeQuantityForm: UpdateBurialSiteFeeForm, user: User): Promise<boolean>;

View File

@ -1,9 +1,9 @@
import { acquireConnection } from './pool.js' import { acquireConnection } from './pool.js'
export interface UpdateBurialSiteFeeForm { export interface UpdateBurialSiteFeeForm {
contractId: string | number contractId: number | string
feeId: string | number feeId: number | string
quantity: string | number quantity: number | string
} }
export default async function updateContractFeeQuantity( export default async function updateContractFeeQuantity(

View File

@ -1,19 +1,19 @@
import { type DateString } from '@cityssm/utils-datetime'; import { type DateString } from '@cityssm/utils-datetime';
export interface UpdateForm { export interface UpdateForm {
contractId: string | number; contractId: number | string;
intermentNumber: string | number; intermentNumber: number | string;
deceasedName: string; deceasedName: string;
deceasedAddress1: string; deceasedAddress1: string;
deceasedAddress2: string; deceasedAddress2: string;
deceasedCity: string; deceasedCity: string;
deceasedProvince: string;
deceasedPostalCode: string; deceasedPostalCode: string;
birthDateString: DateString | ''; deceasedProvince: string;
birthDateString: '' | DateString;
birthPlace: string; birthPlace: string;
deathDateString: DateString | ''; deathDateString: '' | DateString;
deathPlace: string; deathPlace: string;
deathAge: string; deathAge: string;
deathAgePeriod: string; deathAgePeriod: string;
intermentContainerTypeId: string | number; intermentContainerTypeId: number | string;
} }
export default function updateContractInterment(contractForm: UpdateForm, user: User): Promise<boolean>; export default function updateContractInterment(contractForm: UpdateForm, user: User): Promise<boolean>;

View File

@ -3,21 +3,26 @@ import { type DateString, dateStringToInteger } from '@cityssm/utils-datetime'
import { acquireConnection } from './pool.js' import { acquireConnection } from './pool.js'
export interface UpdateForm { export interface UpdateForm {
contractId: string | number contractId: number | string
intermentNumber: string | number intermentNumber: number | string
deceasedName: string deceasedName: string
deceasedAddress1: string deceasedAddress1: string
deceasedAddress2: string deceasedAddress2: string
deceasedCity: string deceasedCity: string
deceasedProvince: string
deceasedPostalCode: string deceasedPostalCode: string
birthDateString: DateString | '' deceasedProvince: string
birthDateString: '' | DateString
birthPlace: string birthPlace: string
deathDateString: DateString | '' deathDateString: '' | DateString
deathPlace: string deathPlace: string
deathAge: string deathAge: string
deathAgePeriod: string deathAgePeriod: string
intermentContainerTypeId: string | number
intermentContainerTypeId: number | string
} }
export default async function updateContractInterment( export default async function updateContractInterment(

View File

@ -1,11 +1,11 @@
import { type DateString, type TimeString } from '@cityssm/utils-datetime'; import { type DateString, type TimeString } from '@cityssm/utils-datetime';
export interface ContractTransactionUpdateForm { export interface ContractTransactionUpdateForm {
contractId: string | number; contractId: number | string;
transactionIndex: string | number; transactionIndex: number | string;
transactionDateString: DateString; transactionDateString: DateString;
transactionTimeString: TimeString; transactionTimeString: TimeString;
transactionAmount: string | number;
externalReceiptNumber: string; externalReceiptNumber: string;
transactionAmount: number | string;
transactionNote: string; transactionNote: string;
} }
export default function updateContractTransaction(updateForm: ContractTransactionUpdateForm, user: User): Promise<boolean>; export default function updateContractTransaction(updateForm: ContractTransactionUpdateForm, user: User): Promise<boolean>;

View File

@ -8,12 +8,14 @@ import {
import { acquireConnection } from './pool.js' import { acquireConnection } from './pool.js'
export interface ContractTransactionUpdateForm { export interface ContractTransactionUpdateForm {
contractId: string | number contractId: number | string
transactionIndex: string | number transactionIndex: number | string
transactionDateString: DateString transactionDateString: DateString
transactionTimeString: TimeString transactionTimeString: TimeString
transactionAmount: string | number
externalReceiptNumber: string externalReceiptNumber: string
transactionAmount: number | string
transactionNote: string transactionNote: string
} }

View File

@ -17,7 +17,7 @@ export default async function updateWorkOrderMilestone(milestoneForm, user) {
? 0 ? 0
: dateStringToInteger(milestoneForm.workOrderMilestoneDateString), (milestoneForm.workOrderMilestoneTimeString ?? '') === '' : dateStringToInteger(milestoneForm.workOrderMilestoneDateString), (milestoneForm.workOrderMilestoneTimeString ?? '') === ''
? 0 ? 0
: timeStringToInteger(milestoneForm.workOrderMilestoneTimeString), milestoneForm.workOrderMilestoneDescription, user.userName, Date.now(), milestoneForm.workOrderMilestoneId); : timeStringToInteger(milestoneForm.workOrderMilestoneTimeString ?? ''), milestoneForm.workOrderMilestoneDescription, user.userName, Date.now(), milestoneForm.workOrderMilestoneId);
database.release(); database.release();
return result.changes > 0; return result.changes > 0;
} }

View File

@ -40,7 +40,7 @@ export default async function updateWorkOrderMilestone(
: dateStringToInteger(milestoneForm.workOrderMilestoneDateString), : dateStringToInteger(milestoneForm.workOrderMilestoneDateString),
(milestoneForm.workOrderMilestoneTimeString ?? '') === '' (milestoneForm.workOrderMilestoneTimeString ?? '') === ''
? 0 ? 0
: timeStringToInteger(milestoneForm.workOrderMilestoneTimeString!), : timeStringToInteger(milestoneForm.workOrderMilestoneTimeString ?? ''),
milestoneForm.workOrderMilestoneDescription, milestoneForm.workOrderMilestoneDescription,
user.userName, user.userName,

View File

@ -2,11 +2,11 @@
# Sunrise CMS Help Documentation # Sunrise CMS Help Documentation
**Thank you for taking the time to read the documentation.** **Thank you for taking the time to read the Sunrise Cemetery Management System (CMS) documentation.**
![Burial Site View](./burialSite-view.png) ![Burial Site View](./burialSite-view.png)
**Coming soon.** **In development**
## 👩 User Documentation ## 👩 User Documentation

View File

@ -4,7 +4,8 @@
# Installation # Installation
While Sunrise CMS can run on a high end server, that is by no means a requirement. While the Sunrise Cemetery Management System (CMS) can run on a high end server,
that is by no means a requirement.
Most user workstations are sufficient for modest installations. Most user workstations are sufficient for modest installations.
## Minimum Requirements ## Minimum Requirements

View File

@ -10,6 +10,7 @@ export default async function handler(
response.render('admin-burialSiteTypes', { response.render('admin-burialSiteTypes', {
headTitle: "Burial Site Type Management", headTitle: "Burial Site Type Management",
burialSiteTypes burialSiteTypes
}) })
} }

View File

@ -13,9 +13,9 @@ export default async function handler(_request, response) {
} }
} }
response.render('admin-contractTypes', { response.render('admin-contractTypes', {
headTitle: "Contract Type Management", headTitle: 'Contract Type Management',
contractTypes,
allContractTypeFields, allContractTypeFields,
contractTypePrintTitles contractTypePrintTitles,
contractTypes
}); });
} }

View File

@ -27,9 +27,10 @@ export default async function handler(
} }
response.render('admin-contractTypes', { response.render('admin-contractTypes', {
headTitle: "Contract Type Management", headTitle: 'Contract Type Management',
contractTypes,
allContractTypeFields, allContractTypeFields,
contractTypePrintTitles contractTypePrintTitles,
contractTypes
}) })
} }

View File

@ -8,8 +8,8 @@ export default async function handler(_request, response) {
const burialSiteTypes = await getBurialSiteTypes(); const burialSiteTypes = await getBurialSiteTypes();
response.render('admin-fees', { response.render('admin-fees', {
headTitle: 'Fee Management', headTitle: 'Fee Management',
feeCategories, burialSiteTypes,
contractTypes, contractTypes,
burialSiteTypes feeCategories
}); });
} }

View File

@ -22,8 +22,9 @@ export default async function handler(
response.render('admin-fees', { response.render('admin-fees', {
headTitle: 'Fee Management', headTitle: 'Fee Management',
feeCategories,
burialSiteTypes,
contractTypes, contractTypes,
burialSiteTypes feeCategories
}) })
} }

View File

@ -5,8 +5,8 @@ export default async function handler(_request, response) {
const burialSiteStatuses = await getBurialSiteStatuses(); const burialSiteStatuses = await getBurialSiteStatuses();
response.render('admin-tables', { response.render('admin-tables', {
headTitle: 'Config Table Management', headTitle: 'Config Table Management',
workOrderTypes, burialSiteStatuses,
workOrderMilestoneTypes, workOrderMilestoneTypes,
burialSiteStatuses workOrderTypes
}); });
} }

View File

@ -16,8 +16,9 @@ export default async function handler(
response.render('admin-tables', { response.render('admin-tables', {
headTitle: 'Config Table Management', headTitle: 'Config Table Management',
workOrderTypes,
burialSiteStatuses,
workOrderMilestoneTypes, workOrderMilestoneTypes,
burialSiteStatuses workOrderTypes
}) })
} }

View File

@ -17,10 +17,10 @@ export default async function handler(request, response) {
response.render('contract-edit', { response.render('contract-edit', {
headTitle: 'Contract Update', headTitle: 'Contract Update',
contract, contract,
committalTypes,
contractTypePrints, contractTypePrints,
contractTypes, contractTypes,
funeralHomes, funeralHomes,
committalTypes,
intermentContainerTypes, intermentContainerTypes,
workOrderTypes, workOrderTypes,
isCreate: false isCreate: false

View File

@ -40,12 +40,13 @@ export default async function handler(
response.render('contract-edit', { response.render('contract-edit', {
headTitle: 'Contract Update', headTitle: 'Contract Update',
contract,
contractTypePrints,
contract,
committalTypes,
contractTypePrints,
contractTypes, contractTypes,
funeralHomes, funeralHomes,
committalTypes,
intermentContainerTypes, intermentContainerTypes,
workOrderTypes, workOrderTypes,

View File

@ -28,9 +28,9 @@ export default async function handler(request, response) {
response.render('contract-edit', { response.render('contract-edit', {
headTitle: 'Create a New Contract', headTitle: 'Create a New Contract',
contract, contract,
committalTypes,
contractTypes, contractTypes,
funeralHomes, funeralHomes,
committalTypes,
intermentContainerTypes, intermentContainerTypes,
isCreate: true isCreate: true
}); });

View File

@ -1,6 +1,7 @@
import { dateToInteger, dateToString } from '@cityssm/utils-datetime'
import type { Request, Response } from 'express' import type { Request, Response } from 'express'
import { dateToInteger, dateToString } from '@cityssm/utils-datetime'
import getBurialSite from '../../database/getBurialSite.js' import getBurialSite from '../../database/getBurialSite.js'
import getFuneralHomes from '../../database/getFuneralHomes.js' import getFuneralHomes from '../../database/getFuneralHomes.js'
import { getConfigProperty } from '../../helpers/config.helpers.js' import { getConfigProperty } from '../../helpers/config.helpers.js'
@ -39,11 +40,12 @@ export default async function handler(
response.render('contract-edit', { response.render('contract-edit', {
headTitle: 'Create a New Contract', headTitle: 'Create a New Contract',
contract, contract,
committalTypes,
contractTypes, contractTypes,
funeralHomes, funeralHomes,
committalTypes,
intermentContainerTypes, intermentContainerTypes,
isCreate: true isCreate: true

View File

@ -7,11 +7,11 @@ export default async function handler(request, response) {
const contractTypes = await getContractTypes(); const contractTypes = await getContractTypes();
const funeralHomes = await getFuneralHomes(); const funeralHomes = await getFuneralHomes();
response.render('contract-search', { response.render('contract-search', {
headTitle: "Contract Search", headTitle: 'Contract Search',
cemeteries,
burialSiteTypes, burialSiteTypes,
cemeteries,
cemeteryId: request.query.cemeteryId,
contractTypes, contractTypes,
funeralHomes, funeralHomes
cemeteryId: request.query.cemeteryId
}); });
} }

View File

@ -17,11 +17,12 @@ export default async function handler(
const funeralHomes = await getFuneralHomes() const funeralHomes = await getFuneralHomes()
response.render('contract-search', { response.render('contract-search', {
headTitle: "Contract Search", headTitle: 'Contract Search',
cemeteries,
burialSiteTypes, burialSiteTypes,
cemeteries,
cemeteryId: request.query.cemeteryId,
contractTypes, contractTypes,
funeralHomes, funeralHomes
cemeteryId: request.query.cemeteryId
}) })
} }

View File

@ -27,6 +27,7 @@ export default async function handler(
response.render('contract-view', { response.render('contract-view', {
headTitle: `Contract #${contract.contractId.toString()}`, headTitle: `Contract #${contract.contractId.toString()}`,
contract, contract,
contractTypePrints contractTypePrints
}) })

View File

@ -1,6 +1,7 @@
import { dateToString } from '@cityssm/utils-datetime'
import type { Request, Response } from 'express' import type { Request, Response } from 'express'
import { dateToString } from '@cityssm/utils-datetime'
import getWorkOrderMilestones from '../../database/getWorkOrderMilestones.js' import getWorkOrderMilestones from '../../database/getWorkOrderMilestones.js'
export default async function handler( export default async function handler(

View File

@ -8,7 +8,7 @@ export default async function handler(request, response) {
} }
response.render('funeralHome-edit', { response.render('funeralHome-edit', {
headTitle: funeralHome.funeralHomeName, headTitle: funeralHome.funeralHomeName,
isCreate: false, funeralHome,
funeralHome isCreate: false
}); });
} }

View File

@ -18,7 +18,8 @@ export default async function handler(
response.render('funeralHome-edit', { response.render('funeralHome-edit', {
headTitle: funeralHome.funeralHomeName, headTitle: funeralHome.funeralHomeName,
isCreate: false,
funeralHome funeralHome,
isCreate: false
}) })
} }

View File

@ -5,8 +5,8 @@ export default function handler(_request, response) {
funeralHomeProvince: getConfigProperty('settings.provinceDefault') funeralHomeProvince: getConfigProperty('settings.provinceDefault')
}; };
response.render('funeralHome-edit', { response.render('funeralHome-edit', {
headTitle: "Create a Funeral Home", headTitle: 'Create a Funeral Home',
isCreate: true, funeralHome,
funeralHome isCreate: true
}); });
} }

View File

@ -10,8 +10,9 @@ export default function handler(_request: Request, response: Response): void {
} }
response.render('funeralHome-edit', { response.render('funeralHome-edit', {
headTitle: "Create a Funeral Home", headTitle: 'Create a Funeral Home',
isCreate: true,
funeralHome funeralHome,
isCreate: true
}) })
} }

View File

@ -10,6 +10,7 @@ export default async function handler(
response.render('funeralHome-search', { response.render('funeralHome-search', {
headTitle: "Funeral Home Search", headTitle: "Funeral Home Search",
funeralHomes funeralHomes
}) })
} }

View File

@ -8,7 +8,6 @@ export default async function handler(request, response) {
} }
response.render('funeralHome-view', { response.render('funeralHome-view', {
headTitle: funeralHome.funeralHomeName, headTitle: funeralHome.funeralHomeName,
isCreate: false,
funeralHome funeralHome
}); });
} }

View File

@ -18,7 +18,7 @@ export default async function handler(
response.render('funeralHome-view', { response.render('funeralHome-view', {
headTitle: funeralHome.funeralHomeName, headTitle: funeralHome.funeralHomeName,
isCreate: false,
funeralHome funeralHome
}) })
} }

View File

@ -1,4 +1,5 @@
import type { Request, Response } from 'express' import type { Request, Response } from 'express'
import papaParse from 'papaparse' import papaParse from 'papaparse'
import getReportData, { import getReportData, {
@ -19,6 +20,7 @@ export default async function handler(
if (rows === undefined) { if (rows === undefined) {
response.status(404).json({ response.status(404).json({
success: false, success: false,
message: 'Report Not Found' message: 'Report Not Found'
}) })

View File

@ -8,9 +8,9 @@ export default async function handler(_request, response) {
const burialSiteStatuses = await getBurialSiteStatuses(); const burialSiteStatuses = await getBurialSiteStatuses();
response.render('report-search', { response.render('report-search', {
headTitle: 'Reports', headTitle: 'Reports',
todayDateString: dateToString(rightNow), burialSiteStatuses,
cemeteries,
burialSiteTypes, burialSiteTypes,
burialSiteStatuses cemeteries,
todayDateString: dateToString(rightNow)
}); });
} }

View File

@ -1,6 +1,7 @@
import { dateToString } from '@cityssm/utils-datetime'
import type { Request, Response } from 'express' import type { Request, Response } from 'express'
import { dateToString } from '@cityssm/utils-datetime'
import getCemeteries from '../../database/getCemeteries.js' import getCemeteries from '../../database/getCemeteries.js'
import { import {
getBurialSiteStatuses, getBurialSiteStatuses,
@ -19,9 +20,10 @@ export default async function handler(
response.render('report-search', { response.render('report-search', {
headTitle: 'Reports', headTitle: 'Reports',
todayDateString: dateToString(rightNow),
cemeteries, burialSiteStatuses,
burialSiteTypes, burialSiteTypes,
burialSiteStatuses cemeteries,
todayDateString: dateToString(rightNow)
}) })
} }

View File

@ -21,9 +21,9 @@ export default async function handler(request, response) {
response.render('workOrder-edit', { response.render('workOrder-edit', {
headTitle: `Work Order #${workOrder.workOrderNumber}`, headTitle: `Work Order #${workOrder.workOrderNumber}`,
workOrder, workOrder,
burialSiteStatuses,
isCreate: false, isCreate: false,
workOrderTypes,
workOrderMilestoneTypes, workOrderMilestoneTypes,
burialSiteStatuses workOrderTypes
}); });
} }

View File

@ -44,10 +44,12 @@ export default async function handler(
response.render('workOrder-edit', { response.render('workOrder-edit', {
headTitle: `Work Order #${workOrder.workOrderNumber}`, headTitle: `Work Order #${workOrder.workOrderNumber}`,
workOrder, workOrder,
burialSiteStatuses,
isCreate: false, isCreate: false,
workOrderTypes,
workOrderMilestoneTypes, workOrderMilestoneTypes,
burialSiteStatuses workOrderTypes
}) })
} }

View File

@ -1,6 +1,7 @@
import { dateToInteger, dateToString } from '@cityssm/utils-datetime'
import type { Request, Response } from 'express' import type { Request, Response } from 'express'
import { dateToInteger, dateToString } from '@cityssm/utils-datetime'
import { getWorkOrderTypes } from '../../helpers/functions.cache.js' import { getWorkOrderTypes } from '../../helpers/functions.cache.js'
import type { WorkOrder } from '../../types/recordTypes.js' import type { WorkOrder } from '../../types/recordTypes.js'
@ -19,9 +20,10 @@ export default async function handler(
response.render('workOrder-edit', { response.render('workOrder-edit', {
headTitle: 'New Work Order', headTitle: 'New Work Order',
workOrder, workOrder,
isCreate: true, isCreate: true,
workOrderTypes workOrderTypes
}) })
} }

View File

@ -4,7 +4,7 @@ export default async function handler(request, response) {
const workOrderMilestoneTypes = await getWorkOrderMilestoneTypes(); const workOrderMilestoneTypes = await getWorkOrderMilestoneTypes();
response.render('workOrder-outlook', { response.render('workOrder-outlook', {
headTitle: 'Work Order Outlook Integration', headTitle: 'Work Order Outlook Integration',
workOrderTypes, workOrderMilestoneTypes,
workOrderMilestoneTypes workOrderTypes
}); });
} }

View File

@ -14,8 +14,8 @@ export default async function handler(
response.render('workOrder-outlook', { response.render('workOrder-outlook', {
headTitle: 'Work Order Outlook Integration', headTitle: 'Work Order Outlook Integration',
workOrderTypes,
workOrderMilestoneTypes workOrderMilestoneTypes,
workOrderTypes
}) })
} }

View File

@ -4,7 +4,7 @@ export default async function handler(request, response) {
const workOrderTypes = await getWorkOrderTypes(); const workOrderTypes = await getWorkOrderTypes();
response.render('workOrder-search', { response.render('workOrder-search', {
headTitle: 'Work Order Search', headTitle: 'Work Order Search',
workOrderTypes, workOrderOpenDateString,
workOrderOpenDateString workOrderTypes
}); });
} }

View File

@ -12,8 +12,8 @@ export default async function handler(
response.render('workOrder-search', { response.render('workOrder-search', {
headTitle: 'Work Order Search', headTitle: 'Work Order Search',
workOrderTypes,
workOrderOpenDateString workOrderOpenDateString,
workOrderTypes
}) })
} }

View File

@ -2,7 +2,7 @@ import fs from 'node:fs/promises';
import Debug from 'debug'; import Debug from 'debug';
import { DEBUG_NAMESPACE } from '../debug.config.js'; import { DEBUG_NAMESPACE } from '../debug.config.js';
import { getConfigProperty } from './config.helpers.js'; import { getConfigProperty } from './config.helpers.js';
const debug = Debug(`${DEBUG_NAMESPACE}:database.helpers`); const debug = Debug(`${DEBUG_NAMESPACE}:database.helpers:${process.pid}`);
export const useTestDatabases = getConfigProperty('application.useTestDatabases') || export const useTestDatabases = getConfigProperty('application.useTestDatabases') ||
process.env.TEST_DATABASES === 'true'; process.env.TEST_DATABASES === 'true';
if (useTestDatabases) { if (useTestDatabases) {

View File

@ -6,7 +6,7 @@ import { DEBUG_NAMESPACE } from '../debug.config.js'
import { getConfigProperty } from './config.helpers.js' import { getConfigProperty } from './config.helpers.js'
const debug = Debug(`${DEBUG_NAMESPACE}:database.helpers`) const debug = Debug(`${DEBUG_NAMESPACE}:database.helpers:${process.pid}`)
export const useTestDatabases = export const useTestDatabases =
getConfigProperty('application.useTestDatabases') || getConfigProperty('application.useTestDatabases') ||

View File

@ -9,9 +9,12 @@
}, },
"scripts": { "scripts": {
"start": "cross-env NODE_ENV=production node ./bin/www.js", "start": "cross-env NODE_ENV=production node ./bin/www.js",
"dev:test": "cross-env NODE_ENV=dev DEBUG=sunrise:*,dynamics-gp:* TEST_DATABASES=true nodemon --inspect ./bin/www.js", "dev:test": "cross-env NODE_ENV=dev DEBUG=sunrise:*,dynamics-gp:* TEST_DATABASES=true nodemon ./bin/www.js",
"dev:test:process": "cross-env NODE_ENV=dev DEBUG=sunrise:* TEST_DATABASES=true nodemon --inspect ./bin/wwwProcess.js", "dev:test:inspect": "cross-env NODE_ENV=dev DEBUG=sunrise:*,dynamics-gp:* TEST_DATABASES=true nodemon --inspect ./bin/www.js",
"dev:live": "cross-env NODE_ENV=dev DEBUG=sunrise:* nodemon --inspect ./bin/www.js", "dev:test:process": "cross-env NODE_ENV=dev DEBUG=sunrise:* TEST_DATABASES=true nodemon ./bin/wwwProcess.js",
"dev:test:process:inspect": "cross-env NODE_ENV=dev DEBUG=sunrise:* TEST_DATABASES=true nodemon --inspect ./bin/wwwProcess.js",
"dev:live": "cross-env NODE_ENV=dev DEBUG=sunrise:* nodemon ./bin/www.js",
"dev:live:inspect": "cross-env NODE_ENV=dev DEBUG=sunrise:* nodemon --inspect ./bin/www.js",
"cy:open": "cypress open --config-file cypress.config.js", "cy:open": "cypress open --config-file cypress.config.js",
"cy:run": "cypress run --config-file cypress.config.js", "cy:run": "cypress run --config-file cypress.config.js",
"cy:run:firefox": "cypress run --config-file cypress.config.js --browser firefox", "cy:run:firefox": "cypress run --config-file cypress.config.js --browser firefox",

View File

@ -1,10 +1,10 @@
import Debug from 'debug'; import Debug from 'debug';
import { Router } from 'express'; import { Router } from 'express';
import { DEBUG_NAMESPACE } from '../debug.config.js'; import { DEBUG_NAMESPACE } from '../debug.config.js';
import { authenticate, getSafeRedirectURL } from '../helpers/authentication.helpers.js';
import { getConfigProperty } from '../helpers/config.helpers.js'; import { getConfigProperty } from '../helpers/config.helpers.js';
import { useTestDatabases } from '../helpers/database.helpers.js'; import { useTestDatabases } from '../helpers/database.helpers.js';
import { getApiKey } from '../helpers/functions.api.js'; import { getApiKey } from '../helpers/functions.api.js';
import { authenticate, getSafeRedirectURL } from '../helpers/functions.authentication.js';
const debug = Debug(`${DEBUG_NAMESPACE}:login`); const debug = Debug(`${DEBUG_NAMESPACE}:login`);
export const router = Router(); export const router = Router();
function getHandler(request, response) { function getHandler(request, response) {

View File

@ -2,13 +2,13 @@ import Debug from 'debug'
import { type Request, type Response, Router } from 'express' import { type Request, type Response, Router } from 'express'
import { DEBUG_NAMESPACE } from '../debug.config.js' import { DEBUG_NAMESPACE } from '../debug.config.js'
import { getConfigProperty } from '../helpers/config.helpers.js'
import { useTestDatabases } from '../helpers/database.helpers.js'
import { getApiKey } from '../helpers/functions.api.js'
import { import {
authenticate, authenticate,
getSafeRedirectURL getSafeRedirectURL
} from '../helpers/functions.authentication.js' } from '../helpers/authentication.helpers.js'
import { getConfigProperty } from '../helpers/config.helpers.js'
import { useTestDatabases } from '../helpers/database.helpers.js'
import { getApiKey } from '../helpers/functions.api.js'
const debug = Debug(`${DEBUG_NAMESPACE}:login`) const debug = Debug(`${DEBUG_NAMESPACE}:login`)
@ -40,7 +40,7 @@ async function postHandler(
request: Request< request: Request<
unknown, unknown,
unknown, unknown,
{ password: string; redirect: string; userName: string; } { password: string; redirect: string; userName: string }
>, >,
response: Response response: Response
): Promise<void> { ): Promise<void> {