refactoring

deepsource-autofix-76c6eb20
Dan Gowans 2024-06-24 14:00:54 -04:00
parent 15e6fc3d66
commit b63d6225e1
266 changed files with 620 additions and 774 deletions

View File

@ -1,6 +1,6 @@
import { calculateFeeAmount, calculateTaxAmount } from '../helpers/functions.fee.js';
import { getFee } from './getFee.js';
import { getLotOccupancy } from './getLotOccupancy.js';
import getFee from './getFee.js';
import getLotOccupancy from './getLotOccupancy.js';
import { acquireConnection } from './pool.js';
export default async function addLotOccupancyFee(lotOccupancyFeeForm, user) {
const database = await acquireConnection();

View File

@ -4,8 +4,8 @@ import {
} from '../helpers/functions.fee.js'
import type { Fee, LotOccupancy } from '../types/recordTypes.js'
import { getFee } from './getFee.js'
import { getLotOccupancy } from './getLotOccupancy.js'
import getFee from './getFee.js'
import getLotOccupancy from './getLotOccupancy.js'
import { acquireConnection } from './pool.js'
export interface AddLotOccupancyFeeForm {

View File

@ -1,6 +1,6 @@
import { dateStringToInteger, dateToInteger } from '@cityssm/utils-datetime';
import addWorkOrderLotOccupancy from './addWorkOrderLotOccupancy.js';
import { getNextWorkOrderNumber } from './getNextWorkOrderNumber.js';
import getNextWorkOrderNumber from './getNextWorkOrderNumber.js';
import { acquireConnection } from './pool.js';
export default async function addWorkOrder(workOrderForm, user) {
const database = await acquireConnection();

View File

@ -1,7 +1,11 @@
import { dateStringToInteger, dateToInteger } from '@cityssm/utils-datetime'
import {
type DateString,
dateStringToInteger,
dateToInteger
} from '@cityssm/utils-datetime'
import addWorkOrderLotOccupancy from './addWorkOrderLotOccupancy.js'
import { getNextWorkOrderNumber } from './getNextWorkOrderNumber.js'
import getNextWorkOrderNumber from './getNextWorkOrderNumber.js'
import { acquireConnection } from './pool.js'
export interface AddWorkOrderForm {
@ -42,10 +46,14 @@ export default async function addWorkOrder(
workOrderForm.workOrderDescription,
(workOrderForm.workOrderOpenDateString ?? '') === ''
? dateToInteger(rightNow)
: dateStringToInteger(workOrderForm.workOrderOpenDateString!),
: dateStringToInteger(
workOrderForm.workOrderOpenDateString as DateString
),
(workOrderForm.workOrderCloseDateString ?? '') === ''
? undefined
: dateStringToInteger(workOrderForm.workOrderCloseDateString!),
: dateStringToInteger(
workOrderForm.workOrderCloseDateString as DateString
),
user.userName,
rightNow.getTime(),
user.userName,

View File

@ -1,7 +1,7 @@
import { dateToString } from '@cityssm/utils-datetime';
import addLotOccupancy from './addLotOccupancy.js';
import addLotOccupancyOccupant from './addLotOccupancyOccupant.js';
import { getLotOccupancy } from './getLotOccupancy.js';
import getLotOccupancy from './getLotOccupancy.js';
import { acquireConnection } from './pool.js';
export default async function copyLotOccupancy(oldLotOccupancyId, user) {
const database = await acquireConnection();

View File

@ -2,7 +2,7 @@ import { dateToString } from '@cityssm/utils-datetime'
import addLotOccupancy from './addLotOccupancy.js'
import addLotOccupancyOccupant from './addLotOccupancyOccupant.js'
import { getLotOccupancy } from './getLotOccupancy.js'
import getLotOccupancy from './getLotOccupancy.js'
import { acquireConnection } from './pool.js'
export default async function copyLotOccupancy(

View File

@ -1,4 +1,3 @@
import type { PoolConnection } from 'better-sqlite-pool';
import type { Fee } from '../types/recordTypes.js';
export declare function getFee(feeId: number | string, connectedDatabase?: PoolConnection): Promise<Fee | undefined>;
export default getFee;
export default function getFee(feeId: number | string, connectedDatabase?: PoolConnection): Promise<Fee | undefined>;

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
export async function getFee(feeId, connectedDatabase) {
export default async function getFee(feeId, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
const fee = database
.prepare(`select f.feeId,
@ -23,4 +23,3 @@ export async function getFee(feeId, connectedDatabase) {
}
return fee;
}
export default getFee;

View File

@ -4,7 +4,7 @@ import type { Fee } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
export async function getFee(
export default async function getFee(
feeId: number | string,
connectedDatabase?: PoolConnection
): Promise<Fee | undefined> {
@ -36,5 +36,3 @@ export async function getFee(
return fee
}
export default getFee

View File

@ -6,5 +6,5 @@ interface GetFeeCategoriesFilters {
interface GetFeeCategoriesOptions {
includeFees?: boolean;
}
export declare function getFeeCategories(filters: GetFeeCategoriesFilters, options: GetFeeCategoriesOptions): Promise<FeeCategory[]>;
export default getFeeCategories;
export default function getFeeCategories(filters: GetFeeCategoriesFilters, options: GetFeeCategoriesOptions): Promise<FeeCategory[]>;
export {};

View File

@ -1,32 +1,26 @@
import { getFees } from './getFees.js';
import getFees from './getFees.js';
import { acquireConnection } from './pool.js';
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
export async function getFeeCategories(filters, options) {
export default async function getFeeCategories(filters, options) {
const updateOrderNumbers = !(filters.lotTypeId || filters.occupancyTypeId) && options.includeFees;
const database = await acquireConnection();
let sqlWhereClause = ' where recordDelete_timeMillis is null';
const sqlParameters = [];
if ((filters.occupancyTypeId ?? '') !== '') {
sqlWhereClause +=
' and feeCategoryId in (' +
'select feeCategoryId from Fees' +
' where recordDelete_timeMillis is null' +
' and (occupancyTypeId is null or occupancyTypeId = ?))';
sqlWhereClause += ` and feeCategoryId in (
select feeCategoryId from Fees where recordDelete_timeMillis is null and (occupancyTypeId is null or occupancyTypeId = ?))`;
sqlParameters.push(filters.occupancyTypeId);
}
if ((filters.lotTypeId ?? '') !== '') {
sqlWhereClause +=
' and feeCategoryId in (' +
'select feeCategoryId from Fees' +
' where recordDelete_timeMillis is null' +
' and (lotTypeId is null or lotTypeId = ?))';
sqlWhereClause += ` and feeCategoryId in (
select feeCategoryId from Fees where recordDelete_timeMillis is null and (lotTypeId is null or lotTypeId = ?))`;
sqlParameters.push(filters.lotTypeId);
}
const feeCategories = database
.prepare('select feeCategoryId, feeCategory, orderNumber' +
' from FeeCategories' +
sqlWhereClause +
' order by orderNumber, feeCategory')
.prepare(`select feeCategoryId, feeCategory, orderNumber
from FeeCategories
${sqlWhereClause}
order by orderNumber, feeCategory`)
.all(sqlParameters);
if (options.includeFees ?? false) {
let expectedOrderNumber = 0;
@ -43,4 +37,3 @@ export async function getFeeCategories(filters, options) {
database.release();
return feeCategories;
}
export default getFeeCategories;

View File

@ -1,6 +1,6 @@
import type { FeeCategory } from '../types/recordTypes.js'
import { getFees } from './getFees.js'
import getFees from './getFees.js'
import { acquireConnection } from './pool.js'
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
@ -13,7 +13,7 @@ interface GetFeeCategoriesOptions {
includeFees?: boolean
}
export async function getFeeCategories(
export default async function getFeeCategories(
filters: GetFeeCategoriesFilters,
options: GetFeeCategoriesOptions
): Promise<FeeCategory[]> {
@ -27,31 +27,25 @@ export async function getFeeCategories(
const sqlParameters: unknown[] = []
if ((filters.occupancyTypeId ?? '') !== '') {
sqlWhereClause +=
' and feeCategoryId in (' +
'select feeCategoryId from Fees' +
' where recordDelete_timeMillis is null' +
' and (occupancyTypeId is null or occupancyTypeId = ?))'
sqlWhereClause += ` and feeCategoryId in (
select feeCategoryId from Fees where recordDelete_timeMillis is null and (occupancyTypeId is null or occupancyTypeId = ?))`
sqlParameters.push(filters.occupancyTypeId)
}
if ((filters.lotTypeId ?? '') !== '') {
sqlWhereClause +=
' and feeCategoryId in (' +
'select feeCategoryId from Fees' +
' where recordDelete_timeMillis is null' +
' and (lotTypeId is null or lotTypeId = ?))'
sqlWhereClause += ` and feeCategoryId in (
select feeCategoryId from Fees where recordDelete_timeMillis is null and (lotTypeId is null or lotTypeId = ?))`
sqlParameters.push(filters.lotTypeId)
}
const feeCategories = database
.prepare(
'select feeCategoryId, feeCategory, orderNumber' +
' from FeeCategories' +
sqlWhereClause +
' order by orderNumber, feeCategory'
`select feeCategoryId, feeCategory, orderNumber
from FeeCategories
${sqlWhereClause}
order by orderNumber, feeCategory`
)
.all(sqlParameters) as FeeCategory[]
@ -87,5 +81,3 @@ export async function getFeeCategories(
return feeCategories
}
export default getFeeCategories

View File

@ -4,5 +4,5 @@ interface GetFeesFilters {
occupancyTypeId?: number | string;
lotTypeId?: number | string;
}
export declare function getFees(feeCategoryId: number, additionalFilters: GetFeesFilters, connectedDatabase?: PoolConnection): Promise<Fee[]>;
export default getFees;
export default function getFees(feeCategoryId: number, additionalFilters: GetFeesFilters, connectedDatabase?: PoolConnection): Promise<Fee[]>;
export {};

View File

@ -1,6 +1,6 @@
import { acquireConnection } from './pool.js';
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
export async function getFees(feeCategoryId, additionalFilters, connectedDatabase) {
export default async function getFees(feeCategoryId, additionalFilters, connectedDatabase) {
const updateOrderNumbers = !(additionalFilters.lotTypeId || additionalFilters.occupancyTypeId);
const database = connectedDatabase ?? (await acquireConnection());
let sqlWhereClause = ' where f.recordDelete_timeMillis is null and f.feeCategoryId = ?';
@ -52,4 +52,3 @@ export async function getFees(feeCategoryId, additionalFilters, connectedDatabas
}
return fees;
}
export default getFees;

View File

@ -10,7 +10,7 @@ interface GetFeesFilters {
lotTypeId?: number | string
}
export async function getFees(
export default async function getFees(
feeCategoryId: number,
additionalFilters: GetFeesFilters,
connectedDatabase?: PoolConnection
@ -89,5 +89,3 @@ export async function getFees(
return fees
}
export default getFees

View File

@ -1,4 +1,3 @@
import type { Lot } from '../types/recordTypes.js';
export declare function getLotByLotName(lotName: string): Promise<Lot | undefined>;
export declare function getLot(lotId: number | string): Promise<Lot | undefined>;
export default getLot;
export default function getLot(lotId: number | string): Promise<Lot | undefined>;

View File

@ -1,6 +1,6 @@
import { getLotComments } from './getLotComments.js';
import { getLotFields } from './getLotFields.js';
import { getLotOccupancies } from './getLotOccupancies.js';
import getLotComments from './getLotComments.js';
import getLotFields from './getLotFields.js';
import getLotOccupancies from './getLotOccupancies.js';
import { acquireConnection } from './pool.js';
const baseSQL = `select l.lotId, l.lotTypeId, t.lotType, l.lotName, l.lotStatusId, s.lotStatus,
l.mapId, m.mapName, m.mapSVG, l.mapKey,
@ -31,9 +31,8 @@ async function _getLot(sql, lotIdOrLotName) {
return lot;
}
export async function getLotByLotName(lotName) {
return await _getLot(baseSQL + ' and l.lotName = ?', lotName);
return await _getLot(`${baseSQL} and l.lotName = ?`, lotName);
}
export async function getLot(lotId) {
return await _getLot(baseSQL + ' and l.lotId = ?', lotId);
export default async function getLot(lotId) {
return await _getLot(`${baseSQL} and l.lotId = ?`, lotId);
}
export default getLot;

View File

@ -1,8 +1,8 @@
import type { Lot } from '../types/recordTypes.js'
import { getLotComments } from './getLotComments.js'
import { getLotFields } from './getLotFields.js'
import { getLotOccupancies } from './getLotOccupancies.js'
import getLotComments from './getLotComments.js'
import getLotFields from './getLotFields.js'
import getLotOccupancies from './getLotOccupancies.js'
import { acquireConnection } from './pool.js'
const baseSQL = `select l.lotId, l.lotTypeId, t.lotType, l.lotName, l.lotStatusId, s.lotStatus,
@ -52,11 +52,11 @@ async function _getLot(
export async function getLotByLotName(
lotName: string
): Promise<Lot | undefined> {
return await _getLot(baseSQL + ' and l.lotName = ?', lotName)
return await _getLot(`${baseSQL} and l.lotName = ?`, lotName)
}
export async function getLot(lotId: number | string): Promise<Lot | undefined> {
return await _getLot(baseSQL + ' and l.lotId = ?', lotId)
export default async function getLot(
lotId: number | string
): Promise<Lot | undefined> {
return await _getLot(`${baseSQL} and l.lotId = ?`, lotId)
}
export default getLot

View File

@ -1,4 +1,3 @@
import type { PoolConnection } from 'better-sqlite-pool';
import type { LotComment } from '../types/recordTypes.js';
export declare function getLotComments(lotId: number | string, connectedDatabase?: PoolConnection): Promise<LotComment[]>;
export default getLotComments;
export default function getLotComments(lotId: number | string, connectedDatabase?: PoolConnection): Promise<LotComment[]>;

View File

@ -1,6 +1,6 @@
import { dateIntegerToString, timeIntegerToString, timeIntegerToPeriodString } from '@cityssm/utils-datetime';
import { dateIntegerToString, timeIntegerToPeriodString, timeIntegerToString } from '@cityssm/utils-datetime';
import { acquireConnection } from './pool.js';
export async function getLotComments(lotId, connectedDatabase) {
export default async function getLotComments(lotId, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
database.function('userFn_dateIntegerToString', dateIntegerToString);
database.function('userFn_timeIntegerToString', timeIntegerToString);
@ -23,4 +23,3 @@ export async function getLotComments(lotId, connectedDatabase) {
}
return lotComments;
}
export default getLotComments;

View File

@ -1,7 +1,7 @@
import {
dateIntegerToString,
timeIntegerToString,
timeIntegerToPeriodString
timeIntegerToPeriodString,
timeIntegerToString
} from '@cityssm/utils-datetime'
import type { PoolConnection } from 'better-sqlite-pool'
@ -9,7 +9,7 @@ import type { LotComment } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
export async function getLotComments(
export default async function getLotComments(
lotId: number | string,
connectedDatabase?: PoolConnection
): Promise<LotComment[]> {
@ -44,5 +44,3 @@ export async function getLotComments(
return lotComments
}
export default getLotComments

View File

@ -1,4 +1,3 @@
import type { PoolConnection } from 'better-sqlite-pool';
import type { LotField } from '../types/recordTypes.js';
export declare function getLotFields(lotId: number | string, connectedDatabase?: PoolConnection): Promise<LotField[]>;
export default getLotFields;
export default function getLotFields(lotId: number | string, connectedDatabase?: PoolConnection): Promise<LotField[]>;

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
export async function getLotFields(lotId, connectedDatabase) {
export default async function getLotFields(lotId, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
const lotFields = database
.prepare(`select l.lotId, l.lotTypeFieldId,
@ -34,4 +34,3 @@ export async function getLotFields(lotId, connectedDatabase) {
}
return lotFields;
}
export default getLotFields;

View File

@ -4,7 +4,7 @@ import type { LotField } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
export async function getLotFields(
export default async function getLotFields(
lotId: number | string,
connectedDatabase?: PoolConnection
): Promise<LotField[]> {
@ -47,5 +47,3 @@ export async function getLotFields(
return lotFields
}
export default getLotFields

View File

@ -1,4 +1,4 @@
import { DateString } from '@cityssm/utils-datetime';
import { type DateString } from '@cityssm/utils-datetime';
import type { PoolConnection } from 'better-sqlite-pool';
import type { LotOccupancy } from '../types/recordTypes.js';
interface GetLotOccupanciesFilters {
@ -22,8 +22,8 @@ interface GetLotOccupanciesOptions {
includeFees: boolean;
includeTransactions: boolean;
}
export declare function getLotOccupancies(filters: GetLotOccupanciesFilters, options: GetLotOccupanciesOptions, connectedDatabase?: PoolConnection): Promise<{
export default function getLotOccupancies(filters: GetLotOccupanciesFilters, options: GetLotOccupanciesOptions, connectedDatabase?: PoolConnection): Promise<{
count: number;
lotOccupancies: LotOccupancy[];
}>;
export default getLotOccupancies;
export {};

View File

@ -2,9 +2,9 @@ import { dateIntegerToString, dateStringToInteger } from '@cityssm/utils-datetim
import { getOccupancyTypeById } from '../helpers/functions.cache.js';
import { getConfigProperty } from '../helpers/functions.config.js';
import { getLotNameWhereClause, getOccupancyTimeWhereClause, getOccupantNameWhereClause } from '../helpers/functions.sqlFilters.js';
import { getLotOccupancyFees } from './getLotOccupancyFees.js';
import { getLotOccupancyOccupants } from './getLotOccupancyOccupants.js';
import { getLotOccupancyTransactions } from './getLotOccupancyTransactions.js';
import getLotOccupancyFees from './getLotOccupancyFees.js';
import getLotOccupancyOccupants from './getLotOccupancyOccupants.js';
import getLotOccupancyTransactions from './getLotOccupancyTransactions.js';
import { acquireConnection } from './pool.js';
function buildWhereClause(filters) {
let sqlWhereClause = ' where o.recordDelete_timeMillis is null';
@ -77,7 +77,7 @@ async function addInclusions(lotOccupancy, options, database) {
}
return lotOccupancy;
}
export async function getLotOccupancies(filters, options, connectedDatabase) {
export default async function getLotOccupancies(filters, options, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
database.function('userFn_dateIntegerToString', dateIntegerToString);
const { sqlWhereClause, sqlParameters } = buildWhereClause(filters);
@ -130,4 +130,3 @@ export async function getLotOccupancies(filters, options, connectedDatabase) {
lotOccupancies
};
}
export default getLotOccupancies;

View File

@ -1,5 +1,5 @@
import {
DateString,
type DateString,
dateIntegerToString,
dateStringToInteger
} from '@cityssm/utils-datetime'
@ -14,9 +14,9 @@ import {
} from '../helpers/functions.sqlFilters.js'
import type { LotOccupancy } from '../types/recordTypes.js'
import { getLotOccupancyFees } from './getLotOccupancyFees.js'
import { getLotOccupancyOccupants } from './getLotOccupancyOccupants.js'
import { getLotOccupancyTransactions } from './getLotOccupancyTransactions.js'
import getLotOccupancyFees from './getLotOccupancyFees.js'
import getLotOccupancyOccupants from './getLotOccupancyOccupants.js'
import getLotOccupancyTransactions from './getLotOccupancyTransactions.js'
import { acquireConnection } from './pool.js'
interface GetLotOccupanciesFilters {
@ -162,7 +162,7 @@ async function addInclusions(
return lotOccupancy
}
export async function getLotOccupancies(
export default async function getLotOccupancies(
filters: GetLotOccupanciesFilters,
options: GetLotOccupanciesOptions,
connectedDatabase?: PoolConnection
@ -242,5 +242,3 @@ export async function getLotOccupancies(
lotOccupancies
}
}
export default getLotOccupancies

View File

@ -1,4 +1,3 @@
import type { PoolConnection } from 'better-sqlite-pool';
import type { LotOccupancy } from '../types/recordTypes.js';
export declare function getLotOccupancy(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancy | undefined>;
export default getLotOccupancy;
export default function getLotOccupancy(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancy | undefined>;

View File

@ -1,12 +1,12 @@
import { dateIntegerToString } from '@cityssm/utils-datetime';
import { getLotOccupancyComments } from './getLotOccupancyComments.js';
import { getLotOccupancyFees } from './getLotOccupancyFees.js';
import { getLotOccupancyFields } from './getLotOccupancyFields.js';
import { getLotOccupancyOccupants } from './getLotOccupancyOccupants.js';
import { getLotOccupancyTransactions } from './getLotOccupancyTransactions.js';
import getLotOccupancyComments from './getLotOccupancyComments.js';
import getLotOccupancyFees from './getLotOccupancyFees.js';
import getLotOccupancyFields from './getLotOccupancyFields.js';
import getLotOccupancyOccupants from './getLotOccupancyOccupants.js';
import getLotOccupancyTransactions from './getLotOccupancyTransactions.js';
import { getWorkOrders } from './getWorkOrders.js';
import { acquireConnection } from './pool.js';
export async function getLotOccupancy(lotOccupancyId, connectedDatabase) {
export default async function getLotOccupancy(lotOccupancyId, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
database.function('userFn_dateIntegerToString', dateIntegerToString);
const lotOccupancy = database
@ -43,4 +43,3 @@ export async function getLotOccupancy(lotOccupancyId, connectedDatabase) {
}
return lotOccupancy;
}
export default getLotOccupancy;

View File

@ -3,15 +3,15 @@ import type { PoolConnection } from 'better-sqlite-pool'
import type { LotOccupancy } from '../types/recordTypes.js'
import { getLotOccupancyComments } from './getLotOccupancyComments.js'
import { getLotOccupancyFees } from './getLotOccupancyFees.js'
import { getLotOccupancyFields } from './getLotOccupancyFields.js'
import { getLotOccupancyOccupants } from './getLotOccupancyOccupants.js'
import { getLotOccupancyTransactions } from './getLotOccupancyTransactions.js'
import getLotOccupancyComments from './getLotOccupancyComments.js'
import getLotOccupancyFees from './getLotOccupancyFees.js'
import getLotOccupancyFields from './getLotOccupancyFields.js'
import getLotOccupancyOccupants from './getLotOccupancyOccupants.js'
import getLotOccupancyTransactions from './getLotOccupancyTransactions.js'
import { getWorkOrders } from './getWorkOrders.js'
import { acquireConnection } from './pool.js'
export async function getLotOccupancy(
export default async function getLotOccupancy(
lotOccupancyId: number | string,
connectedDatabase?: PoolConnection
): Promise<LotOccupancy | undefined> {
@ -80,5 +80,3 @@ export async function getLotOccupancy(
return lotOccupancy
}
export default getLotOccupancy

View File

@ -1,4 +1,3 @@
import type { PoolConnection } from 'better-sqlite-pool';
import type { LotOccupancyComment } from '../types/recordTypes.js';
export declare function getLotOccupancyComments(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancyComment[]>;
export default getLotOccupancyComments;
export default function getLotOccupancyComments(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancyComment[]>;

View File

@ -1,6 +1,6 @@
import { dateIntegerToString, timeIntegerToString, timeIntegerToPeriodString } from '@cityssm/utils-datetime';
import { dateIntegerToString, timeIntegerToPeriodString, timeIntegerToString } from '@cityssm/utils-datetime';
import { acquireConnection } from './pool.js';
export async function getLotOccupancyComments(lotOccupancyId, connectedDatabase) {
export default async function getLotOccupancyComments(lotOccupancyId, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
database.function('userFn_dateIntegerToString', dateIntegerToString);
database.function('userFn_timeIntegerToString', timeIntegerToString);
@ -23,4 +23,3 @@ export async function getLotOccupancyComments(lotOccupancyId, connectedDatabase)
}
return lotComments;
}
export default getLotOccupancyComments;

View File

@ -1,7 +1,7 @@
import {
dateIntegerToString,
timeIntegerToString,
timeIntegerToPeriodString
timeIntegerToPeriodString,
timeIntegerToString
} from '@cityssm/utils-datetime'
import type { PoolConnection } from 'better-sqlite-pool'
@ -9,7 +9,7 @@ import type { LotOccupancyComment } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
export async function getLotOccupancyComments(
export default async function getLotOccupancyComments(
lotOccupancyId: number | string,
connectedDatabase?: PoolConnection
): Promise<LotOccupancyComment[]> {
@ -24,6 +24,7 @@ export async function getLotOccupancyComments(
const lotComments = database
.prepare(
// eslint-disable-next-line no-secrets/no-secrets
`select lotOccupancyCommentId,
lotOccupancyCommentDate, userFn_dateIntegerToString(lotOccupancyCommentDate) as lotOccupancyCommentDateString,
lotOccupancyCommentTime,
@ -44,5 +45,3 @@ export async function getLotOccupancyComments(
return lotComments
}
export default getLotOccupancyComments

View File

@ -1,4 +1,3 @@
import type { PoolConnection } from 'better-sqlite-pool';
import type { LotOccupancyFee } from '../types/recordTypes.js';
export declare function getLotOccupancyFees(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancyFee[]>;
export default getLotOccupancyFees;
export default function getLotOccupancyFees(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancyFee[]>;

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
export async function getLotOccupancyFees(lotOccupancyId, connectedDatabase) {
export default async function getLotOccupancyFees(lotOccupancyId, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
const lotOccupancyFees = database
.prepare(`select o.lotOccupancyId, o.feeId,
@ -17,4 +17,3 @@ export async function getLotOccupancyFees(lotOccupancyId, connectedDatabase) {
}
return lotOccupancyFees;
}
export default getLotOccupancyFees;

View File

@ -4,7 +4,7 @@ import type { LotOccupancyFee } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
export async function getLotOccupancyFees(
export default async function getLotOccupancyFees(
lotOccupancyId: number | string,
connectedDatabase?: PoolConnection
): Promise<LotOccupancyFee[]> {
@ -30,5 +30,3 @@ export async function getLotOccupancyFees(
return lotOccupancyFees
}
export default getLotOccupancyFees

View File

@ -1,4 +1,3 @@
import type { PoolConnection } from 'better-sqlite-pool';
import type { LotOccupancyField } from '../types/recordTypes.js';
export declare function getLotOccupancyFields(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancyField[]>;
export default getLotOccupancyFields;
export default function getLotOccupancyFields(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancyField[]>;

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
export async function getLotOccupancyFields(lotOccupancyId, connectedDatabase) {
export default async function getLotOccupancyFields(lotOccupancyId, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
const lotOccupancyFields = database
.prepare(`select o.lotOccupancyId, o.occupancyTypeFieldId,
@ -31,4 +31,3 @@ export async function getLotOccupancyFields(lotOccupancyId, connectedDatabase) {
}
return lotOccupancyFields;
}
export default getLotOccupancyFields;

View File

@ -4,7 +4,7 @@ import type { LotOccupancyField } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
export async function getLotOccupancyFields(
export default async function getLotOccupancyFields(
lotOccupancyId: number | string,
connectedDatabase?: PoolConnection
): Promise<LotOccupancyField[]> {
@ -49,5 +49,3 @@ export async function getLotOccupancyFields(
return lotOccupancyFields
}
export default getLotOccupancyFields

View File

@ -1,4 +1,3 @@
import type { PoolConnection } from 'better-sqlite-pool';
import type { LotOccupancyOccupant } from '../types/recordTypes.js';
export declare function getLotOccupancyOccupants(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancyOccupant[]>;
export default getLotOccupancyOccupants;
export default function getLotOccupancyOccupants(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancyOccupant[]>;

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
export async function getLotOccupancyOccupants(lotOccupancyId, connectedDatabase) {
export default async function getLotOccupancyOccupants(lotOccupancyId, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
const lotOccupancyOccupants = database
.prepare(`select o.lotOccupancyId, o.lotOccupantIndex,
@ -21,4 +21,3 @@ export async function getLotOccupancyOccupants(lotOccupancyId, connectedDatabase
}
return lotOccupancyOccupants;
}
export default getLotOccupancyOccupants;

View File

@ -4,7 +4,7 @@ import type { LotOccupancyOccupant } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
export async function getLotOccupancyOccupants(
export default async function getLotOccupancyOccupants(
lotOccupancyId: number | string,
connectedDatabase?: PoolConnection
): Promise<LotOccupancyOccupant[]> {
@ -34,5 +34,3 @@ export async function getLotOccupancyOccupants(
return lotOccupancyOccupants
}
export default getLotOccupancyOccupants

View File

@ -1,6 +1,5 @@
import type { PoolConnection } from 'better-sqlite-pool';
import type { LotOccupancyTransaction } from '../types/recordTypes.js';
export declare function getLotOccupancyTransactions(lotOccupancyId: number | string, options: {
export default function getLotOccupancyTransactions(lotOccupancyId: number | string, options: {
includeIntegrations: boolean;
}, connectedDatabase?: PoolConnection): Promise<LotOccupancyTransaction[]>;
export default getLotOccupancyTransactions;

View File

@ -1,8 +1,8 @@
import { dateIntegerToString, timeIntegerToString } from '@cityssm/utils-datetime';
import { getConfigProperty } from '../helpers/functions.config.js';
import * as gpFunctions from '../helpers/functions.dynamicsGP.js';
import { getDynamicsGPDocument } from '../helpers/functions.dynamicsGP.js';
import { acquireConnection } from './pool.js';
export async function getLotOccupancyTransactions(lotOccupancyId, options, connectedDatabase) {
export default async function getLotOccupancyTransactions(lotOccupancyId, options, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
database.function('userFn_dateIntegerToString', dateIntegerToString);
database.function('userFn_timeIntegerToString', timeIntegerToString);
@ -23,7 +23,7 @@ export async function getLotOccupancyTransactions(lotOccupancyId, options, conne
getConfigProperty('settings.dynamicsGP.integrationIsEnabled')) {
for (const transaction of lotOccupancyTransactions) {
if ((transaction.externalReceiptNumber ?? '') !== '') {
const gpDocument = await gpFunctions.getDynamicsGPDocument(transaction.externalReceiptNumber ?? '');
const gpDocument = await getDynamicsGPDocument(transaction.externalReceiptNumber ?? '');
if (gpDocument !== undefined) {
transaction.dynamicsGPDocument = gpDocument;
}
@ -32,4 +32,3 @@ export async function getLotOccupancyTransactions(lotOccupancyId, options, conne
}
return lotOccupancyTransactions;
}
export default getLotOccupancyTransactions;

View File

@ -5,12 +5,12 @@ import {
import type { PoolConnection } from 'better-sqlite-pool'
import { getConfigProperty } from '../helpers/functions.config.js'
import * as gpFunctions from '../helpers/functions.dynamicsGP.js'
import { getDynamicsGPDocument } from '../helpers/functions.dynamicsGP.js'
import type { LotOccupancyTransaction } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
export async function getLotOccupancyTransactions(
export default async function getLotOccupancyTransactions(
lotOccupancyId: number | string,
options: {
includeIntegrations: boolean
@ -45,7 +45,7 @@ export async function getLotOccupancyTransactions(
) {
for (const transaction of lotOccupancyTransactions) {
if ((transaction.externalReceiptNumber ?? '') !== '') {
const gpDocument = await gpFunctions.getDynamicsGPDocument(
const gpDocument = await getDynamicsGPDocument(
transaction.externalReceiptNumber ?? ''
)
@ -58,5 +58,3 @@ export async function getLotOccupancyTransactions(
return lotOccupancyTransactions
}
export default getLotOccupancyTransactions

View File

@ -1,3 +1,2 @@
import type { LotOccupantType } from '../types/recordTypes.js';
export declare function getLotOccupantTypes(): Promise<LotOccupantType[]>;
export default getLotOccupantTypes;
export default function getLotOccupantTypes(): Promise<LotOccupantType[]>;

View File

@ -1,6 +1,6 @@
import { acquireConnection } from './pool.js';
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
export async function getLotOccupantTypes() {
export default async function getLotOccupantTypes() {
const database = await acquireConnection();
const lotOccupantTypes = database
.prepare(`select lotOccupantTypeId, lotOccupantType, fontAwesomeIconClass, occupantCommentTitle,
@ -20,4 +20,3 @@ export async function getLotOccupantTypes() {
database.release();
return lotOccupantTypes;
}
export default getLotOccupantTypes;

View File

@ -3,7 +3,9 @@ import type { LotOccupantType } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
export async function getLotOccupantTypes(): Promise<LotOccupantType[]> {
export default async function getLotOccupantTypes(): Promise<
LotOccupantType[]
> {
const database = await acquireConnection()
const lotOccupantTypes = database
@ -37,5 +39,3 @@ export async function getLotOccupantTypes(): Promise<LotOccupantType[]> {
return lotOccupantTypes
}
export default getLotOccupantTypes

View File

@ -5,5 +5,5 @@ interface GetFilters {
interface LotStatusSummary extends LotStatus {
lotCount: number;
}
export declare function getLotStatusSummary(filters: GetFilters): Promise<LotStatusSummary[]>;
export default getLotStatusSummary;
export default function getLotStatusSummary(filters: GetFilters): Promise<LotStatusSummary[]>;
export {};

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
export async function getLotStatusSummary(filters) {
export default async function getLotStatusSummary(filters) {
const database = await acquireConnection();
let sqlWhereClause = ' where l.recordDelete_timeMillis is null';
const sqlParameters = [];
@ -18,4 +18,3 @@ export async function getLotStatusSummary(filters) {
database.release();
return lotStatuses;
}
export default getLotStatusSummary;

View File

@ -10,7 +10,7 @@ interface LotStatusSummary extends LotStatus {
lotCount: number
}
export async function getLotStatusSummary(
export default async function getLotStatusSummary(
filters: GetFilters
): Promise<LotStatusSummary[]> {
const database = await acquireConnection()
@ -38,5 +38,3 @@ export async function getLotStatusSummary(
return lotStatuses
}
export default getLotStatusSummary

View File

@ -1,3 +1,2 @@
import type { LotStatus } from '../types/recordTypes.js';
export declare function getLotStatuses(): Promise<LotStatus[]>;
export default getLotStatuses;
export default function getLotStatuses(): Promise<LotStatus[]>;

View File

@ -1,6 +1,6 @@
import { acquireConnection } from './pool.js';
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
export async function getLotStatuses() {
export default async function getLotStatuses() {
const database = await acquireConnection();
const lotStatuses = database
.prepare(`select lotStatusId, lotStatus, orderNumber
@ -19,4 +19,3 @@ export async function getLotStatuses() {
database.release();
return lotStatuses;
}
export default getLotStatuses;

View File

@ -3,7 +3,7 @@ import type { LotStatus } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
export async function getLotStatuses(): Promise<LotStatus[]> {
export default async function getLotStatuses(): Promise<LotStatus[]> {
const database = await acquireConnection()
const lotStatuses = database
@ -35,5 +35,3 @@ export async function getLotStatuses(): Promise<LotStatus[]> {
return lotStatuses
}
export default getLotStatuses

View File

@ -1,4 +1,3 @@
import type { PoolConnection } from 'better-sqlite-pool';
import type { LotTypeField } from '../types/recordTypes.js';
export declare function getLotTypeFields(lotTypeId: number, connectedDatabase?: PoolConnection): Promise<LotTypeField[]>;
export default getLotTypeFields;
export default function getLotTypeFields(lotTypeId: number, connectedDatabase?: PoolConnection): Promise<LotTypeField[]>;

View File

@ -1,6 +1,6 @@
import { acquireConnection } from './pool.js';
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
export async function getLotTypeFields(lotTypeId, connectedDatabase) {
export default async function getLotTypeFields(lotTypeId, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
const lotTypeFields = database
.prepare(`select lotTypeFieldId,
@ -24,4 +24,3 @@ export async function getLotTypeFields(lotTypeId, connectedDatabase) {
}
return lotTypeFields;
}
export default getLotTypeFields;

View File

@ -5,7 +5,7 @@ import type { LotTypeField } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
export async function getLotTypeFields(
export default async function getLotTypeFields(
lotTypeId: number,
connectedDatabase?: PoolConnection
): Promise<LotTypeField[]> {
@ -46,5 +46,3 @@ export async function getLotTypeFields(
return lotTypeFields
}
export default getLotTypeFields

View File

@ -5,5 +5,5 @@ interface GetFilters {
interface LotTypeSummary extends LotType {
lotCount: number;
}
export declare function getLotTypeSummary(filters: GetFilters): Promise<LotTypeSummary[]>;
export default getLotTypeSummary;
export default function getLotTypeSummary(filters: GetFilters): Promise<LotTypeSummary[]>;
export {};

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
export async function getLotTypeSummary(filters) {
export default async function getLotTypeSummary(filters) {
const database = await acquireConnection();
let sqlWhereClause = ' where l.recordDelete_timeMillis is null';
const sqlParameters = [];
@ -18,4 +18,3 @@ export async function getLotTypeSummary(filters) {
database.release();
return lotTypes;
}
export default getLotTypeSummary;

View File

@ -10,7 +10,7 @@ interface LotTypeSummary extends LotType {
lotCount: number
}
export async function getLotTypeSummary(
export default async function getLotTypeSummary(
filters: GetFilters
): Promise<LotTypeSummary[]> {
const database = await acquireConnection()
@ -38,5 +38,3 @@ export async function getLotTypeSummary(
return lotTypes
}
export default getLotTypeSummary

View File

@ -1,3 +1,2 @@
import type { LotType } from '../types/recordTypes.js';
export declare function getLotTypes(): Promise<LotType[]>;
export default getLotTypes;
export default function getLotTypes(): Promise<LotType[]>;

View File

@ -1,7 +1,7 @@
import { getLotTypeFields } from './getLotTypeFields.js';
import getLotTypeFields from './getLotTypeFields.js';
import { acquireConnection } from './pool.js';
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
export async function getLotTypes() {
export default async function getLotTypes() {
const database = await acquireConnection();
const lotTypes = database
.prepare(`select lotTypeId, lotType, orderNumber
@ -21,4 +21,3 @@ export async function getLotTypes() {
database.release();
return lotTypes;
}
export default getLotTypes;

View File

@ -1,10 +1,10 @@
import type { LotType } from '../types/recordTypes.js'
import { getLotTypeFields } from './getLotTypeFields.js'
import getLotTypeFields from './getLotTypeFields.js'
import { acquireConnection } from './pool.js'
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
export async function getLotTypes(): Promise<LotType[]> {
export default async function getLotTypes(): Promise<LotType[]> {
const database = await acquireConnection()
const lotTypes = database
@ -39,5 +39,3 @@ export async function getLotTypes(): Promise<LotType[]> {
return lotTypes
}
export default getLotTypes

View File

@ -14,8 +14,8 @@ interface GetLotsOptions {
offset: number;
includeLotOccupancyCount?: boolean;
}
export declare function getLots(filters: GetLotsFilters, options: GetLotsOptions, connectedDatabase?: PoolConnection): Promise<{
export default function getLots(filters: GetLotsFilters, options: GetLotsOptions, connectedDatabase?: PoolConnection): Promise<{
count: number;
lots: Lot[];
}>;
export default getLots;
export {};

View File

@ -39,7 +39,7 @@ function buildWhereClause(filters) {
sqlParameters
};
}
export async function getLots(filters, options, connectedDatabase) {
export default async function getLots(filters, options, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
const { sqlWhereClause, sqlParameters } = buildWhereClause(filters);
const currentDate = dateToInteger(new Date());
@ -104,4 +104,3 @@ export async function getLots(filters, options, connectedDatabase) {
lots
};
}
export default getLots;

View File

@ -74,7 +74,7 @@ function buildWhereClause(filters: GetLotsFilters): {
}
}
export async function getLots(
export default async function getLots(
filters: GetLotsFilters,
options: GetLotsOptions,
connectedDatabase?: PoolConnection
@ -170,5 +170,3 @@ export async function getLots(
lots
}
}
export default getLots

View File

@ -1,3 +1,2 @@
import type { MapRecord } from '../types/recordTypes.js';
export declare function getMap(mapId: number | string): Promise<MapRecord | undefined>;
export default getMap;
export default function getMap(mapId: number | string): Promise<MapRecord | undefined>;

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
export async function getMap(mapId) {
export default async function getMap(mapId) {
const database = await acquireConnection();
const map = database
.prepare(`select m.mapId, m.mapName, m.mapDescription,
@ -25,4 +25,3 @@ export async function getMap(mapId) {
database.release();
return map;
}
export default getMap;

View File

@ -2,7 +2,7 @@ import type { MapRecord } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
export async function getMap(
export default async function getMap(
mapId: number | string
): Promise<MapRecord | undefined> {
const database = await acquireConnection()
@ -35,5 +35,3 @@ export async function getMap(
return map
}
export default getMap

View File

@ -1,3 +1,2 @@
import type { MapRecord } from '../types/recordTypes.js';
export declare function getMaps(): Promise<MapRecord[]>;
export default getMaps;
export default function getMaps(): Promise<MapRecord[]>;

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
export async function getMaps() {
export default async function getMaps() {
const database = await acquireConnection();
const maps = database
.prepare(`select m.mapId, m.mapName, m.mapDescription,
@ -18,4 +18,3 @@ export async function getMaps() {
database.release();
return maps;
}
export default getMaps;

View File

@ -2,7 +2,7 @@ import type { MapRecord } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
export async function getMaps(): Promise<MapRecord[]> {
export default async function getMaps(): Promise<MapRecord[]> {
const database = await acquireConnection()
const maps = database
@ -26,5 +26,3 @@ export async function getMaps(): Promise<MapRecord[]> {
return maps
}
export default getMaps

View File

@ -1,2 +1 @@
export declare function getNextLotId(lotId: number | string): Promise<number | undefined>;
export default getNextLotId;
export default function getNextLotId(lotId: number | string): Promise<number | undefined>;

View File

@ -1,6 +1,6 @@
import { getConfigProperty } from '../helpers/functions.config.js';
import { acquireConnection } from './pool.js';
export async function getNextLotId(lotId) {
export default async function getNextLotId(lotId) {
const database = await acquireConnection();
database.function('userFn_lotNameSortName', getConfigProperty('settings.lot.lotNameSortNameFunction'));
const result = database
@ -17,4 +17,3 @@ export async function getNextLotId(lotId) {
}
return result.lotId;
}
export default getNextLotId;

View File

@ -2,7 +2,7 @@ import { getConfigProperty } from '../helpers/functions.config.js'
import { acquireConnection } from './pool.js'
export async function getNextLotId(
export default async function getNextLotId(
lotId: number | string
): Promise<number | undefined> {
const database = await acquireConnection()
@ -33,5 +33,3 @@ export async function getNextLotId(
return result.lotId
}
export default getNextLotId

View File

@ -1,2 +1 @@
export declare function getNextMapId(mapId: number | string): Promise<number | undefined>;
export default getNextMapId;
export default function getNextMapId(mapId: number | string): Promise<number | undefined>;

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
export async function getNextMapId(mapId) {
export default async function getNextMapId(mapId) {
const database = await acquireConnection();
const result = database
.prepare(`select mapId
@ -15,4 +15,3 @@ export async function getNextMapId(mapId) {
}
return result.mapId;
}
export default getNextMapId;

View File

@ -1,6 +1,6 @@
import { acquireConnection } from './pool.js'
export async function getNextMapId(
export default async function getNextMapId(
mapId: number | string
): Promise<number | undefined> {
const database = await acquireConnection()
@ -26,5 +26,3 @@ export async function getNextMapId(
return result.mapId
}
export default getNextMapId

View File

@ -1,3 +1,2 @@
import type { PoolConnection } from 'better-sqlite-pool';
export declare function getNextWorkOrderNumber(connectedDatabase?: PoolConnection): Promise<string>;
export default getNextWorkOrderNumber;
export default function getNextWorkOrderNumber(connectedDatabase?: PoolConnection): Promise<string>;

View File

@ -1,6 +1,6 @@
import { getConfigProperty } from '../helpers/functions.config.js';
import { acquireConnection } from './pool.js';
export async function getNextWorkOrderNumber(connectedDatabase) {
export default async function getNextWorkOrderNumber(connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
const paddingLength = getConfigProperty('settings.workOrders.workOrderNumberLength');
const currentYearString = new Date().getFullYear().toString();
@ -23,4 +23,3 @@ export async function getNextWorkOrderNumber(connectedDatabase) {
workOrderNumberIndex += 1;
return `${currentYearString}-${workOrderNumberIndex.toString().padStart(paddingLength, '0')}`;
}
export default getNextWorkOrderNumber;

View File

@ -4,7 +4,7 @@ import { getConfigProperty } from '../helpers/functions.config.js'
import { acquireConnection } from './pool.js'
export async function getNextWorkOrderNumber(
export default async function getNextWorkOrderNumber(
connectedDatabase?: PoolConnection
): Promise<string> {
const database = connectedDatabase ?? (await acquireConnection())
@ -17,6 +17,7 @@ export async function getNextWorkOrderNumber(
const regex = new RegExp(`^${currentYearString}-\\d+$`)
database.function(
// eslint-disable-next-line no-secrets/no-secrets
'userFn_matchesWorkOrderNumberSyntax',
(workOrderNumber: string) => {
return regex.test(workOrderNumber) ? 1 : 0
@ -25,6 +26,7 @@ export async function getNextWorkOrderNumber(
const workOrderNumberRecord = database
.prepare(
// eslint-disable-next-line no-secrets/no-secrets
`select workOrderNumber from WorkOrders
where userFn_matchesWorkOrderNumberSyntax(workOrderNumber) = 1
order by cast(substr(workOrderNumber, instr(workOrderNumber, '-') + 1) as integer) desc`
@ -50,5 +52,3 @@ export async function getNextWorkOrderNumber(
return `${currentYearString}-${workOrderNumberIndex.toString().padStart(paddingLength, '0')}`
}
export default getNextWorkOrderNumber

View File

@ -1,4 +1,3 @@
import type { PoolConnection } from 'better-sqlite-pool';
import type { OccupancyTypeField } from '../types/recordTypes.js';
export declare function getOccupancyTypeFields(occupancyTypeId?: number, connectedDatabase?: PoolConnection): Promise<OccupancyTypeField[]>;
export default getOccupancyTypeFields;
export default function getOccupancyTypeFields(occupancyTypeId?: number, connectedDatabase?: PoolConnection): Promise<OccupancyTypeField[]>;

View File

@ -1,22 +1,20 @@
import { acquireConnection } from './pool.js';
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
export async function getOccupancyTypeFields(occupancyTypeId, connectedDatabase) {
export default async function getOccupancyTypeFields(occupancyTypeId, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
const sqlParameters = [];
if ((occupancyTypeId ?? -1) !== -1) {
sqlParameters.push(occupancyTypeId);
}
const occupancyTypeFields = database
.prepare('select occupancyTypeFieldId,' +
' occupancyTypeField, occupancyTypeFieldValues, isRequired, pattern,' +
' minimumLength, maximumLength,' +
' orderNumber' +
' from OccupancyTypeFields' +
' where recordDelete_timeMillis is null' +
((occupancyTypeId ?? -1) === -1
.prepare(`select occupancyTypeFieldId, occupancyTypeField,
occupancyTypeFieldValues, isRequired, pattern, minimumLength, maximumLength, orderNumber
from OccupancyTypeFields
where recordDelete_timeMillis is null
${(occupancyTypeId ?? -1) === -1
? ' and occupancyTypeId is null'
: ' and occupancyTypeId = ?') +
' order by orderNumber, occupancyTypeField')
: ' and occupancyTypeId = ?'}
order by orderNumber, occupancyTypeField`)
.all(sqlParameters);
let expectedOrderNumber = 0;
for (const occupancyTypeField of occupancyTypeFields) {
@ -31,4 +29,3 @@ export async function getOccupancyTypeFields(occupancyTypeId, connectedDatabase)
}
return occupancyTypeFields;
}
export default getOccupancyTypeFields;

View File

@ -5,7 +5,7 @@ import type { OccupancyTypeField } from '../types/recordTypes.js'
import { acquireConnection } from './pool.js'
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
export async function getOccupancyTypeFields(
export default async function getOccupancyTypeFields(
occupancyTypeId?: number,
connectedDatabase?: PoolConnection
): Promise<OccupancyTypeField[]> {
@ -19,16 +19,16 @@ export async function getOccupancyTypeFields(
const occupancyTypeFields = database
.prepare(
'select occupancyTypeFieldId,' +
' occupancyTypeField, occupancyTypeFieldValues, isRequired, pattern,' +
' minimumLength, maximumLength,' +
' orderNumber' +
' from OccupancyTypeFields' +
' where recordDelete_timeMillis is null' +
((occupancyTypeId ?? -1) === -1
`select occupancyTypeFieldId, occupancyTypeField,
occupancyTypeFieldValues, isRequired, pattern, minimumLength, maximumLength, orderNumber
from OccupancyTypeFields
where recordDelete_timeMillis is null
${
(occupancyTypeId ?? -1) === -1
? ' and occupancyTypeId is null'
: ' and occupancyTypeId = ?') +
' order by orderNumber, occupancyTypeField'
: ' and occupancyTypeId = ?'
}
order by orderNumber, occupancyTypeField`
)
.all(sqlParameters) as OccupancyTypeField[]
@ -55,5 +55,3 @@ export async function getOccupancyTypeFields(
return occupancyTypeFields
}
export default getOccupancyTypeFields

View File

@ -1,3 +1,2 @@
import type { PoolConnection } from 'better-sqlite-pool';
export declare function getOccupancyTypePrints(occupancyTypeId: number, connectedDatabase?: PoolConnection): Promise<string[]>;
export default getOccupancyTypePrints;
export default function getOccupancyTypePrints(occupancyTypeId: number, connectedDatabase?: PoolConnection): Promise<string[]>;

View File

@ -7,7 +7,7 @@ const userFunction_configContainsPrintEJS = (printEJS) => {
}
return 0;
};
export async function getOccupancyTypePrints(occupancyTypeId, connectedDatabase) {
export default async function getOccupancyTypePrints(occupancyTypeId, connectedDatabase) {
const database = connectedDatabase ?? (await acquireConnection());
database.function('userFn_configContainsPrintEJS', userFunction_configContainsPrintEJS);
const results = database
@ -37,4 +37,3 @@ export async function getOccupancyTypePrints(occupancyTypeId, connectedDatabase)
}
return prints;
}
export default getOccupancyTypePrints;

View File

@ -15,13 +15,14 @@ const userFunction_configContainsPrintEJS = (printEJS: string): number => {
return 0
}
export async function getOccupancyTypePrints(
export default async function getOccupancyTypePrints(
occupancyTypeId: number,
connectedDatabase?: PoolConnection
): Promise<string[]> {
const database = connectedDatabase ?? (await acquireConnection())
database.function(
// eslint-disable-next-line no-secrets/no-secrets
'userFn_configContainsPrintEJS',
userFunction_configContainsPrintEJS
)
@ -64,5 +65,3 @@ export async function getOccupancyTypePrints(
return prints
}
export default getOccupancyTypePrints

View File

@ -1,3 +1,2 @@
import type { OccupancyType } from '../types/recordTypes.js';
export declare function getOccupancyTypes(): Promise<OccupancyType[]>;
export default getOccupancyTypes;
export default function getOccupancyTypes(): Promise<OccupancyType[]>;

View File

@ -1,8 +1,8 @@
import { getOccupancyTypeFields } from './getOccupancyTypeFields.js';
import { getOccupancyTypePrints } from './getOccupancyTypePrints.js';
import getOccupancyTypeFields from './getOccupancyTypeFields.js';
import getOccupancyTypePrints from './getOccupancyTypePrints.js';
import { acquireConnection } from './pool.js';
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
export async function getOccupancyTypes() {
export default async function getOccupancyTypes() {
const database = await acquireConnection();
const occupancyTypes = database
.prepare(`select occupancyTypeId, occupancyType, orderNumber
@ -23,4 +23,3 @@ export async function getOccupancyTypes() {
database.release();
return occupancyTypes;
}
export default getOccupancyTypes;

View File

@ -1,11 +1,11 @@
import type { OccupancyType } from '../types/recordTypes.js'
import { getOccupancyTypeFields } from './getOccupancyTypeFields.js'
import { getOccupancyTypePrints } from './getOccupancyTypePrints.js'
import getOccupancyTypeFields from './getOccupancyTypeFields.js'
import getOccupancyTypePrints from './getOccupancyTypePrints.js'
import { acquireConnection } from './pool.js'
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
export async function getOccupancyTypes(): Promise<OccupancyType[]> {
export default async function getOccupancyTypes(): Promise<OccupancyType[]> {
const database = await acquireConnection()
const occupancyTypes = database
@ -49,4 +49,3 @@ export async function getOccupancyTypes(): Promise<OccupancyType[]> {
return occupancyTypes
}
export default getOccupancyTypes

View File

@ -5,5 +5,5 @@ interface GetPastLotOccupancyOccupantsFilters {
interface GetPastLotOccupancyOccupantsOptions {
limit: number;
}
export declare function getPastLotOccupancyOccupants(filters: GetPastLotOccupancyOccupantsFilters, options: GetPastLotOccupancyOccupantsOptions): Promise<LotOccupancyOccupant[]>;
export default getPastLotOccupancyOccupants;
export default function getPastLotOccupancyOccupants(filters: GetPastLotOccupancyOccupantsFilters, options: GetPastLotOccupancyOccupantsOptions): Promise<LotOccupancyOccupant[]>;
export {};

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
export async function getPastLotOccupancyOccupants(filters, options) {
export default async function getPastLotOccupancyOccupants(filters, options) {
const database = await acquireConnection();
let sqlWhereClause = ' where o.recordDelete_timeMillis is null and l.recordDelete_timeMillis is null';
const sqlParameters = [];
@ -38,4 +38,3 @@ export async function getPastLotOccupancyOccupants(filters, options) {
database.release();
return lotOccupancyOccupants;
}
export default getPastLotOccupancyOccupants;

View File

@ -10,7 +10,7 @@ interface GetPastLotOccupancyOccupantsOptions {
limit: number
}
export async function getPastLotOccupancyOccupants(
export default async function getPastLotOccupancyOccupants(
filters: GetPastLotOccupancyOccupantsFilters,
options: GetPastLotOccupancyOccupantsOptions
): Promise<LotOccupancyOccupant[]> {
@ -69,5 +69,3 @@ export async function getPastLotOccupancyOccupants(
return lotOccupancyOccupants
}
export default getPastLotOccupancyOccupants

View File

@ -1,2 +1 @@
export declare function getPreviousLotId(lotId: number | string): Promise<number | undefined>;
export default getPreviousLotId;
export default function getPreviousLotId(lotId: number | string): Promise<number | undefined>;

View File

@ -1,6 +1,6 @@
import { getConfigProperty } from '../helpers/functions.config.js';
import { acquireConnection } from './pool.js';
export async function getPreviousLotId(lotId) {
export default async function getPreviousLotId(lotId) {
const database = await acquireConnection();
database.function('userFn_lotNameSortName', getConfigProperty('settings.lot.lotNameSortNameFunction'));
const result = database
@ -16,4 +16,3 @@ export async function getPreviousLotId(lotId) {
}
return result.lotId;
}
export default getPreviousLotId;

View File

@ -2,7 +2,7 @@ import { getConfigProperty } from '../helpers/functions.config.js'
import { acquireConnection } from './pool.js'
export async function getPreviousLotId(
export default async function getPreviousLotId(
lotId: number | string
): Promise<number | undefined> {
const database = await acquireConnection()
@ -32,5 +32,3 @@ export async function getPreviousLotId(
return result.lotId
}
export default getPreviousLotId

View File

@ -1,2 +1 @@
export declare function getPreviousMapId(mapId: number | string): Promise<number | undefined>;
export default getPreviousMapId;
export default function getPreviousMapId(mapId: number | string): Promise<number | undefined>;

View File

@ -1,5 +1,5 @@
import { acquireConnection } from './pool.js';
export async function getPreviousMapId(mapId) {
export default async function getPreviousMapId(mapId) {
const database = await acquireConnection();
const result = database
.prepare(`select mapId from Maps
@ -14,4 +14,3 @@ export async function getPreviousMapId(mapId) {
}
return result.mapId;
}
export default getPreviousMapId;

View File

@ -1,6 +1,6 @@
import { acquireConnection } from './pool.js'
export async function getPreviousMapId(
export default async function getPreviousMapId(
mapId: number | string
): Promise<number | undefined> {
const database = await acquireConnection()
@ -25,5 +25,3 @@ export async function getPreviousMapId(
return result.mapId
}
export default getPreviousMapId

View File

@ -1,3 +1,2 @@
export type ReportParameters = Record<string, string | number>;
export declare function getReportData(reportName: string, reportParameters?: ReportParameters): Promise<unknown[] | undefined>;
export default getReportData;
export default function getReportData(reportName: string, reportParameters?: ReportParameters): Promise<unknown[] | undefined>;

Some files were not shown because too many files have changed in this diff Show More