switch to cityssm/utils-datetime

show am/pm for printed times
deepsource-autofix-76c6eb20
Dan Gowans 2023-03-22 11:41:54 -04:00
parent de7176b643
commit 967da6c03b
92 changed files with 191 additions and 162 deletions

2
app.js
View File

@ -21,7 +21,7 @@ import routerReports from './routes/reports.js';
import routerAdmin from './routes/admin.js';
import * as configFunctions from './helpers/functions.config.js';
import * as printFunctions from './helpers/functions.print.js';
import * as dateTimeFns from '@cityssm/expressjs-server-js/dateTimeFns.js';
import * as dateTimeFns from '@cityssm/utils-datetime';
import * as stringFns from '@cityssm/expressjs-server-js/stringFns.js';
import * as htmlFns from '@cityssm/expressjs-server-js/htmlFns.js';
import { version } from './version.js';

2
app.ts
View File

@ -26,7 +26,7 @@ import routerAdmin from './routes/admin.js'
import * as configFunctions from './helpers/functions.config.js'
import * as printFunctions from './helpers/functions.print.js'
import * as dateTimeFns from '@cityssm/expressjs-server-js/dateTimeFns.js'
import * as dateTimeFns from '@cityssm/utils-datetime'
import * as stringFns from '@cityssm/expressjs-server-js/stringFns.js'
import * as htmlFns from '@cityssm/expressjs-server-js/htmlFns.js'

View File

@ -1,4 +1,4 @@
import { dateToString } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateToString } from '@cityssm/utils-datetime';
import { getWorkOrderMilestones } from '../../helpers/lotOccupancyDB/getWorkOrderMilestones.js';
import { getWorkOrders } from '../../helpers/lotOccupancyDB/getWorkOrders.js';
import { getLotOccupancies } from '../../helpers/lotOccupancyDB/getLotOccupancies.js';

View File

@ -1,6 +1,6 @@
import type { Request, Response } from 'express'
import { dateToString } from '@cityssm/expressjs-server-js/dateTimeFns.js'
import { dateToString } from '@cityssm/utils-datetime'
import { getWorkOrderMilestones } from '../../helpers/lotOccupancyDB/getWorkOrderMilestones.js'
import { getWorkOrders } from '../../helpers/lotOccupancyDB/getWorkOrders.js'

View File

@ -1,4 +1,4 @@
import { dateToInteger, dateToString } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateToInteger, dateToString } from '@cityssm/utils-datetime';
import { getLotOccupantTypes, getLotStatuses, getLotTypes, getOccupancyTypes } from '../../helpers/functions.cache.js';
import { getLot } from '../../helpers/lotOccupancyDB/getLot.js';
import { getMaps } from '../../helpers/lotOccupancyDB/getMaps.js';

View File

@ -3,7 +3,7 @@ import type { Request, Response } from 'express'
import {
dateToInteger,
dateToString
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import {
getLotOccupantTypes,

View File

@ -13,7 +13,9 @@ export async function handler(
request.session
)
const lotOccupancyFees = await getLotOccupancyFees(request.body.lotOccupancyId)
const lotOccupancyFees = await getLotOccupancyFees(
request.body.lotOccupancyId
)
response.json({
success,

View File

@ -1,7 +1,7 @@
import path from 'node:path';
import * as ejs from 'ejs';
import * as configFunctions from '../../helpers/functions.config.js';
import * as dateTimeFunctions from '@cityssm/expressjs-server-js/dateTimeFns.js';
import * as dateTimeFunctions from '@cityssm/utils-datetime';
import * as lotOccupancyFunctions from '../../helpers/functions.lotOccupancy.js';
import { getReportData, getPdfPrintConfig } from '../../helpers/functions.print.js';
import { convertHTMLToPDF } from '@cityssm/pdf-puppeteer';

View File

@ -4,7 +4,7 @@ import path from 'node:path'
import * as ejs from 'ejs'
import * as configFunctions from '../../helpers/functions.config.js'
import * as dateTimeFunctions from '@cityssm/expressjs-server-js/dateTimeFns.js'
import * as dateTimeFunctions from '@cityssm/utils-datetime'
import * as lotOccupancyFunctions from '../../helpers/functions.lotOccupancy.js'
import {

View File

@ -1,4 +1,4 @@
import * as dateTimeFunctions from '@cityssm/expressjs-server-js/dateTimeFns.js';
import * as dateTimeFunctions from '@cityssm/utils-datetime';
import { getMaps } from '../../helpers/lotOccupancyDB/getMaps.js';
import { getLotStatuses, getLotTypes } from '../../helpers/functions.cache.js';
export async function handler(_request, response) {

View File

@ -1,6 +1,6 @@
import type { Request, Response } from 'express'
import * as dateTimeFunctions from '@cityssm/expressjs-server-js/dateTimeFns.js'
import * as dateTimeFunctions from '@cityssm/utils-datetime'
import { getMaps } from '../../helpers/lotOccupancyDB/getMaps.js'
import { getLotStatuses, getLotTypes } from '../../helpers/functions.cache.js'

View File

@ -1,4 +1,4 @@
import { dateToInteger, dateToString } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateToInteger, dateToString } from '@cityssm/utils-datetime';
import { getWorkOrderTypes } from '../../helpers/functions.cache.js';
export async function handler(request, response) {
const currentDate = new Date();

View File

@ -1,12 +1,12 @@
import {
dateToInteger,
dateToString
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import type { Request, Response } from 'express'
import { getWorkOrderTypes } from '../../helpers/functions.cache.js'
import * as recordTypes from '../../types/recordTypes'
import type * as recordTypes from '../../types/recordTypes'
export async function handler(
request: Request,

View File

@ -2,7 +2,7 @@ import { addWorkOrderComment } from '../../helpers/lotOccupancyDB/addWorkOrderCo
import { getWorkOrderComments } from '../../helpers/lotOccupancyDB/getWorkOrderComments.js';
export async function handler(request, response) {
await addWorkOrderComment(request.body, request.session);
const workOrderComments = getWorkOrderComments(request.body.workOrderId);
const workOrderComments = await getWorkOrderComments(request.body.workOrderId);
response.json({
success: true,
workOrderComments

View File

@ -10,7 +10,7 @@ export async function handler(
): Promise<void> {
await addWorkOrderComment(request.body, request.session)
const workOrderComments = getWorkOrderComments(request.body.workOrderId)
const workOrderComments = await getWorkOrderComments(request.body.workOrderId)
response.json({
success: true,

View File

@ -1,4 +1,4 @@
import { dateToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateToInteger } from '@cityssm/utils-datetime';
export function getLotNameWhereClause(lotName = '', lotNameSearchType, lotsTableAlias = 'l') {
let sqlWhereClause = '';
const sqlParameters = [];

View File

@ -1,4 +1,4 @@
import { dateToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js'
import { dateToInteger } from '@cityssm/utils-datetime'
type LotNameSearchType = 'startsWith' | 'endsWith' | ''

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import * as dateTimeFunctions from '@cityssm/expressjs-server-js/dateTimeFns.js';
import * as dateTimeFunctions from '@cityssm/utils-datetime';
export async function addLotComment(lotCommentForm, requestSession) {
const database = await acquireConnection();
const rightNow = new Date();

View File

@ -1,6 +1,6 @@
import { acquireConnection } from './pool.js'
import * as dateTimeFunctions from '@cityssm/expressjs-server-js/dateTimeFns.js'
import * as dateTimeFunctions from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import * as dateTimeFunctions from '@cityssm/expressjs-server-js/dateTimeFns.js';
import * as dateTimeFunctions from '@cityssm/utils-datetime';
import { addOrUpdateLotOccupancyField } from './addOrUpdateLotOccupancyField.js';
import { addLotOccupancyOccupant } from './addLotOccupancyOccupant.js';
export async function addLotOccupancy(lotOccupancyForm, requestSession, connectedDatabase) {

View File

@ -1,7 +1,7 @@
import { acquireConnection } from './pool.js'
import type { PoolConnection } from 'better-sqlite-pool'
import * as dateTimeFunctions from '@cityssm/expressjs-server-js/dateTimeFns.js'
import * as dateTimeFunctions from '@cityssm/utils-datetime'
import { addOrUpdateLotOccupancyField } from './addOrUpdateLotOccupancyField.js'
import { addLotOccupancyOccupant } from './addLotOccupancyOccupant.js'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateStringToInteger, dateToInteger, dateToTimeInteger, timeStringToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateStringToInteger, dateToInteger, dateToTimeInteger, timeStringToInteger } from '@cityssm/utils-datetime';
export async function addLotOccupancyComment(commentForm, requestSession) {
const rightNow = new Date();
let lotOccupancyCommentDate;

View File

@ -5,7 +5,7 @@ import {
dateToInteger,
dateToTimeInteger,
timeStringToInteger
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateStringToInteger, dateToInteger, dateToTimeInteger, timeStringToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateStringToInteger, dateToInteger, dateToTimeInteger, timeStringToInteger } from '@cityssm/utils-datetime';
export async function addLotOccupancyTransaction(lotOccupancyTransactionForm, requestSession) {
const database = await acquireConnection();
let transactionIndex = 0;

View File

@ -5,7 +5,7 @@ import {
dateToInteger,
dateToTimeInteger,
timeStringToInteger
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'

View File

@ -1,7 +1,7 @@
import { acquireConnection } from './pool.js';
import { getNextWorkOrderNumber } from './getNextWorkOrderNumber.js';
import { addWorkOrderLotOccupancy } from './addWorkOrderLotOccupancy.js';
import { dateStringToInteger, dateToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateStringToInteger, dateToInteger } from '@cityssm/utils-datetime';
export async function addWorkOrder(workOrderForm, requestSession) {
const database = await acquireConnection();
const rightNow = new Date();

View File

@ -6,7 +6,7 @@ import { addWorkOrderLotOccupancy } from './addWorkOrderLotOccupancy.js'
import {
dateStringToInteger,
dateToInteger
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import * as dateTimeFunctions from '@cityssm/expressjs-server-js/dateTimeFns.js';
import * as dateTimeFunctions from '@cityssm/utils-datetime';
export async function addWorkOrderComment(workOrderCommentForm, requestSession) {
const database = await acquireConnection();
const rightNow = new Date();

View File

@ -1,6 +1,6 @@
import { acquireConnection } from './pool.js'
import * as dateTimeFunctions from '@cityssm/expressjs-server-js/dateTimeFns.js'
import * as dateTimeFunctions from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateStringToInteger, timeStringToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateStringToInteger, timeStringToInteger } from '@cityssm/utils-datetime';
export async function addWorkOrderMilestone(milestoneForm, requestSession) {
const rightNow = new Date();
const database = await acquireConnection();

View File

@ -5,7 +5,7 @@ import { acquireConnection } from './pool.js'
import {
dateStringToInteger,
timeStringToInteger
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateStringToInteger, dateToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateStringToInteger, dateToInteger } from '@cityssm/utils-datetime';
export async function closeWorkOrder(workOrderForm, requestSession) {
const database = await acquireConnection();
const rightNow = new Date();

View File

@ -3,7 +3,7 @@ import { acquireConnection } from './pool.js'
import {
dateStringToInteger,
dateToInteger
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateStringToInteger, dateToInteger, dateToTimeInteger, timeStringToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateStringToInteger, dateToInteger, dateToTimeInteger, timeStringToInteger } from '@cityssm/utils-datetime';
export async function completeWorkOrderMilestone(milestoneForm, requestSession) {
const rightNow = new Date();
const database = await acquireConnection();

View File

@ -7,7 +7,7 @@ import {
dateToInteger,
dateToTimeInteger,
timeStringToInteger
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'

View File

@ -2,7 +2,7 @@ import { acquireConnection } from './pool.js';
import { getLotOccupancy } from './getLotOccupancy.js';
import { addLotOccupancy } from './addLotOccupancy.js';
import { addLotOccupancyOccupant } from './addLotOccupancyOccupant.js';
import { dateToString } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateToString } from '@cityssm/utils-datetime';
export async function copyLotOccupancy(oldLotOccupancyId, requestSession) {
const database = await acquireConnection();
const oldLotOccupancy = (await getLotOccupancy(oldLotOccupancyId, database));

View File

@ -4,7 +4,7 @@ import { getLotOccupancy } from './getLotOccupancy.js'
import { addLotOccupancy } from './addLotOccupancy.js'
import { addLotOccupancyOccupant } from './addLotOccupancyOccupant.js'
import { dateToString } from '@cityssm/expressjs-server-js/dateTimeFns.js'
import { dateToString } from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'

View File

@ -1,13 +1,16 @@
import { acquireConnection } from './pool.js';
import { dateIntegerToString, timeIntegerToString } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateIntegerToString, timeIntegerToString, timeIntegerToPeriodString } from '@cityssm/utils-datetime';
export async function getLotComments(lotId, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
database.function('userFn_dateIntegerToString', dateIntegerToString);
database.function('userFn_timeIntegerToString', timeIntegerToString);
database.function('userFn_timeIntegerToPeriodString', timeIntegerToPeriodString);
const lotComments = database
.prepare(`select lotCommentId,
lotCommentDate, userFn_dateIntegerToString(lotCommentDate) as lotCommentDateString,
lotCommentTime, userFn_timeIntegerToString(lotCommentTime) as lotCommentTimeString,
lotCommentTime,
userFn_timeIntegerToString(lotCommentTime) as lotCommentTimeString,
userFn_timeIntegerToPeriodString(lotCommentTime) as lotCommentTimePeriodString,
lotComment,
recordCreate_userName, recordUpdate_userName
from LotComments

View File

@ -3,8 +3,9 @@ import type { PoolConnection } from 'better-sqlite-pool'
import {
dateIntegerToString,
timeIntegerToString
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
timeIntegerToString,
timeIntegerToPeriodString
} from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'
@ -16,12 +17,15 @@ export async function getLotComments(
database.function('userFn_dateIntegerToString', dateIntegerToString)
database.function('userFn_timeIntegerToString', timeIntegerToString)
database.function('userFn_timeIntegerToPeriodString', timeIntegerToPeriodString)
const lotComments = database
.prepare(
`select lotCommentId,
lotCommentDate, userFn_dateIntegerToString(lotCommentDate) as lotCommentDateString,
lotCommentTime, userFn_timeIntegerToString(lotCommentTime) as lotCommentTimeString,
lotCommentTime,
userFn_timeIntegerToString(lotCommentTime) as lotCommentTimeString,
userFn_timeIntegerToPeriodString(lotCommentTime) as lotCommentTimePeriodString,
lotComment,
recordCreate_userName, recordUpdate_userName
from LotComments

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateIntegerToString, dateStringToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateIntegerToString, dateStringToInteger } from '@cityssm/utils-datetime';
import * as configFunctions from '../functions.config.js';
import { getOccupancyTypeById } from '../functions.cache.js';
import { getLotOccupancyOccupants } from './getLotOccupancyOccupants.js';

View File

@ -6,7 +6,7 @@ import type { PoolConnection } from 'better-sqlite-pool'
import {
dateIntegerToString,
dateStringToInteger
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import * as configFunctions from '../functions.config.js'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateIntegerToString } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateIntegerToString } from '@cityssm/utils-datetime';
import { getLotOccupancyOccupants } from './getLotOccupancyOccupants.js';
import { getLotOccupancyComments } from './getLotOccupancyComments.js';
import { getLotOccupancyFields } from './getLotOccupancyFields.js';

View File

@ -1,7 +1,7 @@
import { acquireConnection } from './pool.js'
import type { PoolConnection } from 'better-sqlite-pool'
import { dateIntegerToString } from '@cityssm/expressjs-server-js/dateTimeFns.js'
import { dateIntegerToString } from '@cityssm/utils-datetime'
import { getLotOccupancyOccupants } from './getLotOccupancyOccupants.js'
import { getLotOccupancyComments } from './getLotOccupancyComments.js'

View File

@ -1,13 +1,16 @@
import { acquireConnection } from './pool.js';
import { dateIntegerToString, timeIntegerToString } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateIntegerToString, timeIntegerToString, timeIntegerToPeriodString } from '@cityssm/utils-datetime';
export async function getLotOccupancyComments(lotOccupancyId, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
database.function('userFn_dateIntegerToString', dateIntegerToString);
database.function('userFn_timeIntegerToString', timeIntegerToString);
database.function('userFn_timeIntegerToPeriodString', timeIntegerToPeriodString);
const lotComments = database
.prepare(`select lotOccupancyCommentId,
lotOccupancyCommentDate, userFn_dateIntegerToString(lotOccupancyCommentDate) as lotOccupancyCommentDateString,
lotOccupancyCommentTime, userFn_timeIntegerToString(lotOccupancyCommentTime) as lotOccupancyCommentTimeString,
lotOccupancyCommentTime,
userFn_timeIntegerToString(lotOccupancyCommentTime) as lotOccupancyCommentTimeString,
userFn_timeIntegerToPeriodString(lotOccupancyCommentTime) as lotOccupancyCommentTimePeriodString,
lotOccupancyComment,
recordCreate_userName, recordUpdate_userName
from LotOccupancyComments

View File

@ -3,8 +3,9 @@ import type { PoolConnection } from 'better-sqlite-pool'
import {
dateIntegerToString,
timeIntegerToString
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
timeIntegerToString,
timeIntegerToPeriodString
} from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'
@ -16,12 +17,15 @@ export async function getLotOccupancyComments(
database.function('userFn_dateIntegerToString', dateIntegerToString)
database.function('userFn_timeIntegerToString', timeIntegerToString)
database.function('userFn_timeIntegerToPeriodString', timeIntegerToPeriodString)
const lotComments = database
.prepare(
`select lotOccupancyCommentId,
lotOccupancyCommentDate, userFn_dateIntegerToString(lotOccupancyCommentDate) as lotOccupancyCommentDateString,
lotOccupancyCommentTime, userFn_timeIntegerToString(lotOccupancyCommentTime) as lotOccupancyCommentTimeString,
lotOccupancyCommentTime,
userFn_timeIntegerToString(lotOccupancyCommentTime) as lotOccupancyCommentTimeString,
userFn_timeIntegerToPeriodString(lotOccupancyCommentTime) as lotOccupancyCommentTimePeriodString,
lotOccupancyComment,
recordCreate_userName, recordUpdate_userName
from LotOccupancyComments

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateIntegerToString, timeIntegerToString } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateIntegerToString, timeIntegerToString } from '@cityssm/utils-datetime';
import * as configFunctions from '../functions.config.js';
import * as gpFunctions from '../functions.dynamicsGP.js';
export async function getLotOccupancyTransactions(lotOccupancyId, connectedDatabase) {

View File

@ -4,7 +4,7 @@ import type { PoolConnection } from 'better-sqlite-pool'
import {
dateIntegerToString,
timeIntegerToString
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import * as configFunctions from '../functions.config.js'
import * as gpFunctions from '../functions.dynamicsGP.js'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateToInteger } from '@cityssm/utils-datetime';
import * as configFunctions from '../functions.config.js';
import { getLotNameWhereClause } from '../functions.sqlFilters.js';
function buildWhereClause(filters) {

View File

@ -3,7 +3,7 @@
import { acquireConnection } from './pool.js'
import type { PoolConnection } from 'better-sqlite-pool'
import { dateToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js'
import { dateToInteger } from '@cityssm/utils-datetime'
import * as configFunctions from '../functions.config.js'

View File

@ -1,6 +1,6 @@
import { acquireConnection } from './pool.js';
import * as configFunctions from '../functions.config.js';
import * as dateTimeFunctions from '@cityssm/expressjs-server-js/dateTimeFns.js';
import * as dateTimeFunctions from '@cityssm/utils-datetime';
import camelCase from 'camelcase';
const mapCamelCase = camelCase(configFunctions.getProperty('aliases.map'));
const mapNameAlias = mapCamelCase + 'Name';

View File

@ -3,7 +3,7 @@
import { acquireConnection } from './pool.js'
import * as configFunctions from '../functions.config.js'
import * as dateTimeFunctions from '@cityssm/expressjs-server-js/dateTimeFns.js'
import * as dateTimeFunctions from '@cityssm/utils-datetime'
import camelCase from 'camelcase'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateIntegerToString } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateIntegerToString } from '@cityssm/utils-datetime';
import { getLots } from './getLots.js';
import { getLotOccupancies } from './getLotOccupancies.js';
import { getWorkOrderComments } from './getWorkOrderComments.js';

View File

@ -1,7 +1,7 @@
import { acquireConnection } from './pool.js'
import type { PoolConnection } from 'better-sqlite-pool'
import { dateIntegerToString } from '@cityssm/expressjs-server-js/dateTimeFns.js'
import { dateIntegerToString } from '@cityssm/utils-datetime'
import { getLots } from './getLots.js'

View File

@ -1,13 +1,16 @@
import { acquireConnection } from './pool.js';
import { dateIntegerToString, timeIntegerToString } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateIntegerToString, timeIntegerToString, timeIntegerToPeriodString } from '@cityssm/utils-datetime';
export async function getWorkOrderComments(workOrderId, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
database.function('userFn_dateIntegerToString', dateIntegerToString);
database.function('userFn_timeIntegerToString', timeIntegerToString);
database.function('userFn_timeIntegerToPeriodString', timeIntegerToPeriodString);
const workOrderComments = database
.prepare(`select workOrderCommentId,
workOrderCommentDate, userFn_dateIntegerToString(workOrderCommentDate) as workOrderCommentDateString,
workOrderCommentTime, userFn_timeIntegerToString(workOrderCommentTime) as workOrderCommentTimeString,
workOrderCommentTime,
userFn_timeIntegerToString(workOrderCommentTime) as workOrderCommentTimeString,
userFn_timeIntegerToPeriodString(workOrderCommentTime) as workOrderCommentTimePeriodString,
workOrderComment,
recordCreate_userName, recordUpdate_userName
from WorkOrderComments

View File

@ -3,8 +3,9 @@ import type { PoolConnection } from 'better-sqlite-pool'
import {
dateIntegerToString,
timeIntegerToString
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
timeIntegerToString,
timeIntegerToPeriodString
} from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'
@ -16,12 +17,15 @@ export async function getWorkOrderComments(
database.function('userFn_dateIntegerToString', dateIntegerToString)
database.function('userFn_timeIntegerToString', timeIntegerToString)
database.function('userFn_timeIntegerToPeriodString', timeIntegerToPeriodString)
const workOrderComments = database
.prepare(
`select workOrderCommentId,
workOrderCommentDate, userFn_dateIntegerToString(workOrderCommentDate) as workOrderCommentDateString,
workOrderCommentTime, userFn_timeIntegerToString(workOrderCommentTime) as workOrderCommentTimeString,
workOrderCommentTime,
userFn_timeIntegerToString(workOrderCommentTime) as workOrderCommentTimeString,
userFn_timeIntegerToPeriodString(workOrderCommentTime) as workOrderCommentTimePeriodString,
workOrderComment,
recordCreate_userName, recordUpdate_userName
from WorkOrderComments

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateIntegerToString, dateStringToInteger, dateToInteger, timeIntegerToString } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateIntegerToString, dateStringToInteger, dateToInteger, timeIntegerToString } from '@cityssm/utils-datetime';
import * as configFunctions from '../functions.config.js';
import { getLots } from './getLots.js';
import { getLotOccupancies } from './getLotOccupancies.js';

View File

@ -6,7 +6,7 @@ import {
dateStringToInteger,
dateToInteger,
timeIntegerToString
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import * as configFunctions from '../functions.config.js'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateIntegerToString, dateStringToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateIntegerToString, dateStringToInteger } from '@cityssm/utils-datetime';
import { getWorkOrderComments } from './getWorkOrderComments.js';
import { getLots } from './getLots.js';
import { getLotOccupancies } from './getLotOccupancies.js';

View File

@ -6,7 +6,7 @@ import type { PoolConnection } from 'better-sqlite-pool'
import {
dateIntegerToString,
dateStringToInteger
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import { getWorkOrderComments } from './getWorkOrderComments.js'
import { getLots } from './getLots.js'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateStringToInteger, timeStringToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateStringToInteger, timeStringToInteger } from '@cityssm/utils-datetime';
export async function updateLotComment(commentForm, requestSession) {
const rightNowMillis = Date.now();
const database = await acquireConnection();

View File

@ -3,7 +3,7 @@ import { acquireConnection } from './pool.js'
import {
dateStringToInteger,
timeStringToInteger
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateStringToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateStringToInteger } from '@cityssm/utils-datetime';
import { addOrUpdateLotOccupancyField } from './addOrUpdateLotOccupancyField.js';
import { deleteLotOccupancyField } from './deleteLotOccupancyField.js';
export async function updateLotOccupancy(lotOccupancyForm, requestSession) {

View File

@ -2,7 +2,7 @@
import { acquireConnection } from './pool.js'
import { dateStringToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js'
import { dateStringToInteger } from '@cityssm/utils-datetime'
import { addOrUpdateLotOccupancyField } from './addOrUpdateLotOccupancyField.js'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateStringToInteger, timeStringToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateStringToInteger, timeStringToInteger } from '@cityssm/utils-datetime';
export async function updateLotOccupancyComment(commentForm, requestSession) {
const rightNowMillis = Date.now();
const database = await acquireConnection();

View File

@ -3,7 +3,7 @@ import { acquireConnection } from './pool.js'
import {
dateStringToInteger,
timeStringToInteger
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateStringToInteger, timeStringToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateStringToInteger, timeStringToInteger } from '@cityssm/utils-datetime';
export async function updateLotOccupancyTransaction(lotOccupancyTransactionForm, requestSession) {
const database = await acquireConnection();
const result = database

View File

@ -3,7 +3,7 @@ import { acquireConnection } from './pool.js'
import {
dateStringToInteger,
timeStringToInteger
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateStringToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateStringToInteger } from '@cityssm/utils-datetime';
export async function updateWorkOrder(workOrderForm, requestSession) {
const database = await acquireConnection();
const rightNowMillis = Date.now();

View File

@ -1,6 +1,6 @@
import { acquireConnection } from './pool.js'
import { dateStringToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js'
import { dateStringToInteger } from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateStringToInteger, timeStringToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateStringToInteger, timeStringToInteger } from '@cityssm/utils-datetime';
export async function updateWorkOrderComment(commentForm, requestSession) {
const rightNowMillis = Date.now();
const database = await acquireConnection();

View File

@ -3,7 +3,7 @@ import { acquireConnection } from './pool.js'
import {
dateStringToInteger,
timeStringToInteger
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
import { dateStringToInteger, timeStringToInteger } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateStringToInteger, timeStringToInteger } from '@cityssm/utils-datetime';
export async function updateWorkOrderMilestone(milestoneForm, requestSession) {
const rightNow = new Date();
const database = await acquireConnection();

View File

@ -3,7 +3,7 @@ import { acquireConnection } from './pool.js'
import {
dateStringToInteger,
timeStringToInteger
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import type * as recordTypes from '../../types/recordTypes'

View File

@ -299,7 +299,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
lotComment.lotCommentDateString +
(lotComment.lotCommentTime === 0
? ''
: ' ' + lotComment.lotCommentTimeString) +
: ' ' + lotComment.lotCommentTimePeriodString) +
'</td>' +
'<td>' +
cityssm.escapeHTML((_b = lotComment.lotComment) !== null && _b !== void 0 ? _b : '') +

View File

@ -450,7 +450,7 @@ declare const bulmaJS: BulmaJS
lotComment.lotCommentDateString! +
(lotComment.lotCommentTime === 0
? ''
: ' ' + lotComment.lotCommentTimeString!) +
: ' ' + lotComment.lotCommentTimePeriodString!) +
'</td>' +
'<td>' +
cityssm.escapeHTML(lotComment.lotComment ?? '') +

View File

@ -1020,7 +1020,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
((_b = lotOccupancyComment.lotOccupancyCommentDateString) !== null && _b !== void 0 ? _b : '') +
(lotOccupancyComment.lotOccupancyCommentTime === 0
? ''
: ' ' + lotOccupancyComment.lotOccupancyCommentTimeString) +
: ' ' + lotOccupancyComment.lotOccupancyCommentTimePeriodString) +
'</td>' +
'<td>' +
cityssm.escapeHTML((_c = lotOccupancyComment.lotOccupancyComment) !== null && _c !== void 0 ? _c : '') +

View File

@ -124,7 +124,7 @@ function renderLotOccupancyComments() {
((_b = lotOccupancyComment.lotOccupancyCommentDateString) !== null && _b !== void 0 ? _b : '') +
(lotOccupancyComment.lotOccupancyCommentTime === 0
? ''
: ' ' + lotOccupancyComment.lotOccupancyCommentTimeString) +
: ' ' + lotOccupancyComment.lotOccupancyCommentTimePeriodString) +
'</td>' +
'<td>' +
cityssm.escapeHTML((_c = lotOccupancyComment.lotOccupancyComment) !== null && _c !== void 0 ? _c : '') +

View File

@ -203,7 +203,7 @@ function renderLotOccupancyComments(): void {
(lotOccupancyComment.lotOccupancyCommentDateString ?? '') +
(lotOccupancyComment.lotOccupancyCommentTime === 0
? ''
: ' ' + lotOccupancyComment.lotOccupancyCommentTimeString!) +
: ' ' + lotOccupancyComment.lotOccupancyCommentTimePeriodString!) +
'</td>' +
'<td>' +
cityssm.escapeHTML(lotOccupancyComment.lotOccupancyComment ?? '') +

View File

@ -854,7 +854,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
workOrderComment.workOrderCommentDateString +
(workOrderComment.workOrderCommentTime === 0
? ''
: ' ' + workOrderComment.workOrderCommentTimeString) +
: ' ' + workOrderComment.workOrderCommentTimePeriodString) +
'</td>' +
'<td>' +
cityssm.escapeHTML((_b = workOrderComment.workOrderComment) !== null && _b !== void 0 ? _b : '') +

View File

@ -119,7 +119,7 @@ function renderWorkOrderComments() {
workOrderComment.workOrderCommentDateString +
(workOrderComment.workOrderCommentTime === 0
? ''
: ' ' + workOrderComment.workOrderCommentTimeString) +
: ' ' + workOrderComment.workOrderCommentTimePeriodString) +
'</td>' +
'<td>' +
cityssm.escapeHTML((_b = workOrderComment.workOrderComment) !== null && _b !== void 0 ? _b : '') +

View File

@ -193,7 +193,7 @@ function renderWorkOrderComments(): void {
workOrderComment.workOrderCommentDateString +
(workOrderComment.workOrderCommentTime === 0
? ''
: ' ' + workOrderComment.workOrderCommentTimeString) +
: ' ' + workOrderComment.workOrderCommentTimePeriodString!) +
'</td>' +
'<td>' +
cityssm.escapeHTML(workOrderComment.workOrderComment ?? '') +

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -23,7 +23,7 @@ import { getWorkOrder, getWorkOrderByWorkOrderNumber } from '../helpers/lotOccup
import { reopenWorkOrder } from '../helpers/lotOccupancyDB/reopenWorkOrder.js';
import { addWorkOrderMilestone } from '../helpers/lotOccupancyDB/addWorkOrderMilestone.js';
import { closeWorkOrder } from '../helpers/lotOccupancyDB/closeWorkOrder.js';
import { dateIntegerToString, dateToString } from '@cityssm/expressjs-server-js/dateTimeFns.js';
import { dateIntegerToString, dateToString } from '@cityssm/utils-datetime';
const user = {
user: {
userName: 'import.unix',

View File

@ -52,7 +52,7 @@ import { closeWorkOrder } from '../helpers/lotOccupancyDB/closeWorkOrder.js'
import {
dateIntegerToString,
dateToString
} from '@cityssm/expressjs-server-js/dateTimeFns.js'
} from '@cityssm/utils-datetime'
import type * as recordTypes from '../types/recordTypes'

View File

@ -74,6 +74,7 @@ export interface LotComment extends Record {
lotCommentDateString?: string;
lotCommentTime?: number;
lotCommentTimeString?: string;
lotCommentTimePeriodString?: string;
lotComment?: string;
}
export interface LotField extends LotTypeField, Record {
@ -181,6 +182,7 @@ export interface LotOccupancyComment extends Record {
lotOccupancyCommentDateString?: string;
lotOccupancyCommentTime?: number;
lotOccupancyCommentTimeString?: string;
lotOccupancyCommentTimePeriodString?: string;
lotOccupancyComment?: string;
}
export interface LotOccupancyField extends OccupancyTypeField, Record {
@ -227,6 +229,7 @@ export interface WorkOrderComment extends Record {
workOrderCommentDateString?: string;
workOrderCommentTime?: number;
workOrderCommentTimeString?: string;
workOrderCommentTimePeriodString?: string;
workOrderComment?: string;
}
export interface WorkOrderMilestone extends Record, WorkOrder {

View File

@ -101,6 +101,7 @@ export interface LotComment extends Record {
lotCommentTime?: number
lotCommentTimeString?: string
lotCommentTimePeriodString?: string
lotComment?: string
}
@ -237,6 +238,7 @@ export interface LotOccupancyComment extends Record {
lotOccupancyCommentTime?: number
lotOccupancyCommentTimeString?: string
lotOccupancyCommentTimePeriodString?: string
lotOccupancyComment?: string
}
@ -301,6 +303,7 @@ export interface WorkOrderComment extends Record {
workOrderCommentTime?: number
workOrderCommentTimeString?: string
workOrderCommentTimePeriodString?: string
workOrderComment?: string
}

View File

@ -132,7 +132,7 @@
<td><%= lotComment.recordCreate_userName %></td>
<td>
<%= lotComment.lotCommentDateString %>
<%= (lotComment.lotCommentTime === 0 ? "" : lotComment.lotCommentTimeString) %>
<%= (lotComment.lotCommentTime === 0 ? "" : lotComment.lotCommentTimePeriodString) %>
</td>
<td><%= lotComment.lotComment %></td>
</tr>

View File

@ -239,7 +239,7 @@
<td><%= lotOccupancyComment.recordCreate_userName %></td>
<td>
<%= lotOccupancyComment.lotOccupancyCommentDateString %>
<%= (lotOccupancyComment.lotOccupancyCommentTime === 0 ? "" : lotOccupancyComment.lotOccupancyCommentTimeString) %>
<%= (lotOccupancyComment.lotOccupancyCommentTime === 0 ? "" : lotOccupancyComment.lotOccupancyCommentTimePeriodString) %>
</td>
<td><%= lotOccupancyComment.lotOccupancyComment %></td>
</tr>

View File

@ -24,7 +24,7 @@
<% for (const comment of workOrder.workOrderComments) { %>
<tr>
<td><%= comment.recordUpdate_userName %></td>
<td><%= comment.workOrderCommentDateString %> <%= comment.workOrderCommentTimeString %></td>
<td><%= comment.workOrderCommentDateString %> <%= comment.workOrderCommentTimePeriodString %></td>
<td><%= comment.workOrderComment %></td>
</tr>
<% } %>

View File

@ -279,7 +279,7 @@
<td><%= workOrderComment.recordCreate_userName %></td>
<td>
<%= workOrderComment.workOrderCommentDateString %>
<%= (workOrderComment.workOrderCommentTime === 0 ? "" : workOrderComment.workOrderCommentTimeString) %>
<%= (workOrderComment.workOrderCommentTime === 0 ? "" : workOrderComment.workOrderCommentTimePeriodString) %>
</td>
<td><%= workOrderComment.workOrderComment %></td>
</tr>