refactoring
parent
15e6fc3d66
commit
b63d6225e1
|
|
@ -1,6 +1,6 @@
|
||||||
import { calculateFeeAmount, calculateTaxAmount } from '../helpers/functions.fee.js';
|
import { calculateFeeAmount, calculateTaxAmount } from '../helpers/functions.fee.js';
|
||||||
import { getFee } from './getFee.js';
|
import getFee from './getFee.js';
|
||||||
import { getLotOccupancy } from './getLotOccupancy.js';
|
import getLotOccupancy from './getLotOccupancy.js';
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export default async function addLotOccupancyFee(lotOccupancyFeeForm, user) {
|
export default async function addLotOccupancyFee(lotOccupancyFeeForm, user) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import {
|
||||||
} from '../helpers/functions.fee.js'
|
} from '../helpers/functions.fee.js'
|
||||||
import type { Fee, LotOccupancy } from '../types/recordTypes.js'
|
import type { Fee, LotOccupancy } from '../types/recordTypes.js'
|
||||||
|
|
||||||
import { getFee } from './getFee.js'
|
import getFee from './getFee.js'
|
||||||
import { getLotOccupancy } from './getLotOccupancy.js'
|
import getLotOccupancy from './getLotOccupancy.js'
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export interface AddLotOccupancyFeeForm {
|
export interface AddLotOccupancyFeeForm {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { dateStringToInteger, dateToInteger } from '@cityssm/utils-datetime';
|
import { dateStringToInteger, dateToInteger } from '@cityssm/utils-datetime';
|
||||||
import addWorkOrderLotOccupancy from './addWorkOrderLotOccupancy.js';
|
import addWorkOrderLotOccupancy from './addWorkOrderLotOccupancy.js';
|
||||||
import { getNextWorkOrderNumber } from './getNextWorkOrderNumber.js';
|
import getNextWorkOrderNumber from './getNextWorkOrderNumber.js';
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export default async function addWorkOrder(workOrderForm, user) {
|
export default async function addWorkOrder(workOrderForm, user) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
|
|
|
||||||
|
|
@ -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 addWorkOrderLotOccupancy from './addWorkOrderLotOccupancy.js'
|
||||||
import { getNextWorkOrderNumber } from './getNextWorkOrderNumber.js'
|
import getNextWorkOrderNumber from './getNextWorkOrderNumber.js'
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export interface AddWorkOrderForm {
|
export interface AddWorkOrderForm {
|
||||||
|
|
@ -42,10 +46,14 @@ export default async function addWorkOrder(
|
||||||
workOrderForm.workOrderDescription,
|
workOrderForm.workOrderDescription,
|
||||||
(workOrderForm.workOrderOpenDateString ?? '') === ''
|
(workOrderForm.workOrderOpenDateString ?? '') === ''
|
||||||
? dateToInteger(rightNow)
|
? dateToInteger(rightNow)
|
||||||
: dateStringToInteger(workOrderForm.workOrderOpenDateString!),
|
: dateStringToInteger(
|
||||||
|
workOrderForm.workOrderOpenDateString as DateString
|
||||||
|
),
|
||||||
(workOrderForm.workOrderCloseDateString ?? '') === ''
|
(workOrderForm.workOrderCloseDateString ?? '') === ''
|
||||||
? undefined
|
? undefined
|
||||||
: dateStringToInteger(workOrderForm.workOrderCloseDateString!),
|
: dateStringToInteger(
|
||||||
|
workOrderForm.workOrderCloseDateString as DateString
|
||||||
|
),
|
||||||
user.userName,
|
user.userName,
|
||||||
rightNow.getTime(),
|
rightNow.getTime(),
|
||||||
user.userName,
|
user.userName,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { dateToString } from '@cityssm/utils-datetime';
|
import { dateToString } from '@cityssm/utils-datetime';
|
||||||
import addLotOccupancy from './addLotOccupancy.js';
|
import addLotOccupancy from './addLotOccupancy.js';
|
||||||
import addLotOccupancyOccupant from './addLotOccupancyOccupant.js';
|
import addLotOccupancyOccupant from './addLotOccupancyOccupant.js';
|
||||||
import { getLotOccupancy } from './getLotOccupancy.js';
|
import getLotOccupancy from './getLotOccupancy.js';
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export default async function copyLotOccupancy(oldLotOccupancyId, user) {
|
export default async function copyLotOccupancy(oldLotOccupancyId, user) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { dateToString } from '@cityssm/utils-datetime'
|
||||||
|
|
||||||
import addLotOccupancy from './addLotOccupancy.js'
|
import addLotOccupancy from './addLotOccupancy.js'
|
||||||
import addLotOccupancyOccupant from './addLotOccupancyOccupant.js'
|
import addLotOccupancyOccupant from './addLotOccupancyOccupant.js'
|
||||||
import { getLotOccupancy } from './getLotOccupancy.js'
|
import getLotOccupancy from './getLotOccupancy.js'
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export default async function copyLotOccupancy(
|
export default async function copyLotOccupancy(
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import type { PoolConnection } from 'better-sqlite-pool';
|
import type { PoolConnection } from 'better-sqlite-pool';
|
||||||
import type { Fee } from '../types/recordTypes.js';
|
import type { Fee } from '../types/recordTypes.js';
|
||||||
export declare function getFee(feeId: number | string, connectedDatabase?: PoolConnection): Promise<Fee | undefined>;
|
export default function getFee(feeId: number | string, connectedDatabase?: PoolConnection): Promise<Fee | undefined>;
|
||||||
export default getFee;
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getFee(feeId, connectedDatabase) {
|
export default async function getFee(feeId, connectedDatabase) {
|
||||||
const database = connectedDatabase ?? (await acquireConnection());
|
const database = connectedDatabase ?? (await acquireConnection());
|
||||||
const fee = database
|
const fee = database
|
||||||
.prepare(`select f.feeId,
|
.prepare(`select f.feeId,
|
||||||
|
|
@ -23,4 +23,3 @@ export async function getFee(feeId, connectedDatabase) {
|
||||||
}
|
}
|
||||||
return fee;
|
return fee;
|
||||||
}
|
}
|
||||||
export default getFee;
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import type { Fee } from '../types/recordTypes.js'
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export async function getFee(
|
export default async function getFee(
|
||||||
feeId: number | string,
|
feeId: number | string,
|
||||||
connectedDatabase?: PoolConnection
|
connectedDatabase?: PoolConnection
|
||||||
): Promise<Fee | undefined> {
|
): Promise<Fee | undefined> {
|
||||||
|
|
@ -36,5 +36,3 @@ export async function getFee(
|
||||||
|
|
||||||
return fee
|
return fee
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getFee
|
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,5 @@ interface GetFeeCategoriesFilters {
|
||||||
interface GetFeeCategoriesOptions {
|
interface GetFeeCategoriesOptions {
|
||||||
includeFees?: boolean;
|
includeFees?: boolean;
|
||||||
}
|
}
|
||||||
export declare function getFeeCategories(filters: GetFeeCategoriesFilters, options: GetFeeCategoriesOptions): Promise<FeeCategory[]>;
|
export default function getFeeCategories(filters: GetFeeCategoriesFilters, options: GetFeeCategoriesOptions): Promise<FeeCategory[]>;
|
||||||
export default getFeeCategories;
|
export {};
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,26 @@
|
||||||
import { getFees } from './getFees.js';
|
import getFees from './getFees.js';
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.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 updateOrderNumbers = !(filters.lotTypeId || filters.occupancyTypeId) && options.includeFees;
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
let sqlWhereClause = ' where recordDelete_timeMillis is null';
|
let sqlWhereClause = ' where recordDelete_timeMillis is null';
|
||||||
const sqlParameters = [];
|
const sqlParameters = [];
|
||||||
if ((filters.occupancyTypeId ?? '') !== '') {
|
if ((filters.occupancyTypeId ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause += ` and feeCategoryId in (
|
||||||
' and feeCategoryId in (' +
|
select feeCategoryId from Fees where recordDelete_timeMillis is null and (occupancyTypeId is null or occupancyTypeId = ?))`;
|
||||||
'select feeCategoryId from Fees' +
|
|
||||||
' where recordDelete_timeMillis is null' +
|
|
||||||
' and (occupancyTypeId is null or occupancyTypeId = ?))';
|
|
||||||
sqlParameters.push(filters.occupancyTypeId);
|
sqlParameters.push(filters.occupancyTypeId);
|
||||||
}
|
}
|
||||||
if ((filters.lotTypeId ?? '') !== '') {
|
if ((filters.lotTypeId ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause += ` and feeCategoryId in (
|
||||||
' and feeCategoryId in (' +
|
select feeCategoryId from Fees where recordDelete_timeMillis is null and (lotTypeId is null or lotTypeId = ?))`;
|
||||||
'select feeCategoryId from Fees' +
|
|
||||||
' where recordDelete_timeMillis is null' +
|
|
||||||
' and (lotTypeId is null or lotTypeId = ?))';
|
|
||||||
sqlParameters.push(filters.lotTypeId);
|
sqlParameters.push(filters.lotTypeId);
|
||||||
}
|
}
|
||||||
const feeCategories = database
|
const feeCategories = database
|
||||||
.prepare('select feeCategoryId, feeCategory, orderNumber' +
|
.prepare(`select feeCategoryId, feeCategory, orderNumber
|
||||||
' from FeeCategories' +
|
from FeeCategories
|
||||||
sqlWhereClause +
|
${sqlWhereClause}
|
||||||
' order by orderNumber, feeCategory')
|
order by orderNumber, feeCategory`)
|
||||||
.all(sqlParameters);
|
.all(sqlParameters);
|
||||||
if (options.includeFees ?? false) {
|
if (options.includeFees ?? false) {
|
||||||
let expectedOrderNumber = 0;
|
let expectedOrderNumber = 0;
|
||||||
|
|
@ -43,4 +37,3 @@ export async function getFeeCategories(filters, options) {
|
||||||
database.release();
|
database.release();
|
||||||
return feeCategories;
|
return feeCategories;
|
||||||
}
|
}
|
||||||
export default getFeeCategories;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import type { FeeCategory } from '../types/recordTypes.js'
|
import type { FeeCategory } from '../types/recordTypes.js'
|
||||||
|
|
||||||
import { getFees } from './getFees.js'
|
import getFees from './getFees.js'
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
||||||
|
|
||||||
|
|
@ -13,7 +13,7 @@ interface GetFeeCategoriesOptions {
|
||||||
includeFees?: boolean
|
includeFees?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getFeeCategories(
|
export default async function getFeeCategories(
|
||||||
filters: GetFeeCategoriesFilters,
|
filters: GetFeeCategoriesFilters,
|
||||||
options: GetFeeCategoriesOptions
|
options: GetFeeCategoriesOptions
|
||||||
): Promise<FeeCategory[]> {
|
): Promise<FeeCategory[]> {
|
||||||
|
|
@ -27,31 +27,25 @@ export async function getFeeCategories(
|
||||||
const sqlParameters: unknown[] = []
|
const sqlParameters: unknown[] = []
|
||||||
|
|
||||||
if ((filters.occupancyTypeId ?? '') !== '') {
|
if ((filters.occupancyTypeId ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause += ` and feeCategoryId in (
|
||||||
' and feeCategoryId in (' +
|
select feeCategoryId from Fees where recordDelete_timeMillis is null and (occupancyTypeId is null or occupancyTypeId = ?))`
|
||||||
'select feeCategoryId from Fees' +
|
|
||||||
' where recordDelete_timeMillis is null' +
|
|
||||||
' and (occupancyTypeId is null or occupancyTypeId = ?))'
|
|
||||||
|
|
||||||
sqlParameters.push(filters.occupancyTypeId)
|
sqlParameters.push(filters.occupancyTypeId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((filters.lotTypeId ?? '') !== '') {
|
if ((filters.lotTypeId ?? '') !== '') {
|
||||||
sqlWhereClause +=
|
sqlWhereClause += ` and feeCategoryId in (
|
||||||
' and feeCategoryId in (' +
|
select feeCategoryId from Fees where recordDelete_timeMillis is null and (lotTypeId is null or lotTypeId = ?))`
|
||||||
'select feeCategoryId from Fees' +
|
|
||||||
' where recordDelete_timeMillis is null' +
|
|
||||||
' and (lotTypeId is null or lotTypeId = ?))'
|
|
||||||
|
|
||||||
sqlParameters.push(filters.lotTypeId)
|
sqlParameters.push(filters.lotTypeId)
|
||||||
}
|
}
|
||||||
|
|
||||||
const feeCategories = database
|
const feeCategories = database
|
||||||
.prepare(
|
.prepare(
|
||||||
'select feeCategoryId, feeCategory, orderNumber' +
|
`select feeCategoryId, feeCategory, orderNumber
|
||||||
' from FeeCategories' +
|
from FeeCategories
|
||||||
sqlWhereClause +
|
${sqlWhereClause}
|
||||||
' order by orderNumber, feeCategory'
|
order by orderNumber, feeCategory`
|
||||||
)
|
)
|
||||||
.all(sqlParameters) as FeeCategory[]
|
.all(sqlParameters) as FeeCategory[]
|
||||||
|
|
||||||
|
|
@ -87,5 +81,3 @@ export async function getFeeCategories(
|
||||||
|
|
||||||
return feeCategories
|
return feeCategories
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getFeeCategories
|
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,5 @@ interface GetFeesFilters {
|
||||||
occupancyTypeId?: number | string;
|
occupancyTypeId?: number | string;
|
||||||
lotTypeId?: number | string;
|
lotTypeId?: number | string;
|
||||||
}
|
}
|
||||||
export declare function getFees(feeCategoryId: number, additionalFilters: GetFeesFilters, connectedDatabase?: PoolConnection): Promise<Fee[]>;
|
export default function getFees(feeCategoryId: number, additionalFilters: GetFeesFilters, connectedDatabase?: PoolConnection): Promise<Fee[]>;
|
||||||
export default getFees;
|
export {};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.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 updateOrderNumbers = !(additionalFilters.lotTypeId || additionalFilters.occupancyTypeId);
|
||||||
const database = connectedDatabase ?? (await acquireConnection());
|
const database = connectedDatabase ?? (await acquireConnection());
|
||||||
let sqlWhereClause = ' where f.recordDelete_timeMillis is null and f.feeCategoryId = ?';
|
let sqlWhereClause = ' where f.recordDelete_timeMillis is null and f.feeCategoryId = ?';
|
||||||
|
|
@ -52,4 +52,3 @@ export async function getFees(feeCategoryId, additionalFilters, connectedDatabas
|
||||||
}
|
}
|
||||||
return fees;
|
return fees;
|
||||||
}
|
}
|
||||||
export default getFees;
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ interface GetFeesFilters {
|
||||||
lotTypeId?: number | string
|
lotTypeId?: number | string
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getFees(
|
export default async function getFees(
|
||||||
feeCategoryId: number,
|
feeCategoryId: number,
|
||||||
additionalFilters: GetFeesFilters,
|
additionalFilters: GetFeesFilters,
|
||||||
connectedDatabase?: PoolConnection
|
connectedDatabase?: PoolConnection
|
||||||
|
|
@ -89,5 +89,3 @@ export async function getFees(
|
||||||
|
|
||||||
return fees
|
return fees
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getFees
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import type { Lot } from '../types/recordTypes.js';
|
import type { Lot } from '../types/recordTypes.js';
|
||||||
export declare function getLotByLotName(lotName: string): Promise<Lot | undefined>;
|
export declare function getLotByLotName(lotName: string): Promise<Lot | undefined>;
|
||||||
export declare function getLot(lotId: number | string): Promise<Lot | undefined>;
|
export default function getLot(lotId: number | string): Promise<Lot | undefined>;
|
||||||
export default getLot;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { getLotComments } from './getLotComments.js';
|
import getLotComments from './getLotComments.js';
|
||||||
import { getLotFields } from './getLotFields.js';
|
import getLotFields from './getLotFields.js';
|
||||||
import { getLotOccupancies } from './getLotOccupancies.js';
|
import getLotOccupancies from './getLotOccupancies.js';
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
const baseSQL = `select l.lotId, l.lotTypeId, t.lotType, l.lotName, l.lotStatusId, s.lotStatus,
|
const baseSQL = `select l.lotId, l.lotTypeId, t.lotType, l.lotName, l.lotStatusId, s.lotStatus,
|
||||||
l.mapId, m.mapName, m.mapSVG, l.mapKey,
|
l.mapId, m.mapName, m.mapSVG, l.mapKey,
|
||||||
|
|
@ -31,9 +31,8 @@ async function _getLot(sql, lotIdOrLotName) {
|
||||||
return lot;
|
return lot;
|
||||||
}
|
}
|
||||||
export async function getLotByLotName(lotName) {
|
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) {
|
export default async function getLot(lotId) {
|
||||||
return await _getLot(baseSQL + ' and l.lotId = ?', lotId);
|
return await _getLot(`${baseSQL} and l.lotId = ?`, lotId);
|
||||||
}
|
}
|
||||||
export default getLot;
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import type { Lot } from '../types/recordTypes.js'
|
import type { Lot } from '../types/recordTypes.js'
|
||||||
|
|
||||||
import { getLotComments } from './getLotComments.js'
|
import getLotComments from './getLotComments.js'
|
||||||
import { getLotFields } from './getLotFields.js'
|
import getLotFields from './getLotFields.js'
|
||||||
import { getLotOccupancies } from './getLotOccupancies.js'
|
import getLotOccupancies from './getLotOccupancies.js'
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
const baseSQL = `select l.lotId, l.lotTypeId, t.lotType, l.lotName, l.lotStatusId, s.lotStatus,
|
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(
|
export async function getLotByLotName(
|
||||||
lotName: string
|
lotName: string
|
||||||
): Promise<Lot | undefined> {
|
): 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> {
|
export default async function getLot(
|
||||||
return await _getLot(baseSQL + ' and l.lotId = ?', lotId)
|
lotId: number | string
|
||||||
|
): Promise<Lot | undefined> {
|
||||||
|
return await _getLot(`${baseSQL} and l.lotId = ?`, lotId)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getLot
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import type { PoolConnection } from 'better-sqlite-pool';
|
import type { PoolConnection } from 'better-sqlite-pool';
|
||||||
import type { LotComment } from '../types/recordTypes.js';
|
import type { LotComment } from '../types/recordTypes.js';
|
||||||
export declare function getLotComments(lotId: number | string, connectedDatabase?: PoolConnection): Promise<LotComment[]>;
|
export default function getLotComments(lotId: number | string, connectedDatabase?: PoolConnection): Promise<LotComment[]>;
|
||||||
export default getLotComments;
|
|
||||||
|
|
|
||||||
|
|
@ -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';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getLotComments(lotId, connectedDatabase) {
|
export default async function getLotComments(lotId, connectedDatabase) {
|
||||||
const database = connectedDatabase ?? (await acquireConnection());
|
const database = connectedDatabase ?? (await acquireConnection());
|
||||||
database.function('userFn_dateIntegerToString', dateIntegerToString);
|
database.function('userFn_dateIntegerToString', dateIntegerToString);
|
||||||
database.function('userFn_timeIntegerToString', timeIntegerToString);
|
database.function('userFn_timeIntegerToString', timeIntegerToString);
|
||||||
|
|
@ -23,4 +23,3 @@ export async function getLotComments(lotId, connectedDatabase) {
|
||||||
}
|
}
|
||||||
return lotComments;
|
return lotComments;
|
||||||
}
|
}
|
||||||
export default getLotComments;
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {
|
import {
|
||||||
dateIntegerToString,
|
dateIntegerToString,
|
||||||
timeIntegerToString,
|
timeIntegerToPeriodString,
|
||||||
timeIntegerToPeriodString
|
timeIntegerToString
|
||||||
} from '@cityssm/utils-datetime'
|
} from '@cityssm/utils-datetime'
|
||||||
import type { PoolConnection } from 'better-sqlite-pool'
|
import type { PoolConnection } from 'better-sqlite-pool'
|
||||||
|
|
||||||
|
|
@ -9,7 +9,7 @@ import type { LotComment } from '../types/recordTypes.js'
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export async function getLotComments(
|
export default async function getLotComments(
|
||||||
lotId: number | string,
|
lotId: number | string,
|
||||||
connectedDatabase?: PoolConnection
|
connectedDatabase?: PoolConnection
|
||||||
): Promise<LotComment[]> {
|
): Promise<LotComment[]> {
|
||||||
|
|
@ -44,5 +44,3 @@ export async function getLotComments(
|
||||||
|
|
||||||
return lotComments
|
return lotComments
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getLotComments
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import type { PoolConnection } from 'better-sqlite-pool';
|
import type { PoolConnection } from 'better-sqlite-pool';
|
||||||
import type { LotField } from '../types/recordTypes.js';
|
import type { LotField } from '../types/recordTypes.js';
|
||||||
export declare function getLotFields(lotId: number | string, connectedDatabase?: PoolConnection): Promise<LotField[]>;
|
export default function getLotFields(lotId: number | string, connectedDatabase?: PoolConnection): Promise<LotField[]>;
|
||||||
export default getLotFields;
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getLotFields(lotId, connectedDatabase) {
|
export default async function getLotFields(lotId, connectedDatabase) {
|
||||||
const database = connectedDatabase ?? (await acquireConnection());
|
const database = connectedDatabase ?? (await acquireConnection());
|
||||||
const lotFields = database
|
const lotFields = database
|
||||||
.prepare(`select l.lotId, l.lotTypeFieldId,
|
.prepare(`select l.lotId, l.lotTypeFieldId,
|
||||||
|
|
@ -34,4 +34,3 @@ export async function getLotFields(lotId, connectedDatabase) {
|
||||||
}
|
}
|
||||||
return lotFields;
|
return lotFields;
|
||||||
}
|
}
|
||||||
export default getLotFields;
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import type { LotField } from '../types/recordTypes.js'
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export async function getLotFields(
|
export default async function getLotFields(
|
||||||
lotId: number | string,
|
lotId: number | string,
|
||||||
connectedDatabase?: PoolConnection
|
connectedDatabase?: PoolConnection
|
||||||
): Promise<LotField[]> {
|
): Promise<LotField[]> {
|
||||||
|
|
@ -47,5 +47,3 @@ export async function getLotFields(
|
||||||
|
|
||||||
return lotFields
|
return lotFields
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getLotFields
|
|
||||||
|
|
|
||||||
|
|
@ -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 { PoolConnection } from 'better-sqlite-pool';
|
||||||
import type { LotOccupancy } from '../types/recordTypes.js';
|
import type { LotOccupancy } from '../types/recordTypes.js';
|
||||||
interface GetLotOccupanciesFilters {
|
interface GetLotOccupanciesFilters {
|
||||||
|
|
@ -22,8 +22,8 @@ interface GetLotOccupanciesOptions {
|
||||||
includeFees: boolean;
|
includeFees: boolean;
|
||||||
includeTransactions: 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;
|
count: number;
|
||||||
lotOccupancies: LotOccupancy[];
|
lotOccupancies: LotOccupancy[];
|
||||||
}>;
|
}>;
|
||||||
export default getLotOccupancies;
|
export {};
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ import { dateIntegerToString, dateStringToInteger } from '@cityssm/utils-datetim
|
||||||
import { getOccupancyTypeById } from '../helpers/functions.cache.js';
|
import { getOccupancyTypeById } from '../helpers/functions.cache.js';
|
||||||
import { getConfigProperty } from '../helpers/functions.config.js';
|
import { getConfigProperty } from '../helpers/functions.config.js';
|
||||||
import { getLotNameWhereClause, getOccupancyTimeWhereClause, getOccupantNameWhereClause } from '../helpers/functions.sqlFilters.js';
|
import { getLotNameWhereClause, getOccupancyTimeWhereClause, getOccupantNameWhereClause } from '../helpers/functions.sqlFilters.js';
|
||||||
import { getLotOccupancyFees } from './getLotOccupancyFees.js';
|
import getLotOccupancyFees from './getLotOccupancyFees.js';
|
||||||
import { getLotOccupancyOccupants } from './getLotOccupancyOccupants.js';
|
import getLotOccupancyOccupants from './getLotOccupancyOccupants.js';
|
||||||
import { getLotOccupancyTransactions } from './getLotOccupancyTransactions.js';
|
import getLotOccupancyTransactions from './getLotOccupancyTransactions.js';
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
function buildWhereClause(filters) {
|
function buildWhereClause(filters) {
|
||||||
let sqlWhereClause = ' where o.recordDelete_timeMillis is null';
|
let sqlWhereClause = ' where o.recordDelete_timeMillis is null';
|
||||||
|
|
@ -77,7 +77,7 @@ async function addInclusions(lotOccupancy, options, database) {
|
||||||
}
|
}
|
||||||
return lotOccupancy;
|
return lotOccupancy;
|
||||||
}
|
}
|
||||||
export async function getLotOccupancies(filters, options, connectedDatabase) {
|
export default async function getLotOccupancies(filters, options, connectedDatabase) {
|
||||||
const database = connectedDatabase ?? (await acquireConnection());
|
const database = connectedDatabase ?? (await acquireConnection());
|
||||||
database.function('userFn_dateIntegerToString', dateIntegerToString);
|
database.function('userFn_dateIntegerToString', dateIntegerToString);
|
||||||
const { sqlWhereClause, sqlParameters } = buildWhereClause(filters);
|
const { sqlWhereClause, sqlParameters } = buildWhereClause(filters);
|
||||||
|
|
@ -130,4 +130,3 @@ export async function getLotOccupancies(filters, options, connectedDatabase) {
|
||||||
lotOccupancies
|
lotOccupancies
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
export default getLotOccupancies;
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {
|
import {
|
||||||
DateString,
|
type DateString,
|
||||||
dateIntegerToString,
|
dateIntegerToString,
|
||||||
dateStringToInteger
|
dateStringToInteger
|
||||||
} from '@cityssm/utils-datetime'
|
} from '@cityssm/utils-datetime'
|
||||||
|
|
@ -14,9 +14,9 @@ import {
|
||||||
} from '../helpers/functions.sqlFilters.js'
|
} from '../helpers/functions.sqlFilters.js'
|
||||||
import type { LotOccupancy } from '../types/recordTypes.js'
|
import type { LotOccupancy } from '../types/recordTypes.js'
|
||||||
|
|
||||||
import { getLotOccupancyFees } from './getLotOccupancyFees.js'
|
import getLotOccupancyFees from './getLotOccupancyFees.js'
|
||||||
import { getLotOccupancyOccupants } from './getLotOccupancyOccupants.js'
|
import getLotOccupancyOccupants from './getLotOccupancyOccupants.js'
|
||||||
import { getLotOccupancyTransactions } from './getLotOccupancyTransactions.js'
|
import getLotOccupancyTransactions from './getLotOccupancyTransactions.js'
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
interface GetLotOccupanciesFilters {
|
interface GetLotOccupanciesFilters {
|
||||||
|
|
@ -162,7 +162,7 @@ async function addInclusions(
|
||||||
return lotOccupancy
|
return lotOccupancy
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getLotOccupancies(
|
export default async function getLotOccupancies(
|
||||||
filters: GetLotOccupanciesFilters,
|
filters: GetLotOccupanciesFilters,
|
||||||
options: GetLotOccupanciesOptions,
|
options: GetLotOccupanciesOptions,
|
||||||
connectedDatabase?: PoolConnection
|
connectedDatabase?: PoolConnection
|
||||||
|
|
@ -242,5 +242,3 @@ export async function getLotOccupancies(
|
||||||
lotOccupancies
|
lotOccupancies
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getLotOccupancies
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import type { PoolConnection } from 'better-sqlite-pool';
|
import type { PoolConnection } from 'better-sqlite-pool';
|
||||||
import type { LotOccupancy } from '../types/recordTypes.js';
|
import type { LotOccupancy } from '../types/recordTypes.js';
|
||||||
export declare function getLotOccupancy(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancy | undefined>;
|
export default function getLotOccupancy(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancy | undefined>;
|
||||||
export default getLotOccupancy;
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import { dateIntegerToString } from '@cityssm/utils-datetime';
|
import { dateIntegerToString } from '@cityssm/utils-datetime';
|
||||||
import { getLotOccupancyComments } from './getLotOccupancyComments.js';
|
import getLotOccupancyComments from './getLotOccupancyComments.js';
|
||||||
import { getLotOccupancyFees } from './getLotOccupancyFees.js';
|
import getLotOccupancyFees from './getLotOccupancyFees.js';
|
||||||
import { getLotOccupancyFields } from './getLotOccupancyFields.js';
|
import getLotOccupancyFields from './getLotOccupancyFields.js';
|
||||||
import { getLotOccupancyOccupants } from './getLotOccupancyOccupants.js';
|
import getLotOccupancyOccupants from './getLotOccupancyOccupants.js';
|
||||||
import { getLotOccupancyTransactions } from './getLotOccupancyTransactions.js';
|
import getLotOccupancyTransactions from './getLotOccupancyTransactions.js';
|
||||||
import { getWorkOrders } from './getWorkOrders.js';
|
import { getWorkOrders } from './getWorkOrders.js';
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getLotOccupancy(lotOccupancyId, connectedDatabase) {
|
export default async function getLotOccupancy(lotOccupancyId, connectedDatabase) {
|
||||||
const database = connectedDatabase ?? (await acquireConnection());
|
const database = connectedDatabase ?? (await acquireConnection());
|
||||||
database.function('userFn_dateIntegerToString', dateIntegerToString);
|
database.function('userFn_dateIntegerToString', dateIntegerToString);
|
||||||
const lotOccupancy = database
|
const lotOccupancy = database
|
||||||
|
|
@ -43,4 +43,3 @@ export async function getLotOccupancy(lotOccupancyId, connectedDatabase) {
|
||||||
}
|
}
|
||||||
return lotOccupancy;
|
return lotOccupancy;
|
||||||
}
|
}
|
||||||
export default getLotOccupancy;
|
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,15 @@ import type { PoolConnection } from 'better-sqlite-pool'
|
||||||
|
|
||||||
import type { LotOccupancy } from '../types/recordTypes.js'
|
import type { LotOccupancy } from '../types/recordTypes.js'
|
||||||
|
|
||||||
import { getLotOccupancyComments } from './getLotOccupancyComments.js'
|
import getLotOccupancyComments from './getLotOccupancyComments.js'
|
||||||
import { getLotOccupancyFees } from './getLotOccupancyFees.js'
|
import getLotOccupancyFees from './getLotOccupancyFees.js'
|
||||||
import { getLotOccupancyFields } from './getLotOccupancyFields.js'
|
import getLotOccupancyFields from './getLotOccupancyFields.js'
|
||||||
import { getLotOccupancyOccupants } from './getLotOccupancyOccupants.js'
|
import getLotOccupancyOccupants from './getLotOccupancyOccupants.js'
|
||||||
import { getLotOccupancyTransactions } from './getLotOccupancyTransactions.js'
|
import getLotOccupancyTransactions from './getLotOccupancyTransactions.js'
|
||||||
import { getWorkOrders } from './getWorkOrders.js'
|
import { getWorkOrders } from './getWorkOrders.js'
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export async function getLotOccupancy(
|
export default async function getLotOccupancy(
|
||||||
lotOccupancyId: number | string,
|
lotOccupancyId: number | string,
|
||||||
connectedDatabase?: PoolConnection
|
connectedDatabase?: PoolConnection
|
||||||
): Promise<LotOccupancy | undefined> {
|
): Promise<LotOccupancy | undefined> {
|
||||||
|
|
@ -80,5 +80,3 @@ export async function getLotOccupancy(
|
||||||
|
|
||||||
return lotOccupancy
|
return lotOccupancy
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getLotOccupancy
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import type { PoolConnection } from 'better-sqlite-pool';
|
import type { PoolConnection } from 'better-sqlite-pool';
|
||||||
import type { LotOccupancyComment } from '../types/recordTypes.js';
|
import type { LotOccupancyComment } from '../types/recordTypes.js';
|
||||||
export declare function getLotOccupancyComments(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancyComment[]>;
|
export default function getLotOccupancyComments(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancyComment[]>;
|
||||||
export default getLotOccupancyComments;
|
|
||||||
|
|
|
||||||
|
|
@ -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';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getLotOccupancyComments(lotOccupancyId, connectedDatabase) {
|
export default async function getLotOccupancyComments(lotOccupancyId, connectedDatabase) {
|
||||||
const database = connectedDatabase ?? (await acquireConnection());
|
const database = connectedDatabase ?? (await acquireConnection());
|
||||||
database.function('userFn_dateIntegerToString', dateIntegerToString);
|
database.function('userFn_dateIntegerToString', dateIntegerToString);
|
||||||
database.function('userFn_timeIntegerToString', timeIntegerToString);
|
database.function('userFn_timeIntegerToString', timeIntegerToString);
|
||||||
|
|
@ -23,4 +23,3 @@ export async function getLotOccupancyComments(lotOccupancyId, connectedDatabase)
|
||||||
}
|
}
|
||||||
return lotComments;
|
return lotComments;
|
||||||
}
|
}
|
||||||
export default getLotOccupancyComments;
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {
|
import {
|
||||||
dateIntegerToString,
|
dateIntegerToString,
|
||||||
timeIntegerToString,
|
timeIntegerToPeriodString,
|
||||||
timeIntegerToPeriodString
|
timeIntegerToString
|
||||||
} from '@cityssm/utils-datetime'
|
} from '@cityssm/utils-datetime'
|
||||||
import type { PoolConnection } from 'better-sqlite-pool'
|
import type { PoolConnection } from 'better-sqlite-pool'
|
||||||
|
|
||||||
|
|
@ -9,7 +9,7 @@ import type { LotOccupancyComment } from '../types/recordTypes.js'
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export async function getLotOccupancyComments(
|
export default async function getLotOccupancyComments(
|
||||||
lotOccupancyId: number | string,
|
lotOccupancyId: number | string,
|
||||||
connectedDatabase?: PoolConnection
|
connectedDatabase?: PoolConnection
|
||||||
): Promise<LotOccupancyComment[]> {
|
): Promise<LotOccupancyComment[]> {
|
||||||
|
|
@ -24,6 +24,7 @@ export async function getLotOccupancyComments(
|
||||||
|
|
||||||
const lotComments = database
|
const lotComments = database
|
||||||
.prepare(
|
.prepare(
|
||||||
|
// eslint-disable-next-line no-secrets/no-secrets
|
||||||
`select lotOccupancyCommentId,
|
`select lotOccupancyCommentId,
|
||||||
lotOccupancyCommentDate, userFn_dateIntegerToString(lotOccupancyCommentDate) as lotOccupancyCommentDateString,
|
lotOccupancyCommentDate, userFn_dateIntegerToString(lotOccupancyCommentDate) as lotOccupancyCommentDateString,
|
||||||
lotOccupancyCommentTime,
|
lotOccupancyCommentTime,
|
||||||
|
|
@ -44,5 +45,3 @@ export async function getLotOccupancyComments(
|
||||||
|
|
||||||
return lotComments
|
return lotComments
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getLotOccupancyComments
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import type { PoolConnection } from 'better-sqlite-pool';
|
import type { PoolConnection } from 'better-sqlite-pool';
|
||||||
import type { LotOccupancyFee } from '../types/recordTypes.js';
|
import type { LotOccupancyFee } from '../types/recordTypes.js';
|
||||||
export declare function getLotOccupancyFees(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancyFee[]>;
|
export default function getLotOccupancyFees(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancyFee[]>;
|
||||||
export default getLotOccupancyFees;
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getLotOccupancyFees(lotOccupancyId, connectedDatabase) {
|
export default async function getLotOccupancyFees(lotOccupancyId, connectedDatabase) {
|
||||||
const database = connectedDatabase ?? (await acquireConnection());
|
const database = connectedDatabase ?? (await acquireConnection());
|
||||||
const lotOccupancyFees = database
|
const lotOccupancyFees = database
|
||||||
.prepare(`select o.lotOccupancyId, o.feeId,
|
.prepare(`select o.lotOccupancyId, o.feeId,
|
||||||
|
|
@ -17,4 +17,3 @@ export async function getLotOccupancyFees(lotOccupancyId, connectedDatabase) {
|
||||||
}
|
}
|
||||||
return lotOccupancyFees;
|
return lotOccupancyFees;
|
||||||
}
|
}
|
||||||
export default getLotOccupancyFees;
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import type { LotOccupancyFee } from '../types/recordTypes.js'
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export async function getLotOccupancyFees(
|
export default async function getLotOccupancyFees(
|
||||||
lotOccupancyId: number | string,
|
lotOccupancyId: number | string,
|
||||||
connectedDatabase?: PoolConnection
|
connectedDatabase?: PoolConnection
|
||||||
): Promise<LotOccupancyFee[]> {
|
): Promise<LotOccupancyFee[]> {
|
||||||
|
|
@ -30,5 +30,3 @@ export async function getLotOccupancyFees(
|
||||||
|
|
||||||
return lotOccupancyFees
|
return lotOccupancyFees
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getLotOccupancyFees
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import type { PoolConnection } from 'better-sqlite-pool';
|
import type { PoolConnection } from 'better-sqlite-pool';
|
||||||
import type { LotOccupancyField } from '../types/recordTypes.js';
|
import type { LotOccupancyField } from '../types/recordTypes.js';
|
||||||
export declare function getLotOccupancyFields(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancyField[]>;
|
export default function getLotOccupancyFields(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancyField[]>;
|
||||||
export default getLotOccupancyFields;
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getLotOccupancyFields(lotOccupancyId, connectedDatabase) {
|
export default async function getLotOccupancyFields(lotOccupancyId, connectedDatabase) {
|
||||||
const database = connectedDatabase ?? (await acquireConnection());
|
const database = connectedDatabase ?? (await acquireConnection());
|
||||||
const lotOccupancyFields = database
|
const lotOccupancyFields = database
|
||||||
.prepare(`select o.lotOccupancyId, o.occupancyTypeFieldId,
|
.prepare(`select o.lotOccupancyId, o.occupancyTypeFieldId,
|
||||||
|
|
@ -31,4 +31,3 @@ export async function getLotOccupancyFields(lotOccupancyId, connectedDatabase) {
|
||||||
}
|
}
|
||||||
return lotOccupancyFields;
|
return lotOccupancyFields;
|
||||||
}
|
}
|
||||||
export default getLotOccupancyFields;
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import type { LotOccupancyField } from '../types/recordTypes.js'
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export async function getLotOccupancyFields(
|
export default async function getLotOccupancyFields(
|
||||||
lotOccupancyId: number | string,
|
lotOccupancyId: number | string,
|
||||||
connectedDatabase?: PoolConnection
|
connectedDatabase?: PoolConnection
|
||||||
): Promise<LotOccupancyField[]> {
|
): Promise<LotOccupancyField[]> {
|
||||||
|
|
@ -49,5 +49,3 @@ export async function getLotOccupancyFields(
|
||||||
|
|
||||||
return lotOccupancyFields
|
return lotOccupancyFields
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getLotOccupancyFields
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import type { PoolConnection } from 'better-sqlite-pool';
|
import type { PoolConnection } from 'better-sqlite-pool';
|
||||||
import type { LotOccupancyOccupant } from '../types/recordTypes.js';
|
import type { LotOccupancyOccupant } from '../types/recordTypes.js';
|
||||||
export declare function getLotOccupancyOccupants(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancyOccupant[]>;
|
export default function getLotOccupancyOccupants(lotOccupancyId: number | string, connectedDatabase?: PoolConnection): Promise<LotOccupancyOccupant[]>;
|
||||||
export default getLotOccupancyOccupants;
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getLotOccupancyOccupants(lotOccupancyId, connectedDatabase) {
|
export default async function getLotOccupancyOccupants(lotOccupancyId, connectedDatabase) {
|
||||||
const database = connectedDatabase ?? (await acquireConnection());
|
const database = connectedDatabase ?? (await acquireConnection());
|
||||||
const lotOccupancyOccupants = database
|
const lotOccupancyOccupants = database
|
||||||
.prepare(`select o.lotOccupancyId, o.lotOccupantIndex,
|
.prepare(`select o.lotOccupancyId, o.lotOccupantIndex,
|
||||||
|
|
@ -21,4 +21,3 @@ export async function getLotOccupancyOccupants(lotOccupancyId, connectedDatabase
|
||||||
}
|
}
|
||||||
return lotOccupancyOccupants;
|
return lotOccupancyOccupants;
|
||||||
}
|
}
|
||||||
export default getLotOccupancyOccupants;
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import type { LotOccupancyOccupant } from '../types/recordTypes.js'
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export async function getLotOccupancyOccupants(
|
export default async function getLotOccupancyOccupants(
|
||||||
lotOccupancyId: number | string,
|
lotOccupancyId: number | string,
|
||||||
connectedDatabase?: PoolConnection
|
connectedDatabase?: PoolConnection
|
||||||
): Promise<LotOccupancyOccupant[]> {
|
): Promise<LotOccupancyOccupant[]> {
|
||||||
|
|
@ -34,5 +34,3 @@ export async function getLotOccupancyOccupants(
|
||||||
|
|
||||||
return lotOccupancyOccupants
|
return lotOccupancyOccupants
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getLotOccupancyOccupants
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import type { PoolConnection } from 'better-sqlite-pool';
|
import type { PoolConnection } from 'better-sqlite-pool';
|
||||||
import type { LotOccupancyTransaction } from '../types/recordTypes.js';
|
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;
|
includeIntegrations: boolean;
|
||||||
}, connectedDatabase?: PoolConnection): Promise<LotOccupancyTransaction[]>;
|
}, connectedDatabase?: PoolConnection): Promise<LotOccupancyTransaction[]>;
|
||||||
export default getLotOccupancyTransactions;
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { dateIntegerToString, timeIntegerToString } from '@cityssm/utils-datetime';
|
import { dateIntegerToString, timeIntegerToString } from '@cityssm/utils-datetime';
|
||||||
import { getConfigProperty } from '../helpers/functions.config.js';
|
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';
|
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());
|
const database = connectedDatabase ?? (await acquireConnection());
|
||||||
database.function('userFn_dateIntegerToString', dateIntegerToString);
|
database.function('userFn_dateIntegerToString', dateIntegerToString);
|
||||||
database.function('userFn_timeIntegerToString', timeIntegerToString);
|
database.function('userFn_timeIntegerToString', timeIntegerToString);
|
||||||
|
|
@ -23,7 +23,7 @@ export async function getLotOccupancyTransactions(lotOccupancyId, options, conne
|
||||||
getConfigProperty('settings.dynamicsGP.integrationIsEnabled')) {
|
getConfigProperty('settings.dynamicsGP.integrationIsEnabled')) {
|
||||||
for (const transaction of lotOccupancyTransactions) {
|
for (const transaction of lotOccupancyTransactions) {
|
||||||
if ((transaction.externalReceiptNumber ?? '') !== '') {
|
if ((transaction.externalReceiptNumber ?? '') !== '') {
|
||||||
const gpDocument = await gpFunctions.getDynamicsGPDocument(transaction.externalReceiptNumber ?? '');
|
const gpDocument = await getDynamicsGPDocument(transaction.externalReceiptNumber ?? '');
|
||||||
if (gpDocument !== undefined) {
|
if (gpDocument !== undefined) {
|
||||||
transaction.dynamicsGPDocument = gpDocument;
|
transaction.dynamicsGPDocument = gpDocument;
|
||||||
}
|
}
|
||||||
|
|
@ -32,4 +32,3 @@ export async function getLotOccupancyTransactions(lotOccupancyId, options, conne
|
||||||
}
|
}
|
||||||
return lotOccupancyTransactions;
|
return lotOccupancyTransactions;
|
||||||
}
|
}
|
||||||
export default getLotOccupancyTransactions;
|
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,12 @@ import {
|
||||||
import type { PoolConnection } from 'better-sqlite-pool'
|
import type { PoolConnection } from 'better-sqlite-pool'
|
||||||
|
|
||||||
import { getConfigProperty } from '../helpers/functions.config.js'
|
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 type { LotOccupancyTransaction } from '../types/recordTypes.js'
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export async function getLotOccupancyTransactions(
|
export default async function getLotOccupancyTransactions(
|
||||||
lotOccupancyId: number | string,
|
lotOccupancyId: number | string,
|
||||||
options: {
|
options: {
|
||||||
includeIntegrations: boolean
|
includeIntegrations: boolean
|
||||||
|
|
@ -45,7 +45,7 @@ export async function getLotOccupancyTransactions(
|
||||||
) {
|
) {
|
||||||
for (const transaction of lotOccupancyTransactions) {
|
for (const transaction of lotOccupancyTransactions) {
|
||||||
if ((transaction.externalReceiptNumber ?? '') !== '') {
|
if ((transaction.externalReceiptNumber ?? '') !== '') {
|
||||||
const gpDocument = await gpFunctions.getDynamicsGPDocument(
|
const gpDocument = await getDynamicsGPDocument(
|
||||||
transaction.externalReceiptNumber ?? ''
|
transaction.externalReceiptNumber ?? ''
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -58,5 +58,3 @@ export async function getLotOccupancyTransactions(
|
||||||
|
|
||||||
return lotOccupancyTransactions
|
return lotOccupancyTransactions
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getLotOccupancyTransactions
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
import type { LotOccupantType } from '../types/recordTypes.js';
|
import type { LotOccupantType } from '../types/recordTypes.js';
|
||||||
export declare function getLotOccupantTypes(): Promise<LotOccupantType[]>;
|
export default function getLotOccupantTypes(): Promise<LotOccupantType[]>;
|
||||||
export default getLotOccupantTypes;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
|
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
|
||||||
export async function getLotOccupantTypes() {
|
export default async function getLotOccupantTypes() {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
const lotOccupantTypes = database
|
const lotOccupantTypes = database
|
||||||
.prepare(`select lotOccupantTypeId, lotOccupantType, fontAwesomeIconClass, occupantCommentTitle,
|
.prepare(`select lotOccupantTypeId, lotOccupantType, fontAwesomeIconClass, occupantCommentTitle,
|
||||||
|
|
@ -20,4 +20,3 @@ export async function getLotOccupantTypes() {
|
||||||
database.release();
|
database.release();
|
||||||
return lotOccupantTypes;
|
return lotOccupantTypes;
|
||||||
}
|
}
|
||||||
export default getLotOccupantTypes;
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,9 @@ import type { LotOccupantType } from '../types/recordTypes.js'
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
||||||
|
|
||||||
export async function getLotOccupantTypes(): Promise<LotOccupantType[]> {
|
export default async function getLotOccupantTypes(): Promise<
|
||||||
|
LotOccupantType[]
|
||||||
|
> {
|
||||||
const database = await acquireConnection()
|
const database = await acquireConnection()
|
||||||
|
|
||||||
const lotOccupantTypes = database
|
const lotOccupantTypes = database
|
||||||
|
|
@ -37,5 +39,3 @@ export async function getLotOccupantTypes(): Promise<LotOccupantType[]> {
|
||||||
|
|
||||||
return lotOccupantTypes
|
return lotOccupantTypes
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getLotOccupantTypes
|
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,5 @@ interface GetFilters {
|
||||||
interface LotStatusSummary extends LotStatus {
|
interface LotStatusSummary extends LotStatus {
|
||||||
lotCount: number;
|
lotCount: number;
|
||||||
}
|
}
|
||||||
export declare function getLotStatusSummary(filters: GetFilters): Promise<LotStatusSummary[]>;
|
export default function getLotStatusSummary(filters: GetFilters): Promise<LotStatusSummary[]>;
|
||||||
export default getLotStatusSummary;
|
export {};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getLotStatusSummary(filters) {
|
export default async function getLotStatusSummary(filters) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
let sqlWhereClause = ' where l.recordDelete_timeMillis is null';
|
let sqlWhereClause = ' where l.recordDelete_timeMillis is null';
|
||||||
const sqlParameters = [];
|
const sqlParameters = [];
|
||||||
|
|
@ -18,4 +18,3 @@ export async function getLotStatusSummary(filters) {
|
||||||
database.release();
|
database.release();
|
||||||
return lotStatuses;
|
return lotStatuses;
|
||||||
}
|
}
|
||||||
export default getLotStatusSummary;
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ interface LotStatusSummary extends LotStatus {
|
||||||
lotCount: number
|
lotCount: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getLotStatusSummary(
|
export default async function getLotStatusSummary(
|
||||||
filters: GetFilters
|
filters: GetFilters
|
||||||
): Promise<LotStatusSummary[]> {
|
): Promise<LotStatusSummary[]> {
|
||||||
const database = await acquireConnection()
|
const database = await acquireConnection()
|
||||||
|
|
@ -38,5 +38,3 @@ export async function getLotStatusSummary(
|
||||||
|
|
||||||
return lotStatuses
|
return lotStatuses
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getLotStatusSummary
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
import type { LotStatus } from '../types/recordTypes.js';
|
import type { LotStatus } from '../types/recordTypes.js';
|
||||||
export declare function getLotStatuses(): Promise<LotStatus[]>;
|
export default function getLotStatuses(): Promise<LotStatus[]>;
|
||||||
export default getLotStatuses;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
|
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
|
||||||
export async function getLotStatuses() {
|
export default async function getLotStatuses() {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
const lotStatuses = database
|
const lotStatuses = database
|
||||||
.prepare(`select lotStatusId, lotStatus, orderNumber
|
.prepare(`select lotStatusId, lotStatus, orderNumber
|
||||||
|
|
@ -19,4 +19,3 @@ export async function getLotStatuses() {
|
||||||
database.release();
|
database.release();
|
||||||
return lotStatuses;
|
return lotStatuses;
|
||||||
}
|
}
|
||||||
export default getLotStatuses;
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import type { LotStatus } from '../types/recordTypes.js'
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
||||||
|
|
||||||
export async function getLotStatuses(): Promise<LotStatus[]> {
|
export default async function getLotStatuses(): Promise<LotStatus[]> {
|
||||||
const database = await acquireConnection()
|
const database = await acquireConnection()
|
||||||
|
|
||||||
const lotStatuses = database
|
const lotStatuses = database
|
||||||
|
|
@ -35,5 +35,3 @@ export async function getLotStatuses(): Promise<LotStatus[]> {
|
||||||
|
|
||||||
return lotStatuses
|
return lotStatuses
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getLotStatuses
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import type { PoolConnection } from 'better-sqlite-pool';
|
import type { PoolConnection } from 'better-sqlite-pool';
|
||||||
import type { LotTypeField } from '../types/recordTypes.js';
|
import type { LotTypeField } from '../types/recordTypes.js';
|
||||||
export declare function getLotTypeFields(lotTypeId: number, connectedDatabase?: PoolConnection): Promise<LotTypeField[]>;
|
export default function getLotTypeFields(lotTypeId: number, connectedDatabase?: PoolConnection): Promise<LotTypeField[]>;
|
||||||
export default getLotTypeFields;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.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 database = connectedDatabase ?? (await acquireConnection());
|
||||||
const lotTypeFields = database
|
const lotTypeFields = database
|
||||||
.prepare(`select lotTypeFieldId,
|
.prepare(`select lotTypeFieldId,
|
||||||
|
|
@ -24,4 +24,3 @@ export async function getLotTypeFields(lotTypeId, connectedDatabase) {
|
||||||
}
|
}
|
||||||
return lotTypeFields;
|
return lotTypeFields;
|
||||||
}
|
}
|
||||||
export default getLotTypeFields;
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import type { LotTypeField } from '../types/recordTypes.js'
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
||||||
|
|
||||||
export async function getLotTypeFields(
|
export default async function getLotTypeFields(
|
||||||
lotTypeId: number,
|
lotTypeId: number,
|
||||||
connectedDatabase?: PoolConnection
|
connectedDatabase?: PoolConnection
|
||||||
): Promise<LotTypeField[]> {
|
): Promise<LotTypeField[]> {
|
||||||
|
|
@ -46,5 +46,3 @@ export async function getLotTypeFields(
|
||||||
|
|
||||||
return lotTypeFields
|
return lotTypeFields
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getLotTypeFields
|
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,5 @@ interface GetFilters {
|
||||||
interface LotTypeSummary extends LotType {
|
interface LotTypeSummary extends LotType {
|
||||||
lotCount: number;
|
lotCount: number;
|
||||||
}
|
}
|
||||||
export declare function getLotTypeSummary(filters: GetFilters): Promise<LotTypeSummary[]>;
|
export default function getLotTypeSummary(filters: GetFilters): Promise<LotTypeSummary[]>;
|
||||||
export default getLotTypeSummary;
|
export {};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getLotTypeSummary(filters) {
|
export default async function getLotTypeSummary(filters) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
let sqlWhereClause = ' where l.recordDelete_timeMillis is null';
|
let sqlWhereClause = ' where l.recordDelete_timeMillis is null';
|
||||||
const sqlParameters = [];
|
const sqlParameters = [];
|
||||||
|
|
@ -18,4 +18,3 @@ export async function getLotTypeSummary(filters) {
|
||||||
database.release();
|
database.release();
|
||||||
return lotTypes;
|
return lotTypes;
|
||||||
}
|
}
|
||||||
export default getLotTypeSummary;
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ interface LotTypeSummary extends LotType {
|
||||||
lotCount: number
|
lotCount: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getLotTypeSummary(
|
export default async function getLotTypeSummary(
|
||||||
filters: GetFilters
|
filters: GetFilters
|
||||||
): Promise<LotTypeSummary[]> {
|
): Promise<LotTypeSummary[]> {
|
||||||
const database = await acquireConnection()
|
const database = await acquireConnection()
|
||||||
|
|
@ -38,5 +38,3 @@ export async function getLotTypeSummary(
|
||||||
|
|
||||||
return lotTypes
|
return lotTypes
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getLotTypeSummary
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
import type { LotType } from '../types/recordTypes.js';
|
import type { LotType } from '../types/recordTypes.js';
|
||||||
export declare function getLotTypes(): Promise<LotType[]>;
|
export default function getLotTypes(): Promise<LotType[]>;
|
||||||
export default getLotTypes;
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { getLotTypeFields } from './getLotTypeFields.js';
|
import getLotTypeFields from './getLotTypeFields.js';
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
|
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
|
||||||
export async function getLotTypes() {
|
export default async function getLotTypes() {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
const lotTypes = database
|
const lotTypes = database
|
||||||
.prepare(`select lotTypeId, lotType, orderNumber
|
.prepare(`select lotTypeId, lotType, orderNumber
|
||||||
|
|
@ -21,4 +21,3 @@ export async function getLotTypes() {
|
||||||
database.release();
|
database.release();
|
||||||
return lotTypes;
|
return lotTypes;
|
||||||
}
|
}
|
||||||
export default getLotTypes;
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import type { LotType } from '../types/recordTypes.js'
|
import type { LotType } from '../types/recordTypes.js'
|
||||||
|
|
||||||
import { getLotTypeFields } from './getLotTypeFields.js'
|
import getLotTypeFields from './getLotTypeFields.js'
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
||||||
|
|
||||||
export async function getLotTypes(): Promise<LotType[]> {
|
export default async function getLotTypes(): Promise<LotType[]> {
|
||||||
const database = await acquireConnection()
|
const database = await acquireConnection()
|
||||||
|
|
||||||
const lotTypes = database
|
const lotTypes = database
|
||||||
|
|
@ -39,5 +39,3 @@ export async function getLotTypes(): Promise<LotType[]> {
|
||||||
|
|
||||||
return lotTypes
|
return lotTypes
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getLotTypes
|
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ interface GetLotsOptions {
|
||||||
offset: number;
|
offset: number;
|
||||||
includeLotOccupancyCount?: boolean;
|
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;
|
count: number;
|
||||||
lots: Lot[];
|
lots: Lot[];
|
||||||
}>;
|
}>;
|
||||||
export default getLots;
|
export {};
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ function buildWhereClause(filters) {
|
||||||
sqlParameters
|
sqlParameters
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
export async function getLots(filters, options, connectedDatabase) {
|
export default async function getLots(filters, options, connectedDatabase) {
|
||||||
const database = connectedDatabase ?? (await acquireConnection());
|
const database = connectedDatabase ?? (await acquireConnection());
|
||||||
const { sqlWhereClause, sqlParameters } = buildWhereClause(filters);
|
const { sqlWhereClause, sqlParameters } = buildWhereClause(filters);
|
||||||
const currentDate = dateToInteger(new Date());
|
const currentDate = dateToInteger(new Date());
|
||||||
|
|
@ -47,15 +47,15 @@ export async function getLots(filters, options, connectedDatabase) {
|
||||||
if (options.limit !== -1) {
|
if (options.limit !== -1) {
|
||||||
count = database
|
count = database
|
||||||
.prepare(`select count(*) as recordCount
|
.prepare(`select count(*) as recordCount
|
||||||
from Lots l
|
from Lots l
|
||||||
left join (
|
left join (
|
||||||
select lotId, count(lotOccupancyId) as lotOccupancyCount from LotOccupancies
|
select lotId, count(lotOccupancyId) as lotOccupancyCount from LotOccupancies
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and occupancyStartDate <= ${currentDate.toString()}
|
and occupancyStartDate <= ${currentDate.toString()}
|
||||||
and (occupancyEndDate is null or occupancyEndDate >= ${currentDate.toString()})
|
and (occupancyEndDate is null or occupancyEndDate >= ${currentDate.toString()})
|
||||||
group by lotId
|
group by lotId
|
||||||
) o on l.lotId = o.lotId
|
) o on l.lotId = o.lotId
|
||||||
${sqlWhereClause}`)
|
${sqlWhereClause}`)
|
||||||
.get(sqlParameters).recordCount;
|
.get(sqlParameters).recordCount;
|
||||||
}
|
}
|
||||||
let lots = [];
|
let lots = [];
|
||||||
|
|
@ -104,4 +104,3 @@ export async function getLots(filters, options, connectedDatabase) {
|
||||||
lots
|
lots
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
export default getLots;
|
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ function buildWhereClause(filters: GetLotsFilters): {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getLots(
|
export default async function getLots(
|
||||||
filters: GetLotsFilters,
|
filters: GetLotsFilters,
|
||||||
options: GetLotsOptions,
|
options: GetLotsOptions,
|
||||||
connectedDatabase?: PoolConnection
|
connectedDatabase?: PoolConnection
|
||||||
|
|
@ -92,15 +92,15 @@ export async function getLots(
|
||||||
database
|
database
|
||||||
.prepare(
|
.prepare(
|
||||||
`select count(*) as recordCount
|
`select count(*) as recordCount
|
||||||
from Lots l
|
from Lots l
|
||||||
left join (
|
left join (
|
||||||
select lotId, count(lotOccupancyId) as lotOccupancyCount from LotOccupancies
|
select lotId, count(lotOccupancyId) as lotOccupancyCount from LotOccupancies
|
||||||
where recordDelete_timeMillis is null
|
where recordDelete_timeMillis is null
|
||||||
and occupancyStartDate <= ${currentDate.toString()}
|
and occupancyStartDate <= ${currentDate.toString()}
|
||||||
and (occupancyEndDate is null or occupancyEndDate >= ${currentDate.toString()})
|
and (occupancyEndDate is null or occupancyEndDate >= ${currentDate.toString()})
|
||||||
group by lotId
|
group by lotId
|
||||||
) o on l.lotId = o.lotId
|
) o on l.lotId = o.lotId
|
||||||
${sqlWhereClause}`
|
${sqlWhereClause}`
|
||||||
)
|
)
|
||||||
.get(sqlParameters) as { recordCount: number }
|
.get(sqlParameters) as { recordCount: number }
|
||||||
).recordCount
|
).recordCount
|
||||||
|
|
@ -170,5 +170,3 @@ export async function getLots(
|
||||||
lots
|
lots
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getLots
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
import type { MapRecord } from '../types/recordTypes.js';
|
import type { MapRecord } from '../types/recordTypes.js';
|
||||||
export declare function getMap(mapId: number | string): Promise<MapRecord | undefined>;
|
export default function getMap(mapId: number | string): Promise<MapRecord | undefined>;
|
||||||
export default getMap;
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getMap(mapId) {
|
export default async function getMap(mapId) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
const map = database
|
const map = database
|
||||||
.prepare(`select m.mapId, m.mapName, m.mapDescription,
|
.prepare(`select m.mapId, m.mapName, m.mapDescription,
|
||||||
|
|
@ -25,4 +25,3 @@ export async function getMap(mapId) {
|
||||||
database.release();
|
database.release();
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
export default getMap;
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import type { MapRecord } from '../types/recordTypes.js'
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export async function getMap(
|
export default async function getMap(
|
||||||
mapId: number | string
|
mapId: number | string
|
||||||
): Promise<MapRecord | undefined> {
|
): Promise<MapRecord | undefined> {
|
||||||
const database = await acquireConnection()
|
const database = await acquireConnection()
|
||||||
|
|
@ -35,5 +35,3 @@ export async function getMap(
|
||||||
|
|
||||||
return map
|
return map
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getMap
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
import type { MapRecord } from '../types/recordTypes.js';
|
import type { MapRecord } from '../types/recordTypes.js';
|
||||||
export declare function getMaps(): Promise<MapRecord[]>;
|
export default function getMaps(): Promise<MapRecord[]>;
|
||||||
export default getMaps;
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getMaps() {
|
export default async function getMaps() {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
const maps = database
|
const maps = database
|
||||||
.prepare(`select m.mapId, m.mapName, m.mapDescription,
|
.prepare(`select m.mapId, m.mapName, m.mapDescription,
|
||||||
|
|
@ -18,4 +18,3 @@ export async function getMaps() {
|
||||||
database.release();
|
database.release();
|
||||||
return maps;
|
return maps;
|
||||||
}
|
}
|
||||||
export default getMaps;
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import type { MapRecord } from '../types/recordTypes.js'
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export async function getMaps(): Promise<MapRecord[]> {
|
export default async function getMaps(): Promise<MapRecord[]> {
|
||||||
const database = await acquireConnection()
|
const database = await acquireConnection()
|
||||||
|
|
||||||
const maps = database
|
const maps = database
|
||||||
|
|
@ -26,5 +26,3 @@ export async function getMaps(): Promise<MapRecord[]> {
|
||||||
|
|
||||||
return maps
|
return maps
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getMaps
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1 @@
|
||||||
export declare function getNextLotId(lotId: number | string): Promise<number | undefined>;
|
export default function getNextLotId(lotId: number | string): Promise<number | undefined>;
|
||||||
export default getNextLotId;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { getConfigProperty } from '../helpers/functions.config.js';
|
import { getConfigProperty } from '../helpers/functions.config.js';
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getNextLotId(lotId) {
|
export default async function getNextLotId(lotId) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
database.function('userFn_lotNameSortName', getConfigProperty('settings.lot.lotNameSortNameFunction'));
|
database.function('userFn_lotNameSortName', getConfigProperty('settings.lot.lotNameSortNameFunction'));
|
||||||
const result = database
|
const result = database
|
||||||
|
|
@ -17,4 +17,3 @@ export async function getNextLotId(lotId) {
|
||||||
}
|
}
|
||||||
return result.lotId;
|
return result.lotId;
|
||||||
}
|
}
|
||||||
export default getNextLotId;
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { getConfigProperty } from '../helpers/functions.config.js'
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export async function getNextLotId(
|
export default async function getNextLotId(
|
||||||
lotId: number | string
|
lotId: number | string
|
||||||
): Promise<number | undefined> {
|
): Promise<number | undefined> {
|
||||||
const database = await acquireConnection()
|
const database = await acquireConnection()
|
||||||
|
|
@ -33,5 +33,3 @@ export async function getNextLotId(
|
||||||
|
|
||||||
return result.lotId
|
return result.lotId
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getNextLotId
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1 @@
|
||||||
export declare function getNextMapId(mapId: number | string): Promise<number | undefined>;
|
export default function getNextMapId(mapId: number | string): Promise<number | undefined>;
|
||||||
export default getNextMapId;
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getNextMapId(mapId) {
|
export default async function getNextMapId(mapId) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
const result = database
|
const result = database
|
||||||
.prepare(`select mapId
|
.prepare(`select mapId
|
||||||
|
|
@ -15,4 +15,3 @@ export async function getNextMapId(mapId) {
|
||||||
}
|
}
|
||||||
return result.mapId;
|
return result.mapId;
|
||||||
}
|
}
|
||||||
export default getNextMapId;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export async function getNextMapId(
|
export default async function getNextMapId(
|
||||||
mapId: number | string
|
mapId: number | string
|
||||||
): Promise<number | undefined> {
|
): Promise<number | undefined> {
|
||||||
const database = await acquireConnection()
|
const database = await acquireConnection()
|
||||||
|
|
@ -26,5 +26,3 @@ export async function getNextMapId(
|
||||||
|
|
||||||
return result.mapId
|
return result.mapId
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getNextMapId
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
import type { PoolConnection } from 'better-sqlite-pool';
|
import type { PoolConnection } from 'better-sqlite-pool';
|
||||||
export declare function getNextWorkOrderNumber(connectedDatabase?: PoolConnection): Promise<string>;
|
export default function getNextWorkOrderNumber(connectedDatabase?: PoolConnection): Promise<string>;
|
||||||
export default getNextWorkOrderNumber;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { getConfigProperty } from '../helpers/functions.config.js';
|
import { getConfigProperty } from '../helpers/functions.config.js';
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getNextWorkOrderNumber(connectedDatabase) {
|
export default async function getNextWorkOrderNumber(connectedDatabase) {
|
||||||
const database = connectedDatabase ?? (await acquireConnection());
|
const database = connectedDatabase ?? (await acquireConnection());
|
||||||
const paddingLength = getConfigProperty('settings.workOrders.workOrderNumberLength');
|
const paddingLength = getConfigProperty('settings.workOrders.workOrderNumberLength');
|
||||||
const currentYearString = new Date().getFullYear().toString();
|
const currentYearString = new Date().getFullYear().toString();
|
||||||
|
|
@ -23,4 +23,3 @@ export async function getNextWorkOrderNumber(connectedDatabase) {
|
||||||
workOrderNumberIndex += 1;
|
workOrderNumberIndex += 1;
|
||||||
return `${currentYearString}-${workOrderNumberIndex.toString().padStart(paddingLength, '0')}`;
|
return `${currentYearString}-${workOrderNumberIndex.toString().padStart(paddingLength, '0')}`;
|
||||||
}
|
}
|
||||||
export default getNextWorkOrderNumber;
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { getConfigProperty } from '../helpers/functions.config.js'
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export async function getNextWorkOrderNumber(
|
export default async function getNextWorkOrderNumber(
|
||||||
connectedDatabase?: PoolConnection
|
connectedDatabase?: PoolConnection
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const database = connectedDatabase ?? (await acquireConnection())
|
const database = connectedDatabase ?? (await acquireConnection())
|
||||||
|
|
@ -17,6 +17,7 @@ export async function getNextWorkOrderNumber(
|
||||||
const regex = new RegExp(`^${currentYearString}-\\d+$`)
|
const regex = new RegExp(`^${currentYearString}-\\d+$`)
|
||||||
|
|
||||||
database.function(
|
database.function(
|
||||||
|
// eslint-disable-next-line no-secrets/no-secrets
|
||||||
'userFn_matchesWorkOrderNumberSyntax',
|
'userFn_matchesWorkOrderNumberSyntax',
|
||||||
(workOrderNumber: string) => {
|
(workOrderNumber: string) => {
|
||||||
return regex.test(workOrderNumber) ? 1 : 0
|
return regex.test(workOrderNumber) ? 1 : 0
|
||||||
|
|
@ -25,6 +26,7 @@ export async function getNextWorkOrderNumber(
|
||||||
|
|
||||||
const workOrderNumberRecord = database
|
const workOrderNumberRecord = database
|
||||||
.prepare(
|
.prepare(
|
||||||
|
// eslint-disable-next-line no-secrets/no-secrets
|
||||||
`select workOrderNumber from WorkOrders
|
`select workOrderNumber from WorkOrders
|
||||||
where userFn_matchesWorkOrderNumberSyntax(workOrderNumber) = 1
|
where userFn_matchesWorkOrderNumberSyntax(workOrderNumber) = 1
|
||||||
order by cast(substr(workOrderNumber, instr(workOrderNumber, '-') + 1) as integer) desc`
|
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')}`
|
return `${currentYearString}-${workOrderNumberIndex.toString().padStart(paddingLength, '0')}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getNextWorkOrderNumber
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import type { PoolConnection } from 'better-sqlite-pool';
|
import type { PoolConnection } from 'better-sqlite-pool';
|
||||||
import type { OccupancyTypeField } from '../types/recordTypes.js';
|
import type { OccupancyTypeField } from '../types/recordTypes.js';
|
||||||
export declare function getOccupancyTypeFields(occupancyTypeId?: number, connectedDatabase?: PoolConnection): Promise<OccupancyTypeField[]>;
|
export default function getOccupancyTypeFields(occupancyTypeId?: number, connectedDatabase?: PoolConnection): Promise<OccupancyTypeField[]>;
|
||||||
export default getOccupancyTypeFields;
|
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,20 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.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 database = connectedDatabase ?? (await acquireConnection());
|
||||||
const sqlParameters = [];
|
const sqlParameters = [];
|
||||||
if ((occupancyTypeId ?? -1) !== -1) {
|
if ((occupancyTypeId ?? -1) !== -1) {
|
||||||
sqlParameters.push(occupancyTypeId);
|
sqlParameters.push(occupancyTypeId);
|
||||||
}
|
}
|
||||||
const occupancyTypeFields = database
|
const occupancyTypeFields = database
|
||||||
.prepare('select occupancyTypeFieldId,' +
|
.prepare(`select occupancyTypeFieldId, occupancyTypeField,
|
||||||
' occupancyTypeField, occupancyTypeFieldValues, isRequired, pattern,' +
|
occupancyTypeFieldValues, isRequired, pattern, minimumLength, maximumLength, orderNumber
|
||||||
' minimumLength, maximumLength,' +
|
from OccupancyTypeFields
|
||||||
' orderNumber' +
|
where recordDelete_timeMillis is null
|
||||||
' from OccupancyTypeFields' +
|
${(occupancyTypeId ?? -1) === -1
|
||||||
' where recordDelete_timeMillis is null' +
|
? ' and occupancyTypeId is null'
|
||||||
((occupancyTypeId ?? -1) === -1
|
: ' and occupancyTypeId = ?'}
|
||||||
? ' and occupancyTypeId is null'
|
order by orderNumber, occupancyTypeField`)
|
||||||
: ' and occupancyTypeId = ?') +
|
|
||||||
' order by orderNumber, occupancyTypeField')
|
|
||||||
.all(sqlParameters);
|
.all(sqlParameters);
|
||||||
let expectedOrderNumber = 0;
|
let expectedOrderNumber = 0;
|
||||||
for (const occupancyTypeField of occupancyTypeFields) {
|
for (const occupancyTypeField of occupancyTypeFields) {
|
||||||
|
|
@ -31,4 +29,3 @@ export async function getOccupancyTypeFields(occupancyTypeId, connectedDatabase)
|
||||||
}
|
}
|
||||||
return occupancyTypeFields;
|
return occupancyTypeFields;
|
||||||
}
|
}
|
||||||
export default getOccupancyTypeFields;
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import type { OccupancyTypeField } from '../types/recordTypes.js'
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
||||||
|
|
||||||
export async function getOccupancyTypeFields(
|
export default async function getOccupancyTypeFields(
|
||||||
occupancyTypeId?: number,
|
occupancyTypeId?: number,
|
||||||
connectedDatabase?: PoolConnection
|
connectedDatabase?: PoolConnection
|
||||||
): Promise<OccupancyTypeField[]> {
|
): Promise<OccupancyTypeField[]> {
|
||||||
|
|
@ -19,16 +19,16 @@ export async function getOccupancyTypeFields(
|
||||||
|
|
||||||
const occupancyTypeFields = database
|
const occupancyTypeFields = database
|
||||||
.prepare(
|
.prepare(
|
||||||
'select occupancyTypeFieldId,' +
|
`select occupancyTypeFieldId, occupancyTypeField,
|
||||||
' occupancyTypeField, occupancyTypeFieldValues, isRequired, pattern,' +
|
occupancyTypeFieldValues, isRequired, pattern, minimumLength, maximumLength, orderNumber
|
||||||
' minimumLength, maximumLength,' +
|
from OccupancyTypeFields
|
||||||
' orderNumber' +
|
where recordDelete_timeMillis is null
|
||||||
' from OccupancyTypeFields' +
|
${
|
||||||
' where recordDelete_timeMillis is null' +
|
(occupancyTypeId ?? -1) === -1
|
||||||
((occupancyTypeId ?? -1) === -1
|
? ' and occupancyTypeId is null'
|
||||||
? ' and occupancyTypeId is null'
|
: ' and occupancyTypeId = ?'
|
||||||
: ' and occupancyTypeId = ?') +
|
}
|
||||||
' order by orderNumber, occupancyTypeField'
|
order by orderNumber, occupancyTypeField`
|
||||||
)
|
)
|
||||||
.all(sqlParameters) as OccupancyTypeField[]
|
.all(sqlParameters) as OccupancyTypeField[]
|
||||||
|
|
||||||
|
|
@ -55,5 +55,3 @@ export async function getOccupancyTypeFields(
|
||||||
|
|
||||||
return occupancyTypeFields
|
return occupancyTypeFields
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getOccupancyTypeFields
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
import type { PoolConnection } from 'better-sqlite-pool';
|
import type { PoolConnection } from 'better-sqlite-pool';
|
||||||
export declare function getOccupancyTypePrints(occupancyTypeId: number, connectedDatabase?: PoolConnection): Promise<string[]>;
|
export default function getOccupancyTypePrints(occupancyTypeId: number, connectedDatabase?: PoolConnection): Promise<string[]>;
|
||||||
export default getOccupancyTypePrints;
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ const userFunction_configContainsPrintEJS = (printEJS) => {
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
export async function getOccupancyTypePrints(occupancyTypeId, connectedDatabase) {
|
export default async function getOccupancyTypePrints(occupancyTypeId, connectedDatabase) {
|
||||||
const database = connectedDatabase ?? (await acquireConnection());
|
const database = connectedDatabase ?? (await acquireConnection());
|
||||||
database.function('userFn_configContainsPrintEJS', userFunction_configContainsPrintEJS);
|
database.function('userFn_configContainsPrintEJS', userFunction_configContainsPrintEJS);
|
||||||
const results = database
|
const results = database
|
||||||
|
|
@ -37,4 +37,3 @@ export async function getOccupancyTypePrints(occupancyTypeId, connectedDatabase)
|
||||||
}
|
}
|
||||||
return prints;
|
return prints;
|
||||||
}
|
}
|
||||||
export default getOccupancyTypePrints;
|
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,14 @@ const userFunction_configContainsPrintEJS = (printEJS: string): number => {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getOccupancyTypePrints(
|
export default async function getOccupancyTypePrints(
|
||||||
occupancyTypeId: number,
|
occupancyTypeId: number,
|
||||||
connectedDatabase?: PoolConnection
|
connectedDatabase?: PoolConnection
|
||||||
): Promise<string[]> {
|
): Promise<string[]> {
|
||||||
const database = connectedDatabase ?? (await acquireConnection())
|
const database = connectedDatabase ?? (await acquireConnection())
|
||||||
|
|
||||||
database.function(
|
database.function(
|
||||||
|
// eslint-disable-next-line no-secrets/no-secrets
|
||||||
'userFn_configContainsPrintEJS',
|
'userFn_configContainsPrintEJS',
|
||||||
userFunction_configContainsPrintEJS
|
userFunction_configContainsPrintEJS
|
||||||
)
|
)
|
||||||
|
|
@ -64,5 +65,3 @@ export async function getOccupancyTypePrints(
|
||||||
|
|
||||||
return prints
|
return prints
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getOccupancyTypePrints
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
import type { OccupancyType } from '../types/recordTypes.js';
|
import type { OccupancyType } from '../types/recordTypes.js';
|
||||||
export declare function getOccupancyTypes(): Promise<OccupancyType[]>;
|
export default function getOccupancyTypes(): Promise<OccupancyType[]>;
|
||||||
export default getOccupancyTypes;
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { getOccupancyTypeFields } from './getOccupancyTypeFields.js';
|
import getOccupancyTypeFields from './getOccupancyTypeFields.js';
|
||||||
import { getOccupancyTypePrints } from './getOccupancyTypePrints.js';
|
import getOccupancyTypePrints from './getOccupancyTypePrints.js';
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
|
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
|
||||||
export async function getOccupancyTypes() {
|
export default async function getOccupancyTypes() {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
const occupancyTypes = database
|
const occupancyTypes = database
|
||||||
.prepare(`select occupancyTypeId, occupancyType, orderNumber
|
.prepare(`select occupancyTypeId, occupancyType, orderNumber
|
||||||
|
|
@ -23,4 +23,3 @@ export async function getOccupancyTypes() {
|
||||||
database.release();
|
database.release();
|
||||||
return occupancyTypes;
|
return occupancyTypes;
|
||||||
}
|
}
|
||||||
export default getOccupancyTypes;
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import type { OccupancyType } from '../types/recordTypes.js'
|
import type { OccupancyType } from '../types/recordTypes.js'
|
||||||
|
|
||||||
import { getOccupancyTypeFields } from './getOccupancyTypeFields.js'
|
import getOccupancyTypeFields from './getOccupancyTypeFields.js'
|
||||||
import { getOccupancyTypePrints } from './getOccupancyTypePrints.js'
|
import getOccupancyTypePrints from './getOccupancyTypePrints.js'
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
|
||||||
|
|
||||||
export async function getOccupancyTypes(): Promise<OccupancyType[]> {
|
export default async function getOccupancyTypes(): Promise<OccupancyType[]> {
|
||||||
const database = await acquireConnection()
|
const database = await acquireConnection()
|
||||||
|
|
||||||
const occupancyTypes = database
|
const occupancyTypes = database
|
||||||
|
|
@ -49,4 +49,3 @@ export async function getOccupancyTypes(): Promise<OccupancyType[]> {
|
||||||
return occupancyTypes
|
return occupancyTypes
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getOccupancyTypes
|
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,5 @@ interface GetPastLotOccupancyOccupantsFilters {
|
||||||
interface GetPastLotOccupancyOccupantsOptions {
|
interface GetPastLotOccupancyOccupantsOptions {
|
||||||
limit: number;
|
limit: number;
|
||||||
}
|
}
|
||||||
export declare function getPastLotOccupancyOccupants(filters: GetPastLotOccupancyOccupantsFilters, options: GetPastLotOccupancyOccupantsOptions): Promise<LotOccupancyOccupant[]>;
|
export default function getPastLotOccupancyOccupants(filters: GetPastLotOccupancyOccupantsFilters, options: GetPastLotOccupancyOccupantsOptions): Promise<LotOccupancyOccupant[]>;
|
||||||
export default getPastLotOccupancyOccupants;
|
export {};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getPastLotOccupancyOccupants(filters, options) {
|
export default async function getPastLotOccupancyOccupants(filters, options) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
let sqlWhereClause = ' where o.recordDelete_timeMillis is null and l.recordDelete_timeMillis is null';
|
let sqlWhereClause = ' where o.recordDelete_timeMillis is null and l.recordDelete_timeMillis is null';
|
||||||
const sqlParameters = [];
|
const sqlParameters = [];
|
||||||
|
|
@ -38,4 +38,3 @@ export async function getPastLotOccupancyOccupants(filters, options) {
|
||||||
database.release();
|
database.release();
|
||||||
return lotOccupancyOccupants;
|
return lotOccupancyOccupants;
|
||||||
}
|
}
|
||||||
export default getPastLotOccupancyOccupants;
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ interface GetPastLotOccupancyOccupantsOptions {
|
||||||
limit: number
|
limit: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getPastLotOccupancyOccupants(
|
export default async function getPastLotOccupancyOccupants(
|
||||||
filters: GetPastLotOccupancyOccupantsFilters,
|
filters: GetPastLotOccupancyOccupantsFilters,
|
||||||
options: GetPastLotOccupancyOccupantsOptions
|
options: GetPastLotOccupancyOccupantsOptions
|
||||||
): Promise<LotOccupancyOccupant[]> {
|
): Promise<LotOccupancyOccupant[]> {
|
||||||
|
|
@ -69,5 +69,3 @@ export async function getPastLotOccupancyOccupants(
|
||||||
|
|
||||||
return lotOccupancyOccupants
|
return lotOccupancyOccupants
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getPastLotOccupancyOccupants
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1 @@
|
||||||
export declare function getPreviousLotId(lotId: number | string): Promise<number | undefined>;
|
export default function getPreviousLotId(lotId: number | string): Promise<number | undefined>;
|
||||||
export default getPreviousLotId;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { getConfigProperty } from '../helpers/functions.config.js';
|
import { getConfigProperty } from '../helpers/functions.config.js';
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getPreviousLotId(lotId) {
|
export default async function getPreviousLotId(lotId) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
database.function('userFn_lotNameSortName', getConfigProperty('settings.lot.lotNameSortNameFunction'));
|
database.function('userFn_lotNameSortName', getConfigProperty('settings.lot.lotNameSortNameFunction'));
|
||||||
const result = database
|
const result = database
|
||||||
|
|
@ -16,4 +16,3 @@ export async function getPreviousLotId(lotId) {
|
||||||
}
|
}
|
||||||
return result.lotId;
|
return result.lotId;
|
||||||
}
|
}
|
||||||
export default getPreviousLotId;
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { getConfigProperty } from '../helpers/functions.config.js'
|
||||||
|
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export async function getPreviousLotId(
|
export default async function getPreviousLotId(
|
||||||
lotId: number | string
|
lotId: number | string
|
||||||
): Promise<number | undefined> {
|
): Promise<number | undefined> {
|
||||||
const database = await acquireConnection()
|
const database = await acquireConnection()
|
||||||
|
|
@ -32,5 +32,3 @@ export async function getPreviousLotId(
|
||||||
|
|
||||||
return result.lotId
|
return result.lotId
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getPreviousLotId
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1 @@
|
||||||
export declare function getPreviousMapId(mapId: number | string): Promise<number | undefined>;
|
export default function getPreviousMapId(mapId: number | string): Promise<number | undefined>;
|
||||||
export default getPreviousMapId;
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { acquireConnection } from './pool.js';
|
import { acquireConnection } from './pool.js';
|
||||||
export async function getPreviousMapId(mapId) {
|
export default async function getPreviousMapId(mapId) {
|
||||||
const database = await acquireConnection();
|
const database = await acquireConnection();
|
||||||
const result = database
|
const result = database
|
||||||
.prepare(`select mapId from Maps
|
.prepare(`select mapId from Maps
|
||||||
|
|
@ -14,4 +14,3 @@ export async function getPreviousMapId(mapId) {
|
||||||
}
|
}
|
||||||
return result.mapId;
|
return result.mapId;
|
||||||
}
|
}
|
||||||
export default getPreviousMapId;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { acquireConnection } from './pool.js'
|
import { acquireConnection } from './pool.js'
|
||||||
|
|
||||||
export async function getPreviousMapId(
|
export default async function getPreviousMapId(
|
||||||
mapId: number | string
|
mapId: number | string
|
||||||
): Promise<number | undefined> {
|
): Promise<number | undefined> {
|
||||||
const database = await acquireConnection()
|
const database = await acquireConnection()
|
||||||
|
|
@ -25,5 +25,3 @@ export async function getPreviousMapId(
|
||||||
|
|
||||||
return result.mapId
|
return result.mapId
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getPreviousMapId
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
export type ReportParameters = Record<string, string | number>;
|
export type ReportParameters = Record<string, string | number>;
|
||||||
export declare function getReportData(reportName: string, reportParameters?: ReportParameters): Promise<unknown[] | undefined>;
|
export default function getReportData(reportName: string, reportParameters?: ReportParameters): Promise<unknown[] | undefined>;
|
||||||
export default getReportData;
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue