burial site images
- make cemetery svgs and burial site images only available to logged in userspull/3/head
50
app.js
|
|
@ -1,4 +1,5 @@
|
|||
import path from 'node:path';
|
||||
import { secondsToMillis } from '@cityssm/to-millis';
|
||||
import * as dateTimeFunctions from '@cityssm/utils-datetime';
|
||||
import compression from 'compression';
|
||||
import cookieParser from 'cookie-parser';
|
||||
|
|
@ -27,7 +28,6 @@ import routerPrint from './routes/print.js';
|
|||
import routerReports from './routes/reports.js';
|
||||
import routerWorkOrders from './routes/workOrders.js';
|
||||
import { version } from './version.js';
|
||||
import { secondsToMillis } from '@cityssm/to-millis';
|
||||
const debug = Debug(`${DEBUG_NAMESPACE}:app:${process.pid}`);
|
||||
/*
|
||||
* INITIALIZE APP
|
||||
|
|
@ -65,23 +65,6 @@ app.use(rateLimit({
|
|||
max: useTestDatabases ? 1_000_000 : 200,
|
||||
windowMs: secondsToMillis(10)
|
||||
}));
|
||||
/*
|
||||
* STATIC ROUTES
|
||||
*/
|
||||
const urlPrefix = configFunctions.getConfigProperty('reverseProxy.urlPrefix');
|
||||
if (urlPrefix !== '') {
|
||||
debug(`urlPrefix = ${urlPrefix}`);
|
||||
}
|
||||
app.use(urlPrefix, express.static(path.join('public')));
|
||||
app.use(`${urlPrefix}/lib/bulma`, express.static(path.join('node_modules', 'bulma', 'css')));
|
||||
app.use(`${urlPrefix}/lib/bulma-tooltip`, express.static(path.join('node_modules', 'bulma-tooltip', 'dist', 'css')));
|
||||
app.use(`${urlPrefix}/lib/cityssm-bulma-js/bulma-js.js`, express.static(path.join('node_modules', '@cityssm', 'bulma-js', 'dist', 'bulma-js.js')));
|
||||
app.use(`${urlPrefix}/lib/cityssm-fa-glow`, express.static(path.join('node_modules', '@cityssm', 'fa-glow')));
|
||||
app.use(`${urlPrefix}/lib/cityssm-bulma-sticky-table`, express.static(path.join('node_modules', '@cityssm', 'bulma-sticky-table')));
|
||||
app.use(`${urlPrefix}/lib/cityssm-bulma-webapp-js`, express.static(path.join('node_modules', '@cityssm', 'bulma-webapp-js', 'dist')));
|
||||
app.use(`${urlPrefix}/lib/fa`, express.static(path.join('node_modules', '@fortawesome', 'fontawesome-free')));
|
||||
app.use(`${urlPrefix}/lib/leaflet`, express.static(path.join('node_modules', 'leaflet', 'dist')));
|
||||
app.use(`${urlPrefix}/lib/randomcolor/randomColor.js`, express.static(path.join('node_modules', 'randomcolor', 'randomColor.js')));
|
||||
/*
|
||||
* SESSION MANAGEMENT
|
||||
*/
|
||||
|
|
@ -112,6 +95,34 @@ app.use((request, response, next) => {
|
|||
}
|
||||
next();
|
||||
});
|
||||
/*
|
||||
* STATIC ROUTES
|
||||
*/
|
||||
const urlPrefix = configFunctions.getConfigProperty('reverseProxy.urlPrefix');
|
||||
if (urlPrefix !== '') {
|
||||
debug(`urlPrefix = ${urlPrefix}`);
|
||||
}
|
||||
app.use(`${urlPrefix}/internal`, (request, response, next) => {
|
||||
if (Object.hasOwn(request.session, 'user') &&
|
||||
Object.hasOwn(request.cookies, sessionCookieName)) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
response.sendStatus(403);
|
||||
}, express.static(path.join('public-internal')));
|
||||
app.use(urlPrefix, express.static(path.join('public')));
|
||||
app.use(`${urlPrefix}/lib/bulma`, express.static(path.join('node_modules', 'bulma', 'css')));
|
||||
app.use(`${urlPrefix}/lib/bulma-tooltip`, express.static(path.join('node_modules', 'bulma-tooltip', 'dist', 'css')));
|
||||
app.use(`${urlPrefix}/lib/cityssm-bulma-js/bulma-js.js`, express.static(path.join('node_modules', '@cityssm', 'bulma-js', 'dist', 'bulma-js.js')));
|
||||
app.use(`${urlPrefix}/lib/cityssm-fa-glow`, express.static(path.join('node_modules', '@cityssm', 'fa-glow')));
|
||||
app.use(`${urlPrefix}/lib/cityssm-bulma-sticky-table`, express.static(path.join('node_modules', '@cityssm', 'bulma-sticky-table')));
|
||||
app.use(`${urlPrefix}/lib/cityssm-bulma-webapp-js`, express.static(path.join('node_modules', '@cityssm', 'bulma-webapp-js', 'dist')));
|
||||
app.use(`${urlPrefix}/lib/fa`, express.static(path.join('node_modules', '@fortawesome', 'fontawesome-free')));
|
||||
app.use(`${urlPrefix}/lib/leaflet`, express.static(path.join('node_modules', 'leaflet', 'dist')));
|
||||
app.use(`${urlPrefix}/lib/randomcolor/randomColor.js`, express.static(path.join('node_modules', 'randomcolor', 'randomColor.js')));
|
||||
/*
|
||||
* ROUTES
|
||||
*/
|
||||
// Redirect logged in users
|
||||
const sessionChecker = (request, response, next) => {
|
||||
if (Object.hasOwn(request.session, 'user') &&
|
||||
|
|
@ -122,9 +133,6 @@ const sessionChecker = (request, response, next) => {
|
|||
const redirectUrl = getSafeRedirectURL(request.originalUrl);
|
||||
response.redirect(`${urlPrefix}/login?redirect=${encodeURIComponent(redirectUrl)}`);
|
||||
};
|
||||
/*
|
||||
* ROUTES
|
||||
*/
|
||||
// Make the user and config objects available to the templates
|
||||
app.use((request, response, next) => {
|
||||
response.locals.buildNumber = version;
|
||||
|
|
|
|||
106
app.ts
|
|
@ -1,5 +1,6 @@
|
|||
import path from 'node:path'
|
||||
|
||||
import { secondsToMillis } from '@cityssm/to-millis'
|
||||
import * as dateTimeFunctions from '@cityssm/utils-datetime'
|
||||
import compression from 'compression'
|
||||
import cookieParser from 'cookie-parser'
|
||||
|
|
@ -29,7 +30,6 @@ import routerPrint from './routes/print.js'
|
|||
import routerReports from './routes/reports.js'
|
||||
import routerWorkOrders from './routes/workOrders.js'
|
||||
import { version } from './version.js'
|
||||
import { secondsToMillis } from '@cityssm/to-millis'
|
||||
|
||||
const debug = Debug(`${DEBUG_NAMESPACE}:app:${process.pid}`)
|
||||
|
||||
|
|
@ -87,6 +87,49 @@ app.use(
|
|||
})
|
||||
)
|
||||
|
||||
/*
|
||||
* SESSION MANAGEMENT
|
||||
*/
|
||||
|
||||
const sessionCookieName: string =
|
||||
configFunctions.getConfigProperty('session.cookieName')
|
||||
|
||||
const FileStoreSession = FileStore(session)
|
||||
|
||||
// Initialize session
|
||||
app.use(
|
||||
session({
|
||||
name: sessionCookieName,
|
||||
|
||||
cookie: {
|
||||
maxAge: configFunctions.getConfigProperty('session.maxAgeMillis'),
|
||||
sameSite: 'strict'
|
||||
},
|
||||
secret: configFunctions.getConfigProperty('session.secret'),
|
||||
store: new FileStoreSession({
|
||||
logFn: Debug(`${DEBUG_NAMESPACE}:session:${process.pid}`),
|
||||
path: './data/sessions',
|
||||
retries: 20
|
||||
}),
|
||||
|
||||
resave: true,
|
||||
rolling: true,
|
||||
saveUninitialized: false
|
||||
})
|
||||
)
|
||||
|
||||
// Clear cookie if no corresponding session
|
||||
app.use((request, response, next) => {
|
||||
if (
|
||||
Object.hasOwn(request.cookies, sessionCookieName) &&
|
||||
!Object.hasOwn(request.session, 'user')
|
||||
) {
|
||||
response.clearCookie(sessionCookieName)
|
||||
}
|
||||
|
||||
next()
|
||||
})
|
||||
|
||||
/*
|
||||
* STATIC ROUTES
|
||||
*/
|
||||
|
|
@ -97,6 +140,22 @@ if (urlPrefix !== '') {
|
|||
debug(`urlPrefix = ${urlPrefix}`)
|
||||
}
|
||||
|
||||
app.use(
|
||||
`${urlPrefix}/internal`,
|
||||
(request, response, next) => {
|
||||
if (
|
||||
Object.hasOwn(request.session, 'user') &&
|
||||
Object.hasOwn(request.cookies, sessionCookieName)
|
||||
) {
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
response.sendStatus(403)
|
||||
},
|
||||
express.static(path.join('public-internal'))
|
||||
)
|
||||
|
||||
app.use(urlPrefix, express.static(path.join('public')))
|
||||
|
||||
app.use(
|
||||
|
|
@ -149,48 +208,9 @@ app.use(
|
|||
)
|
||||
|
||||
/*
|
||||
* SESSION MANAGEMENT
|
||||
* ROUTES
|
||||
*/
|
||||
|
||||
const sessionCookieName: string =
|
||||
configFunctions.getConfigProperty('session.cookieName')
|
||||
|
||||
const FileStoreSession = FileStore(session)
|
||||
|
||||
// Initialize session
|
||||
app.use(
|
||||
session({
|
||||
name: sessionCookieName,
|
||||
|
||||
cookie: {
|
||||
maxAge: configFunctions.getConfigProperty('session.maxAgeMillis'),
|
||||
sameSite: 'strict'
|
||||
},
|
||||
secret: configFunctions.getConfigProperty('session.secret'),
|
||||
store: new FileStoreSession({
|
||||
logFn: Debug(`${DEBUG_NAMESPACE}:session:${process.pid}`),
|
||||
path: './data/sessions',
|
||||
retries: 20
|
||||
}),
|
||||
|
||||
resave: true,
|
||||
rolling: true,
|
||||
saveUninitialized: false
|
||||
})
|
||||
)
|
||||
|
||||
// Clear cookie if no corresponding session
|
||||
app.use((request, response, next) => {
|
||||
if (
|
||||
Object.hasOwn(request.cookies, sessionCookieName) &&
|
||||
!Object.hasOwn(request.session, 'user')
|
||||
) {
|
||||
response.clearCookie(sessionCookieName)
|
||||
}
|
||||
|
||||
next()
|
||||
})
|
||||
|
||||
// Redirect logged in users
|
||||
const sessionChecker = (
|
||||
request: express.Request,
|
||||
|
|
@ -212,10 +232,6 @@ const sessionChecker = (
|
|||
)
|
||||
}
|
||||
|
||||
/*
|
||||
* ROUTES
|
||||
*/
|
||||
|
||||
// Make the user and config objects available to the templates
|
||||
|
||||
app.use((request, response, next) => {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ export interface AddBurialSiteForm {
|
|||
burialSiteNameSegment5?: string;
|
||||
burialSiteStatusId: number | string;
|
||||
burialSiteTypeId: number | string;
|
||||
burialSiteImage: string;
|
||||
cemeteryId: number | string;
|
||||
cemeterySvgId: string;
|
||||
burialSiteLatitude: string;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export default async function addBurialSite(burialSiteForm, user) {
|
|||
burialSiteNameSegment5,
|
||||
burialSiteName,
|
||||
burialSiteTypeId, burialSiteStatusId,
|
||||
cemeteryId, cemeterySvgId,
|
||||
cemeteryId, cemeterySvgId, burialSiteImage,
|
||||
burialSiteLatitude, burialSiteLongitude,
|
||||
|
||||
recordCreate_userName, recordCreate_timeMillis,
|
||||
|
|
@ -47,7 +47,7 @@ export default async function addBurialSite(burialSiteForm, user) {
|
|||
?, ?, ?, ?)`)
|
||||
.run(burialSiteForm.burialSiteNameSegment1, burialSiteForm.burialSiteNameSegment2 ?? '', burialSiteForm.burialSiteNameSegment3 ?? '', burialSiteForm.burialSiteNameSegment4 ?? '', burialSiteForm.burialSiteNameSegment5 ?? '', burialSiteName, burialSiteForm.burialSiteTypeId, burialSiteForm.burialSiteStatusId === ''
|
||||
? undefined
|
||||
: burialSiteForm.burialSiteStatusId, burialSiteForm.cemeteryId === '' ? undefined : burialSiteForm.cemeteryId, burialSiteForm.cemeterySvgId, burialSiteForm.burialSiteLatitude === ''
|
||||
: burialSiteForm.burialSiteStatusId, burialSiteForm.cemeteryId === '' ? undefined : burialSiteForm.cemeteryId, burialSiteForm.cemeterySvgId, burialSiteForm.burialSiteImage, burialSiteForm.burialSiteLatitude === ''
|
||||
? undefined
|
||||
: burialSiteForm.burialSiteLatitude, burialSiteForm.burialSiteLongitude === ''
|
||||
? undefined
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ export interface AddBurialSiteForm {
|
|||
burialSiteStatusId: number | string
|
||||
burialSiteTypeId: number | string
|
||||
|
||||
burialSiteImage: string
|
||||
cemeteryId: number | string
|
||||
cemeterySvgId: string
|
||||
|
||||
|
|
@ -77,7 +78,7 @@ export default async function addBurialSite(
|
|||
burialSiteNameSegment5,
|
||||
burialSiteName,
|
||||
burialSiteTypeId, burialSiteStatusId,
|
||||
cemeteryId, cemeterySvgId,
|
||||
cemeteryId, cemeterySvgId, burialSiteImage,
|
||||
burialSiteLatitude, burialSiteLongitude,
|
||||
|
||||
recordCreate_userName, recordCreate_timeMillis,
|
||||
|
|
@ -99,6 +100,7 @@ export default async function addBurialSite(
|
|||
: burialSiteForm.burialSiteStatusId,
|
||||
burialSiteForm.cemeteryId === '' ? undefined : burialSiteForm.cemeteryId,
|
||||
burialSiteForm.cemeterySvgId,
|
||||
burialSiteForm.burialSiteImage,
|
||||
burialSiteForm.burialSiteLatitude === ''
|
||||
? undefined
|
||||
: burialSiteForm.burialSiteLatitude,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ const baseSQL = `select l.burialSiteId,
|
|||
l.burialSiteName,
|
||||
l.burialSiteStatusId, s.burialSiteStatus,
|
||||
l.cemeteryId, m.cemeteryName,
|
||||
m.cemeterySvg, l.cemeterySvgId,
|
||||
m.cemeterySvg, l.cemeterySvgId, l.burialSiteImage,
|
||||
l.burialSiteLatitude, l.burialSiteLongitude
|
||||
|
||||
from BurialSites l
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ const baseSQL = `select l.burialSiteId,
|
|||
l.burialSiteName,
|
||||
l.burialSiteStatusId, s.burialSiteStatus,
|
||||
l.cemeteryId, m.cemeteryName,
|
||||
m.cemeterySvg, l.cemeterySvgId,
|
||||
m.cemeterySvg, l.cemeterySvgId, l.burialSiteImage,
|
||||
l.burialSiteLatitude, l.burialSiteLongitude
|
||||
|
||||
from BurialSites l
|
||||
|
|
|
|||
|
|
@ -88,6 +88,8 @@ const createStatements = [
|
|||
|
||||
cemeteryId integer,
|
||||
cemeterySvgId varchar(100),
|
||||
burialSiteImage varchar(100) not null default '',
|
||||
|
||||
burialSiteLatitude decimal(10, 8)
|
||||
check (burialSiteLatitude between -90 and 90),
|
||||
burialSiteLongitude decimal(11, 8)
|
||||
|
|
|
|||
|
|
@ -105,6 +105,8 @@ const createStatements = [
|
|||
|
||||
cemeteryId integer,
|
||||
cemeterySvgId varchar(100),
|
||||
burialSiteImage varchar(100) not null default '',
|
||||
|
||||
burialSiteLatitude decimal(10, 8)
|
||||
check (burialSiteLatitude between -90 and 90),
|
||||
burialSiteLongitude decimal(11, 8)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ export interface UpdateBurialSiteForm {
|
|||
burialSiteNameSegment5?: string;
|
||||
burialSiteStatusId: number | string;
|
||||
burialSiteTypeId: number | string;
|
||||
burialSiteImage: string;
|
||||
cemeteryId: number | string;
|
||||
cemeterySvgId: string;
|
||||
burialSiteLatitude: string;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ export default async function updateBurialSite(updateForm, user) {
|
|||
burialSiteStatusId = ?,
|
||||
cemeteryId = ?,
|
||||
cemeterySvgId = ?,
|
||||
burialSiteImage = ?,
|
||||
burialSiteLatitude = ?,
|
||||
burialSiteLongitude = ?,
|
||||
recordUpdate_userName = ?,
|
||||
|
|
@ -49,7 +50,7 @@ export default async function updateBurialSite(updateForm, user) {
|
|||
and recordDelete_timeMillis is null`)
|
||||
.run(updateForm.burialSiteNameSegment1 ?? '', updateForm.burialSiteNameSegment2 ?? '', updateForm.burialSiteNameSegment3 ?? '', updateForm.burialSiteNameSegment4 ?? '', updateForm.burialSiteNameSegment5 ?? '', burialSiteName, updateForm.burialSiteTypeId, updateForm.burialSiteStatusId === ''
|
||||
? undefined
|
||||
: updateForm.burialSiteStatusId, updateForm.cemeteryId === '' ? undefined : updateForm.cemeteryId, updateForm.cemeterySvgId, updateForm.burialSiteLatitude === ''
|
||||
: updateForm.burialSiteStatusId, updateForm.cemeteryId === '' ? undefined : updateForm.cemeteryId, updateForm.cemeterySvgId, updateForm.burialSiteImage, updateForm.burialSiteLatitude === ''
|
||||
? undefined
|
||||
: updateForm.burialSiteLatitude, updateForm.burialSiteLongitude === ''
|
||||
? undefined
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ export interface UpdateBurialSiteForm {
|
|||
burialSiteStatusId: number | string
|
||||
burialSiteTypeId: number | string
|
||||
|
||||
burialSiteImage: string
|
||||
cemeteryId: number | string
|
||||
cemeterySvgId: string
|
||||
|
||||
|
|
@ -78,6 +79,7 @@ export default async function updateBurialSite(
|
|||
burialSiteStatusId = ?,
|
||||
cemeteryId = ?,
|
||||
cemeterySvgId = ?,
|
||||
burialSiteImage = ?,
|
||||
burialSiteLatitude = ?,
|
||||
burialSiteLongitude = ?,
|
||||
recordUpdate_userName = ?,
|
||||
|
|
@ -98,6 +100,7 @@ export default async function updateBurialSite(
|
|||
: updateForm.burialSiteStatusId,
|
||||
updateForm.cemeteryId === '' ? undefined : updateForm.cemeteryId,
|
||||
updateForm.cemeterySvgId,
|
||||
updateForm.burialSiteImage,
|
||||
updateForm.burialSiteLatitude === ''
|
||||
? undefined
|
||||
: updateForm.burialSiteLatitude,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import getBurialSite from '../../database/getBurialSite.js';
|
|||
import getCemeteries from '../../database/getCemeteries.js';
|
||||
import { getConfigProperty } from '../../helpers/config.helpers.js';
|
||||
import { getBurialSiteStatuses, getBurialSiteTypes } from '../../helpers/functions.cache.js';
|
||||
import { getBurialSiteImages } from '../../helpers/images.helpers.js';
|
||||
export default async function handler(request, response) {
|
||||
const burialSite = await getBurialSite(request.params.burialSiteId);
|
||||
if (burialSite === undefined) {
|
||||
|
|
@ -9,14 +10,16 @@ export default async function handler(request, response) {
|
|||
return;
|
||||
}
|
||||
const cemeteries = await getCemeteries();
|
||||
const burialSiteImages = await getBurialSiteImages();
|
||||
const burialSiteTypes = await getBurialSiteTypes();
|
||||
const burialSiteStatuses = await getBurialSiteStatuses();
|
||||
response.render('burialSite-edit', {
|
||||
headTitle: burialSite.burialSiteName,
|
||||
burialSite,
|
||||
isCreate: false,
|
||||
cemeteries,
|
||||
burialSiteImages,
|
||||
burialSiteStatuses,
|
||||
burialSiteTypes,
|
||||
burialSiteStatuses
|
||||
cemeteries
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import {
|
|||
getBurialSiteStatuses,
|
||||
getBurialSiteTypes
|
||||
} from '../../helpers/functions.cache.js'
|
||||
import { getBurialSiteImages } from '../../helpers/images.helpers.js'
|
||||
|
||||
export default async function handler(
|
||||
request: Request,
|
||||
|
|
@ -22,15 +23,19 @@ export default async function handler(
|
|||
}
|
||||
|
||||
const cemeteries = await getCemeteries()
|
||||
const burialSiteImages = await getBurialSiteImages()
|
||||
const burialSiteTypes = await getBurialSiteTypes()
|
||||
const burialSiteStatuses = await getBurialSiteStatuses()
|
||||
|
||||
response.render('burialSite-edit', {
|
||||
headTitle: burialSite.burialSiteName,
|
||||
|
||||
burialSite,
|
||||
isCreate: false,
|
||||
cemeteries,
|
||||
|
||||
burialSiteImages,
|
||||
burialSiteStatuses,
|
||||
burialSiteTypes,
|
||||
burialSiteStatuses
|
||||
cemeteries
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import getCemeteries from '../../database/getCemeteries.js';
|
||||
import { getBurialSiteStatuses, getBurialSiteTypes } from '../../helpers/functions.cache.js';
|
||||
import { getBurialSiteImages } from '../../helpers/images.helpers.js';
|
||||
export default async function handler(request, response) {
|
||||
const burialSite = {
|
||||
burialSiteId: -1,
|
||||
|
|
@ -14,14 +15,16 @@ export default async function handler(request, response) {
|
|||
burialSite.cemeteryName = cemetery.cemeteryName;
|
||||
}
|
||||
}
|
||||
const burialSiteImages = await getBurialSiteImages();
|
||||
const burialSiteTypes = await getBurialSiteTypes();
|
||||
const burialSiteStatuses = await getBurialSiteStatuses();
|
||||
response.render('burialSite-edit', {
|
||||
headTitle: 'Create a New Burial Site',
|
||||
burialSite,
|
||||
isCreate: true,
|
||||
cemeteries,
|
||||
burialSiteImages,
|
||||
burialSiteStatuses,
|
||||
burialSiteTypes,
|
||||
burialSiteStatuses
|
||||
cemeteries,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {
|
|||
getBurialSiteStatuses,
|
||||
getBurialSiteTypes
|
||||
} from '../../helpers/functions.cache.js'
|
||||
import { getBurialSiteImages } from '../../helpers/images.helpers.js'
|
||||
import type { BurialSite } from '../../types/recordTypes.js'
|
||||
|
||||
export default async function handler(
|
||||
|
|
@ -31,15 +32,19 @@ export default async function handler(
|
|||
}
|
||||
}
|
||||
|
||||
const burialSiteImages = await getBurialSiteImages()
|
||||
const burialSiteTypes = await getBurialSiteTypes()
|
||||
const burialSiteStatuses = await getBurialSiteStatuses()
|
||||
|
||||
response.render('burialSite-edit', {
|
||||
headTitle: 'Create a New Burial Site',
|
||||
|
||||
burialSite,
|
||||
isCreate: true,
|
||||
cemeteries,
|
||||
|
||||
burialSiteImages,
|
||||
burialSiteStatuses,
|
||||
burialSiteTypes,
|
||||
burialSiteStatuses
|
||||
cemeteries,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ export default async function handler(
|
|||
|
||||
response.render('burialSite-view', {
|
||||
headTitle: burialSite.burialSiteName,
|
||||
|
||||
burialSite
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import getBurialSiteStatusSummary from '../../database/getBurialSiteStatusSummary.js';
|
||||
import getBurialSiteTypeSummary from '../../database/getBurialSiteTypeSummary.js';
|
||||
import getCemetery from '../../database/getCemetery.js';
|
||||
import { getCemeterySVGs } from '../../helpers/cemeteries.helpers.js';
|
||||
import { getConfigProperty } from '../../helpers/config.helpers.js';
|
||||
import { getCemeterySVGs } from '../../helpers/images.helpers.js';
|
||||
export default async function handler(request, response) {
|
||||
const cemetery = await getCemetery(request.params.cemeteryId);
|
||||
if (cemetery === undefined) {
|
||||
|
|
@ -18,10 +18,10 @@ export default async function handler(request, response) {
|
|||
});
|
||||
response.render('cemetery-edit', {
|
||||
headTitle: cemetery.cemeteryName,
|
||||
isCreate: false,
|
||||
cemetery,
|
||||
cemeterySVGs,
|
||||
burialSiteTypeSummary,
|
||||
burialSiteStatusSummary
|
||||
isCreate: false,
|
||||
burialSiteStatusSummary,
|
||||
burialSiteTypeSummary
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import type { Request, Response } from 'express'
|
|||
import getBurialSiteStatusSummary from '../../database/getBurialSiteStatusSummary.js'
|
||||
import getBurialSiteTypeSummary from '../../database/getBurialSiteTypeSummary.js'
|
||||
import getCemetery from '../../database/getCemetery.js'
|
||||
import { getCemeterySVGs } from '../../helpers/cemeteries.helpers.js'
|
||||
import { getConfigProperty } from '../../helpers/config.helpers.js'
|
||||
import { getCemeterySVGs } from '../../helpers/images.helpers.js'
|
||||
|
||||
export default async function handler(
|
||||
request: Request,
|
||||
|
|
@ -31,10 +31,12 @@ export default async function handler(
|
|||
|
||||
response.render('cemetery-edit', {
|
||||
headTitle: cemetery.cemeteryName,
|
||||
isCreate: false,
|
||||
|
||||
cemetery,
|
||||
cemeterySVGs,
|
||||
burialSiteTypeSummary,
|
||||
burialSiteStatusSummary
|
||||
isCreate: false,
|
||||
|
||||
burialSiteStatusSummary,
|
||||
burialSiteTypeSummary
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { getCemeterySVGs } from '../../helpers/cemeteries.helpers.js';
|
||||
import { getConfigProperty } from '../../helpers/config.helpers.js';
|
||||
import { getCemeterySVGs } from '../../helpers/images.helpers.js';
|
||||
export default async function handler(_request, response) {
|
||||
const cemetery = {
|
||||
cemeteryCity: getConfigProperty('settings.cityDefault'),
|
||||
|
|
@ -8,8 +8,8 @@ export default async function handler(_request, response) {
|
|||
const cemeterySVGs = await getCemeterySVGs();
|
||||
response.render('cemetery-edit', {
|
||||
headTitle: "Create a Cemetery",
|
||||
isCreate: true,
|
||||
cemetery,
|
||||
cemeterySVGs
|
||||
cemeterySVGs,
|
||||
isCreate: true,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { Request, Response } from 'express'
|
||||
|
||||
import { getCemeterySVGs } from '../../helpers/cemeteries.helpers.js'
|
||||
import { getConfigProperty } from '../../helpers/config.helpers.js'
|
||||
import { getCemeterySVGs } from '../../helpers/images.helpers.js'
|
||||
import type { Cemetery } from '../../types/recordTypes.js'
|
||||
|
||||
export default async function handler(
|
||||
|
|
@ -17,8 +17,9 @@ export default async function handler(
|
|||
|
||||
response.render('cemetery-edit', {
|
||||
headTitle: "Create a Cemetery",
|
||||
isCreate: true,
|
||||
|
||||
cemetery,
|
||||
cemeterySVGs
|
||||
cemeterySVGs,
|
||||
isCreate: true,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
export declare function getCemeterySVGs(): Promise<string[]>;
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
import fs from 'node:fs/promises';
|
||||
let cemeterySVGs;
|
||||
export async function getCemeterySVGs() {
|
||||
if (cemeterySVGs === undefined) {
|
||||
const files = await fs.readdir('./public/images/cemeteries/');
|
||||
const SVGs = [];
|
||||
for (const file of files) {
|
||||
if (file.toLowerCase().endsWith('.svg')) {
|
||||
SVGs.push(file);
|
||||
}
|
||||
}
|
||||
cemeterySVGs = SVGs;
|
||||
}
|
||||
return cemeterySVGs;
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
import fs from 'node:fs/promises'
|
||||
|
||||
let cemeterySVGs: string[] | undefined
|
||||
|
||||
export async function getCemeterySVGs(): Promise<string[]> {
|
||||
if (cemeterySVGs === undefined) {
|
||||
const files = await fs.readdir('./public/images/cemeteries/')
|
||||
|
||||
const SVGs: string[] = []
|
||||
|
||||
for (const file of files) {
|
||||
if (file.toLowerCase().endsWith('.svg')) {
|
||||
SVGs.push(file)
|
||||
}
|
||||
}
|
||||
|
||||
cemeterySVGs = SVGs
|
||||
}
|
||||
|
||||
return cemeterySVGs
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export declare function getBurialSiteImages(): Promise<string[]>;
|
||||
export declare function getCemeterySVGs(): Promise<string[]>;
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
import fs from 'node:fs/promises';
|
||||
let burialSiteImages;
|
||||
export async function getBurialSiteImages() {
|
||||
if (burialSiteImages === undefined) {
|
||||
const files = await fs.readdir('./public-internal/images/burialSites/');
|
||||
const images = [];
|
||||
for (const file of files) {
|
||||
const lowerCaseFileName = file.toLowerCase();
|
||||
if (lowerCaseFileName.endsWith('.jpg') ||
|
||||
lowerCaseFileName.endsWith('.jpeg') ||
|
||||
lowerCaseFileName.endsWith('.png')) {
|
||||
images.push(file);
|
||||
}
|
||||
}
|
||||
burialSiteImages = images;
|
||||
}
|
||||
return burialSiteImages;
|
||||
}
|
||||
let cemeterySVGs;
|
||||
export async function getCemeterySVGs() {
|
||||
if (cemeterySVGs === undefined) {
|
||||
const files = await fs.readdir('./public-internal/images/cemeteries/');
|
||||
const SVGs = [];
|
||||
for (const file of files) {
|
||||
if (file.toLowerCase().endsWith('.svg')) {
|
||||
SVGs.push(file);
|
||||
}
|
||||
}
|
||||
cemeterySVGs = SVGs;
|
||||
}
|
||||
return cemeterySVGs;
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
import fs from 'node:fs/promises'
|
||||
|
||||
let burialSiteImages: string[] | undefined
|
||||
|
||||
export async function getBurialSiteImages(): Promise<string[]> {
|
||||
if (burialSiteImages === undefined) {
|
||||
const files = await fs.readdir('./public-internal/images/burialSites/')
|
||||
|
||||
const images: string[] = []
|
||||
|
||||
for (const file of files) {
|
||||
const lowerCaseFileName = file.toLowerCase()
|
||||
if (
|
||||
lowerCaseFileName.endsWith('.jpg') ||
|
||||
lowerCaseFileName.endsWith('.jpeg') ||
|
||||
lowerCaseFileName.endsWith('.png')
|
||||
) {
|
||||
images.push(file)
|
||||
}
|
||||
}
|
||||
|
||||
burialSiteImages = images
|
||||
}
|
||||
|
||||
return burialSiteImages
|
||||
}
|
||||
|
||||
let cemeterySVGs: string[] | undefined
|
||||
|
||||
export async function getCemeterySVGs(): Promise<string[]> {
|
||||
if (cemeterySVGs === undefined) {
|
||||
const files = await fs.readdir('./public-internal/images/cemeteries/')
|
||||
|
||||
const SVGs: string[] = []
|
||||
|
||||
for (const file of files) {
|
||||
if (file.toLowerCase().endsWith('.svg')) {
|
||||
SVGs.push(file)
|
||||
}
|
||||
}
|
||||
|
||||
cemeterySVGs = SVGs
|
||||
}
|
||||
|
||||
return cemeterySVGs
|
||||
}
|
||||
|
|
@ -62,7 +62,6 @@
|
|||
"leaflet": "^1.9.4",
|
||||
"node-cache": "^5.1.2",
|
||||
"papaparse": "^5.5.2",
|
||||
"puppeteer": "^19.4.1",
|
||||
"randomcolor": "^0.6.2",
|
||||
"session-file-store": "^1.5.0",
|
||||
"set-interval-async": "^3.0.3"
|
||||
|
|
@ -96,6 +95,7 @@
|
|||
"prettier-config-cityssm": "^1.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"node-windows": "^1.0.0-beta.8"
|
||||
"node-windows": "^1.0.0-beta.8",
|
||||
"puppeteer": "^19.4.1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
Files placed in this folder are only available to logged in users.
|
||||
|
After Width: | Height: | Size: 209 KiB |
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.5 MiB |
|
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 274 KiB |
|
Before Width: | Height: | Size: 263 KiB After Width: | Height: | Size: 263 KiB |
|
Before Width: | Height: | Size: 276 KiB After Width: | Height: | Size: 276 KiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 695 KiB After Width: | Height: | Size: 695 KiB |
|
Before Width: | Height: | Size: 676 KiB After Width: | Height: | Size: 676 KiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 786 KiB After Width: | Height: | Size: 786 KiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 1022 KiB After Width: | Height: | Size: 1022 KiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 618 KiB After Width: | Height: | Size: 618 KiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 503 KiB After Width: | Height: | Size: 503 KiB |
|
Before Width: | Height: | Size: 643 KiB After Width: | Height: | Size: 643 KiB |
|
Before Width: | Height: | Size: 921 KiB After Width: | Height: | Size: 921 KiB |
|
Before Width: | Height: | Size: 502 KiB After Width: | Height: | Size: 502 KiB |
|
Before Width: | Height: | Size: 339 KiB After Width: | Height: | Size: 339 KiB |
|
Before Width: | Height: | Size: 284 KiB After Width: | Height: | Size: 284 KiB |
|
Before Width: | Height: | Size: 286 KiB After Width: | Height: | Size: 286 KiB |
|
Before Width: | Height: | Size: 293 KiB After Width: | Height: | Size: 293 KiB |
|
Before Width: | Height: | Size: 312 KiB After Width: | Height: | Size: 312 KiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 247 KiB After Width: | Height: | Size: 247 KiB |
|
Before Width: | Height: | Size: 246 KiB After Width: | Height: | Size: 246 KiB |
|
Before Width: | Height: | Size: 238 KiB After Width: | Height: | Size: 238 KiB |
|
Before Width: | Height: | Size: 162 KiB After Width: | Height: | Size: 162 KiB |
|
Before Width: | Height: | Size: 242 KiB After Width: | Height: | Size: 242 KiB |
|
Before Width: | Height: | Size: 236 KiB After Width: | Height: | Size: 236 KiB |
|
Before Width: | Height: | Size: 237 KiB After Width: | Height: | Size: 237 KiB |
|
Before Width: | Height: | Size: 233 KiB After Width: | Height: | Size: 233 KiB |
|
Before Width: | Height: | Size: 351 KiB After Width: | Height: | Size: 351 KiB |
|
Before Width: | Height: | Size: 351 KiB After Width: | Height: | Size: 351 KiB |
|
Before Width: | Height: | Size: 768 KiB After Width: | Height: | Size: 768 KiB |
|
Before Width: | Height: | Size: 416 KiB After Width: | Height: | Size: 416 KiB |
|
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
|
Before Width: | Height: | Size: 204 KiB After Width: | Height: | Size: 204 KiB |
|
Before Width: | Height: | Size: 200 KiB After Width: | Height: | Size: 200 KiB |
|
Before Width: | Height: | Size: 195 KiB After Width: | Height: | Size: 195 KiB |
|
Before Width: | Height: | Size: 193 KiB After Width: | Height: | Size: 193 KiB |
|
Before Width: | Height: | Size: 193 KiB After Width: | Height: | Size: 193 KiB |
|
Before Width: | Height: | Size: 194 KiB After Width: | Height: | Size: 194 KiB |
|
Before Width: | Height: | Size: 193 KiB After Width: | Height: | Size: 193 KiB |
|
Before Width: | Height: | Size: 192 KiB After Width: | Height: | Size: 192 KiB |
|
Before Width: | Height: | Size: 194 KiB After Width: | Height: | Size: 194 KiB |
|
Before Width: | Height: | Size: 193 KiB After Width: | Height: | Size: 193 KiB |
|
Before Width: | Height: | Size: 266 KiB After Width: | Height: | Size: 266 KiB |
|
Before Width: | Height: | Size: 250 KiB After Width: | Height: | Size: 250 KiB |
|
Before Width: | Height: | Size: 256 KiB After Width: | Height: | Size: 256 KiB |
|
Before Width: | Height: | Size: 888 KiB After Width: | Height: | Size: 888 KiB |
|
Before Width: | Height: | Size: 880 KiB After Width: | Height: | Size: 880 KiB |
|
Before Width: | Height: | Size: 333 KiB After Width: | Height: | Size: 333 KiB |
|
Before Width: | Height: | Size: 333 KiB After Width: | Height: | Size: 333 KiB |
|
Before Width: | Height: | Size: 281 KiB After Width: | Height: | Size: 281 KiB |
|
Before Width: | Height: | Size: 239 KiB After Width: | Height: | Size: 239 KiB |
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 2.1 MiB After Width: | Height: | Size: 2.1 MiB |
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |