remove duplicate add and clear cache
parent
992bb3c6b0
commit
3af27e0739
|
|
@ -1,7 +1,7 @@
|
|||
import { addFeeCategory } from "../../helpers/lotOccupancyDB/addFeeCategory.js";
|
||||
import { addRecord } from "../../helpers/lotOccupancyDB/addRecord.js";
|
||||
import { getFeeCategories } from "../../helpers/lotOccupancyDB/getFeeCategories.js";
|
||||
export const handler = async (request, response) => {
|
||||
const feeCategoryId = addFeeCategory(request.body, request.session);
|
||||
const feeCategoryId = addRecord("FeeCategories", request.body.feeCategory, request.body.orderNumber || -1, request.session);
|
||||
const feeCategories = getFeeCategories({}, {
|
||||
includeFees: true
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
import type { RequestHandler } from "express";
|
||||
|
||||
import { addFeeCategory } from "../../helpers/lotOccupancyDB/addFeeCategory.js";
|
||||
import { addRecord } from "../../helpers/lotOccupancyDB/addRecord.js";
|
||||
|
||||
import { getFeeCategories } from "../../helpers/lotOccupancyDB/getFeeCategories.js";
|
||||
|
||||
export const handler: RequestHandler = async (request, response) => {
|
||||
const feeCategoryId = addFeeCategory(request.body, request.session);
|
||||
const feeCategoryId = addRecord(
|
||||
"FeeCategories",
|
||||
request.body.feeCategory,
|
||||
request.body.orderNumber || -1,
|
||||
request.session
|
||||
);
|
||||
|
||||
const feeCategories = getFeeCategories(
|
||||
{},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addLotStatus } from "../../helpers/lotOccupancyDB/addLotStatus.js";
|
||||
import { addRecord } from "../../helpers/lotOccupancyDB/addRecord.js";
|
||||
import { getLotStatuses } from "../../helpers/functions.cache.js";
|
||||
export const handler = async (request, response) => {
|
||||
const lotStatusId = addLotStatus(request.body, request.session);
|
||||
const lotStatusId = addRecord("LotStatuses", request.body.lotStatus, request.body.orderNumber || -1, request.session);
|
||||
const lotStatuses = getLotStatuses();
|
||||
response.json({
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
import type { RequestHandler } from "express";
|
||||
|
||||
import { addLotStatus } from "../../helpers/lotOccupancyDB/addLotStatus.js";
|
||||
|
||||
import { addRecord } from "../../helpers/lotOccupancyDB/addRecord.js";
|
||||
import { getLotStatuses } from "../../helpers/functions.cache.js";
|
||||
|
||||
export const handler: RequestHandler = async (request, response) => {
|
||||
const lotStatusId = addLotStatus(request.body, request.session);
|
||||
const lotStatusId = addRecord(
|
||||
"LotStatuses",
|
||||
request.body.lotStatus,
|
||||
request.body.orderNumber || -1,
|
||||
request.session
|
||||
);
|
||||
|
||||
const lotStatuses = getLotStatuses();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addLotType } from "../../helpers/lotOccupancyDB/addLotType.js";
|
||||
import { addRecord } from "../../helpers/lotOccupancyDB/addRecord.js";
|
||||
import { getLotTypes } from "../../helpers/functions.cache.js";
|
||||
export const handler = async (request, response) => {
|
||||
const lotTypeId = addLotType(request.body, request.session);
|
||||
const lotTypeId = addRecord("LotTypes", request.body.lotType, request.body.orderNumber || -1, request.session);
|
||||
const lotTypes = getLotTypes();
|
||||
response.json({
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
import type { RequestHandler } from "express";
|
||||
|
||||
import { addLotType } from "../../helpers/lotOccupancyDB/addLotType.js";
|
||||
|
||||
import { addRecord } from "../../helpers/lotOccupancyDB/addRecord.js";
|
||||
import { getLotTypes } from "../../helpers/functions.cache.js";
|
||||
|
||||
export const handler: RequestHandler = async (request, response) => {
|
||||
const lotTypeId = addLotType(request.body, request.session);
|
||||
const lotTypeId = addRecord(
|
||||
"LotTypes",
|
||||
request.body.lotType,
|
||||
request.body.orderNumber || -1,
|
||||
request.session
|
||||
);
|
||||
|
||||
const lotTypes = getLotTypes();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addOccupancyType } from "../../helpers/lotOccupancyDB/addOccupancyType.js";
|
||||
import { addRecord } from "../../helpers/lotOccupancyDB/addRecord.js";
|
||||
import { getAllOccupancyTypeFields, getOccupancyTypes } from "../../helpers/functions.cache.js";
|
||||
export const handler = async (request, response) => {
|
||||
const occupancyTypeId = addOccupancyType(request.body, request.session);
|
||||
const occupancyTypeId = addRecord("OccupancyTypes", request.body.occupancyType, request.body.orderNumber || -1, request.session);
|
||||
const occupancyTypes = getOccupancyTypes();
|
||||
const allOccupancyTypeFields = getAllOccupancyTypeFields();
|
||||
response.json({
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
import type { RequestHandler } from "express";
|
||||
|
||||
import { addOccupancyType } from "../../helpers/lotOccupancyDB/addOccupancyType.js";
|
||||
|
||||
import { addRecord } from "../../helpers/lotOccupancyDB/addRecord.js";
|
||||
import { getAllOccupancyTypeFields, getOccupancyTypes } from "../../helpers/functions.cache.js";
|
||||
|
||||
export const handler: RequestHandler = async (request, response) => {
|
||||
const occupancyTypeId = addOccupancyType(request.body, request.session);
|
||||
const occupancyTypeId = addRecord(
|
||||
"OccupancyTypes",
|
||||
request.body.occupancyType,
|
||||
request.body.orderNumber || -1,
|
||||
request.session
|
||||
);
|
||||
|
||||
const occupancyTypes = getOccupancyTypes();
|
||||
const allOccupancyTypeFields = getAllOccupancyTypeFields();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addWorkOrderMilestoneType } from "../../helpers/lotOccupancyDB/addWorkOrderMilestoneType.js";
|
||||
import { getWorkOrderMilestoneTypes } from "../../helpers/functions.cache.js";
|
||||
import { addRecord } from "../../helpers/lotOccupancyDB/addRecord.js";
|
||||
export const handler = async (request, response) => {
|
||||
const workOrderMilestoneTypeId = addWorkOrderMilestoneType(request.body, request.session);
|
||||
const workOrderMilestoneTypeId = addRecord("WorkOrderMilestoneTypes", request.body.workOrderMilestoneType, request.body.orderNumber || -1, request.session);
|
||||
const workOrderMilestoneTypes = getWorkOrderMilestoneTypes();
|
||||
response.json({
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
import type { RequestHandler } from "express";
|
||||
|
||||
import { addWorkOrderMilestoneType } from "../../helpers/lotOccupancyDB/addWorkOrderMilestoneType.js";
|
||||
|
||||
import { getWorkOrderMilestoneTypes } from "../../helpers/functions.cache.js";
|
||||
import { addRecord } from "../../helpers/lotOccupancyDB/addRecord.js";
|
||||
|
||||
export const handler: RequestHandler = async (request, response) => {
|
||||
const workOrderMilestoneTypeId = addWorkOrderMilestoneType(request.body, request.session);
|
||||
const workOrderMilestoneTypeId = addRecord(
|
||||
"WorkOrderMilestoneTypes",
|
||||
request.body.workOrderMilestoneType,
|
||||
request.body.orderNumber || -1,
|
||||
request.session
|
||||
);
|
||||
|
||||
const workOrderMilestoneTypes = getWorkOrderMilestoneTypes();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { addWorkOrderType } from "../../helpers/lotOccupancyDB/addWorkOrderType.js";
|
||||
import { addRecord } from "../../helpers/lotOccupancyDB/addRecord.js";
|
||||
import { getWorkOrderTypes } from "../../helpers/functions.cache.js";
|
||||
export const handler = async (request, response) => {
|
||||
const workOrderTypeId = addWorkOrderType(request.body, request.session);
|
||||
const workOrderTypeId = addRecord("WorkOrderTypes", request.body.workOrderType, request.body.orderNumber || -1, request.session);
|
||||
const workOrderTypes = getWorkOrderTypes();
|
||||
response.json({
|
||||
success: true,
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
import type { RequestHandler } from "express";
|
||||
|
||||
import { addWorkOrderType } from "../../helpers/lotOccupancyDB/addWorkOrderType.js";
|
||||
|
||||
import { addRecord } from "../../helpers/lotOccupancyDB/addRecord.js";
|
||||
import { getWorkOrderTypes } from "../../helpers/functions.cache.js";
|
||||
|
||||
export const handler: RequestHandler = async (request, response) => {
|
||||
const workOrderTypeId = addWorkOrderType(request.body, request.session);
|
||||
const workOrderTypeId = addRecord(
|
||||
"WorkOrderTypes",
|
||||
request.body.workOrderType,
|
||||
request.body.orderNumber || -1,
|
||||
request.session
|
||||
);
|
||||
|
||||
const workOrderTypes = getWorkOrderTypes();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,25 +2,20 @@ import type * as recordTypes from "../types/recordTypes";
|
|||
export declare function getLotOccupantTypes(): recordTypes.LotOccupantType[];
|
||||
export declare function getLotOccupantTypeById(lotOccupantTypeId: number): recordTypes.LotOccupantType;
|
||||
export declare function getLotOccupantTypeByLotOccupantType(lotOccupantType: string): recordTypes.LotOccupantType;
|
||||
export declare function clearLotOccupantTypesCache(): void;
|
||||
export declare function getLotStatuses(): recordTypes.LotStatus[];
|
||||
export declare function getLotStatusById(lotStatusId: number): recordTypes.LotStatus;
|
||||
export declare function getLotStatusByLotStatus(lotStatus: string): recordTypes.LotStatus;
|
||||
export declare function clearLotStatusesCache(): void;
|
||||
export declare function getLotTypes(): recordTypes.LotType[];
|
||||
export declare function getLotTypeById(lotTypeId: number): recordTypes.LotType;
|
||||
export declare function getLotTypesByLotType(lotType: string): recordTypes.LotType;
|
||||
export declare function clearLotTypesCache(): void;
|
||||
export declare function getOccupancyTypes(): recordTypes.OccupancyType[];
|
||||
export declare function getAllOccupancyTypeFields(): recordTypes.OccupancyTypeField[];
|
||||
export declare function getOccupancyTypeById(occupancyTypeId: number): recordTypes.OccupancyType;
|
||||
export declare function getOccupancyTypeByOccupancyType(occupancyTypeString: string): recordTypes.OccupancyType;
|
||||
export declare function getOccupancyTypePrintsById(occupancyTypeId: number): string[];
|
||||
export declare function clearOccupancyTypesCache(): void;
|
||||
export declare function getWorkOrderTypes(): recordTypes.WorkOrderType[];
|
||||
export declare function getWorkOrderTypeById(workOrderTypeId: number): recordTypes.WorkOrderType;
|
||||
export declare function clearWorkOrderTypesCache(): void;
|
||||
export declare function getWorkOrderMilestoneTypes(): recordTypes.WorkOrderMilestoneType[];
|
||||
export declare function getWorkOrderMilestoneTypeByWorkOrderMilestoneTypeId(workOrderMilestoneTypeId: number): recordTypes.WorkOrderMilestoneType;
|
||||
export declare function getWorkOrderMilestoneTypeByWorkOrderMilestoneType(workOrderMilestoneTypeString: string): recordTypes.WorkOrderMilestoneType;
|
||||
export declare function clearWorkOrderMilestoneTypesCache(): void;
|
||||
export declare function clearCacheByTableName(tableName: string): void;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export function getLotOccupantTypeByLotOccupantType(lotOccupantType) {
|
|||
return currentLotOccupantType.lotOccupantType.toLowerCase() === lotOccupantTypeLowerCase;
|
||||
});
|
||||
}
|
||||
export function clearLotOccupantTypesCache() {
|
||||
function clearLotOccupantTypesCache() {
|
||||
lotOccupantTypes = undefined;
|
||||
}
|
||||
let lotStatuses;
|
||||
|
|
@ -49,7 +49,7 @@ export function getLotStatusByLotStatus(lotStatus) {
|
|||
return currentLotStatus.lotStatus.toLowerCase() === lotStatusLowerCase;
|
||||
});
|
||||
}
|
||||
export function clearLotStatusesCache() {
|
||||
function clearLotStatusesCache() {
|
||||
lotStatuses = undefined;
|
||||
}
|
||||
let lotTypes;
|
||||
|
|
@ -72,7 +72,7 @@ export function getLotTypesByLotType(lotType) {
|
|||
return currentLotType.lotType.toLowerCase() === lotTypeLowerCase;
|
||||
});
|
||||
}
|
||||
export function clearLotTypesCache() {
|
||||
function clearLotTypesCache() {
|
||||
lotTypes = undefined;
|
||||
}
|
||||
let occupancyTypes;
|
||||
|
|
@ -112,7 +112,7 @@ export function getOccupancyTypePrintsById(occupancyTypeId) {
|
|||
}
|
||||
return occupancyType.occupancyTypePrints;
|
||||
}
|
||||
export function clearOccupancyTypesCache() {
|
||||
function clearOccupancyTypesCache() {
|
||||
occupancyTypes = undefined;
|
||||
allOccupancyTypeFields = undefined;
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ export function getWorkOrderTypeById(workOrderTypeId) {
|
|||
return currentWorkOrderType.workOrderTypeId === workOrderTypeId;
|
||||
});
|
||||
}
|
||||
export function clearWorkOrderTypesCache() {
|
||||
function clearWorkOrderTypesCache() {
|
||||
workOrderTypes = undefined;
|
||||
}
|
||||
let workOrderMilestoneTypes;
|
||||
|
|
@ -153,6 +153,37 @@ export function getWorkOrderMilestoneTypeByWorkOrderMilestoneType(workOrderMiles
|
|||
workOrderMilestoneTypeLowerCase);
|
||||
});
|
||||
}
|
||||
export function clearWorkOrderMilestoneTypesCache() {
|
||||
function clearWorkOrderMilestoneTypesCache() {
|
||||
workOrderMilestoneTypes = undefined;
|
||||
}
|
||||
export function clearCacheByTableName(tableName) {
|
||||
switch (tableName) {
|
||||
case "LotOccupantTypes": {
|
||||
clearLotOccupantTypesCache();
|
||||
break;
|
||||
}
|
||||
case "LotStatuses": {
|
||||
clearLotStatusesCache();
|
||||
break;
|
||||
}
|
||||
case "LotTypes":
|
||||
case "LotTypeFields": {
|
||||
clearLotTypesCache();
|
||||
break;
|
||||
}
|
||||
case "OccupancyTypes":
|
||||
case "OccupancyTypeFields":
|
||||
case "OccupancyTypePrints": {
|
||||
clearOccupancyTypesCache();
|
||||
break;
|
||||
}
|
||||
case "WorkOrderMilestoneTypes": {
|
||||
clearWorkOrderMilestoneTypesCache();
|
||||
break;
|
||||
}
|
||||
case "WorkOrderTypes": {
|
||||
clearWorkOrderTypesCache();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export function getLotOccupantTypeByLotOccupantType(lotOccupantType: string) {
|
|||
});
|
||||
}
|
||||
|
||||
export function clearLotOccupantTypesCache() {
|
||||
function clearLotOccupantTypesCache() {
|
||||
lotOccupantTypes = undefined;
|
||||
}
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ export function getLotStatusByLotStatus(lotStatus: string) {
|
|||
});
|
||||
}
|
||||
|
||||
export function clearLotStatusesCache() {
|
||||
function clearLotStatusesCache() {
|
||||
lotStatuses = undefined;
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ export function getLotTypesByLotType(lotType: string) {
|
|||
});
|
||||
}
|
||||
|
||||
export function clearLotTypesCache() {
|
||||
function clearLotTypesCache() {
|
||||
lotTypes = undefined;
|
||||
}
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ export function getOccupancyTypePrintsById(occupancyTypeId: number): string[] {
|
|||
return occupancyType.occupancyTypePrints;
|
||||
}
|
||||
|
||||
export function clearOccupancyTypesCache() {
|
||||
function clearOccupancyTypesCache() {
|
||||
occupancyTypes = undefined;
|
||||
allOccupancyTypeFields = undefined;
|
||||
}
|
||||
|
|
@ -204,7 +204,7 @@ export function getWorkOrderTypeById(workOrderTypeId: number) {
|
|||
});
|
||||
}
|
||||
|
||||
export function clearWorkOrderTypesCache() {
|
||||
function clearWorkOrderTypesCache() {
|
||||
workOrderTypes = undefined;
|
||||
}
|
||||
|
||||
|
|
@ -222,9 +222,7 @@ export function getWorkOrderMilestoneTypes() {
|
|||
return workOrderMilestoneTypes;
|
||||
}
|
||||
|
||||
export function getWorkOrderMilestoneTypeByWorkOrderMilestoneTypeId(
|
||||
workOrderMilestoneTypeId: number
|
||||
) {
|
||||
export function getWorkOrderMilestoneTypeByWorkOrderMilestoneTypeId(workOrderMilestoneTypeId: number) {
|
||||
const cachedWorkOrderMilestoneTypes = getWorkOrderMilestoneTypes();
|
||||
|
||||
return cachedWorkOrderMilestoneTypes.find((currentWorkOrderMilestoneType) => {
|
||||
|
|
@ -232,9 +230,7 @@ export function getWorkOrderMilestoneTypeByWorkOrderMilestoneTypeId(
|
|||
});
|
||||
}
|
||||
|
||||
export function getWorkOrderMilestoneTypeByWorkOrderMilestoneType(
|
||||
workOrderMilestoneTypeString: string
|
||||
) {
|
||||
export function getWorkOrderMilestoneTypeByWorkOrderMilestoneType(workOrderMilestoneTypeString: string) {
|
||||
const cachedWorkOrderMilestoneTypes = getWorkOrderMilestoneTypes();
|
||||
|
||||
const workOrderMilestoneTypeLowerCase = workOrderMilestoneTypeString.toLowerCase();
|
||||
|
|
@ -247,6 +243,43 @@ export function getWorkOrderMilestoneTypeByWorkOrderMilestoneType(
|
|||
});
|
||||
}
|
||||
|
||||
export function clearWorkOrderMilestoneTypesCache() {
|
||||
function clearWorkOrderMilestoneTypesCache() {
|
||||
workOrderMilestoneTypes = undefined;
|
||||
}
|
||||
|
||||
export function clearCacheByTableName(tableName: string) {
|
||||
switch (tableName) {
|
||||
case "LotOccupantTypes": {
|
||||
clearLotOccupantTypesCache();
|
||||
break;
|
||||
}
|
||||
|
||||
case "LotStatuses": {
|
||||
clearLotStatusesCache();
|
||||
break;
|
||||
}
|
||||
|
||||
case "LotTypes":
|
||||
case "LotTypeFields": {
|
||||
clearLotTypesCache();
|
||||
break;
|
||||
}
|
||||
|
||||
case "OccupancyTypes":
|
||||
case "OccupancyTypeFields":
|
||||
case "OccupancyTypePrints": {
|
||||
clearOccupancyTypesCache();
|
||||
break;
|
||||
}
|
||||
|
||||
case "WorkOrderMilestoneTypes": {
|
||||
clearWorkOrderMilestoneTypesCache();
|
||||
break;
|
||||
}
|
||||
|
||||
case "WorkOrderTypes": {
|
||||
clearWorkOrderTypesCache();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
import type * as recordTypes from "../../types/recordTypes";
|
||||
interface AddFeeCategoryForm {
|
||||
feeCategory: string;
|
||||
orderNumber?: number;
|
||||
}
|
||||
export declare function addFeeCategory(feeCategoryForm: AddFeeCategoryForm, requestSession: recordTypes.PartialSession): number;
|
||||
export default addFeeCategory;
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
import { addRecord } from "./addRecord.js";
|
||||
export function addFeeCategory(feeCategoryForm, requestSession) {
|
||||
const feeCategoryId = addRecord("FeeCategories", feeCategoryForm.feeCategory, feeCategoryForm.orderNumber || -1, requestSession);
|
||||
return feeCategoryId;
|
||||
}
|
||||
export default addFeeCategory;
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
import { addRecord } from "./addRecord.js";
|
||||
|
||||
import type * as recordTypes from "../../types/recordTypes";
|
||||
|
||||
interface AddFeeCategoryForm {
|
||||
feeCategory: string;
|
||||
orderNumber?: number;
|
||||
}
|
||||
|
||||
export function addFeeCategory(
|
||||
feeCategoryForm: AddFeeCategoryForm,
|
||||
requestSession: recordTypes.PartialSession
|
||||
): number {
|
||||
const feeCategoryId = addRecord(
|
||||
"FeeCategories",
|
||||
feeCategoryForm.feeCategory,
|
||||
feeCategoryForm.orderNumber || -1,
|
||||
requestSession
|
||||
);
|
||||
|
||||
return feeCategoryId;
|
||||
}
|
||||
|
||||
export default addFeeCategory;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import { clearLotOccupantTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
export function addLotOccupantType(lotOccupantTypeForm, requestSession) {
|
||||
const database = sqlite(databasePath);
|
||||
const rightNowMillis = Date.now();
|
||||
|
|
@ -12,7 +12,7 @@ export function addLotOccupantType(lotOccupantTypeForm, requestSession) {
|
|||
values (?, ?, ?, ?, ?, ?, ?)`)
|
||||
.run(lotOccupantTypeForm.lotOccupantType, lotOccupantTypeForm.fontAwesomeIconClass || "", lotOccupantTypeForm.orderNumber || -1, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
||||
database.close();
|
||||
clearLotOccupantTypesCache();
|
||||
clearCacheByTableName("LotOccupantTypes");
|
||||
return result.lastInsertRowid;
|
||||
}
|
||||
export default addLotOccupantType;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import sqlite from "better-sqlite3";
|
|||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
|
||||
import type * as recordTypes from "../../types/recordTypes";
|
||||
import { clearLotOccupantTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
interface AddLotOccupantTypeForm {
|
||||
lotOccupantType: string;
|
||||
|
|
@ -39,7 +39,7 @@ export function addLotOccupantType(
|
|||
|
||||
database.close();
|
||||
|
||||
clearLotOccupantTypesCache();
|
||||
clearCacheByTableName("LotOccupantTypes");
|
||||
|
||||
return result.lastInsertRowid as number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
import type * as recordTypes from "../../types/recordTypes";
|
||||
interface AddLotStatusForm {
|
||||
lotStatus: string;
|
||||
orderNumber?: number;
|
||||
}
|
||||
export declare function addLotStatus(lotStatusForm: AddLotStatusForm, requestSession: recordTypes.PartialSession): number;
|
||||
export default addLotStatus;
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import { clearLotStatusesCache } from "../functions.cache.js";
|
||||
import { addRecord } from "./addRecord.js";
|
||||
export function addLotStatus(lotStatusForm, requestSession) {
|
||||
const lotStatusId = addRecord("LotStatuses", lotStatusForm.lotStatus, lotStatusForm.orderNumber || -1, requestSession);
|
||||
clearLotStatusesCache();
|
||||
return lotStatusId;
|
||||
}
|
||||
export default addLotStatus;
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
import { clearLotStatusesCache } from "../functions.cache.js";
|
||||
import { addRecord } from "./addRecord.js";
|
||||
|
||||
import type * as recordTypes from "../../types/recordTypes";
|
||||
|
||||
interface AddLotStatusForm {
|
||||
lotStatus: string;
|
||||
orderNumber?: number;
|
||||
}
|
||||
|
||||
export function addLotStatus(
|
||||
lotStatusForm: AddLotStatusForm,
|
||||
requestSession: recordTypes.PartialSession
|
||||
): number {
|
||||
const lotStatusId = addRecord(
|
||||
"LotStatuses",
|
||||
lotStatusForm.lotStatus,
|
||||
lotStatusForm.orderNumber || -1,
|
||||
requestSession
|
||||
);
|
||||
|
||||
clearLotStatusesCache();
|
||||
|
||||
return lotStatusId;
|
||||
}
|
||||
|
||||
export default addLotStatus;
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
import type * as recordTypes from "../../types/recordTypes";
|
||||
interface AddLotTypeForm {
|
||||
lotType: string;
|
||||
orderNumber?: number;
|
||||
}
|
||||
export declare function addLotType(lotTypeForm: AddLotTypeForm, requestSession: recordTypes.PartialSession): number;
|
||||
export default addLotType;
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import { clearLotTypesCache } from "../functions.cache.js";
|
||||
import { addRecord } from "./addRecord.js";
|
||||
export function addLotType(lotTypeForm, requestSession) {
|
||||
const lotTypeId = addRecord("LotTypes", lotTypeForm.lotType, lotTypeForm.orderNumber || -1, requestSession);
|
||||
clearLotTypesCache();
|
||||
return lotTypeId;
|
||||
}
|
||||
export default addLotType;
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
import { clearLotTypesCache } from "../functions.cache.js";
|
||||
import { addRecord } from "./addRecord.js";
|
||||
|
||||
import type * as recordTypes from "../../types/recordTypes";
|
||||
|
||||
interface AddLotTypeForm {
|
||||
lotType: string;
|
||||
orderNumber?: number;
|
||||
}
|
||||
|
||||
export function addLotType(lotTypeForm: AddLotTypeForm, requestSession: recordTypes.PartialSession): number {
|
||||
const lotTypeId = addRecord(
|
||||
"LotTypes",
|
||||
lotTypeForm.lotType,
|
||||
lotTypeForm.orderNumber || -1,
|
||||
requestSession
|
||||
);
|
||||
|
||||
clearLotTypesCache();
|
||||
|
||||
return lotTypeId;
|
||||
}
|
||||
|
||||
export default addLotType;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import { clearLotTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
export function addLotTypeField(lotTypeFieldForm, requestSession) {
|
||||
const database = sqlite(databasePath);
|
||||
const rightNowMillis = Date.now();
|
||||
|
|
@ -15,7 +15,7 @@ export function addLotTypeField(lotTypeFieldForm, requestSession) {
|
|||
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
||||
.run(lotTypeFieldForm.lotTypeId, lotTypeFieldForm.lotTypeField, lotTypeFieldForm.lotTypeFieldValues || "", lotTypeFieldForm.isRequired ? 1 : 0, lotTypeFieldForm.pattern || "", lotTypeFieldForm.minimumLength || 0, lotTypeFieldForm.maximumLength || 100, lotTypeFieldForm.orderNumber || -1, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
||||
database.close();
|
||||
clearLotTypesCache();
|
||||
clearCacheByTableName("LotTypeFields");
|
||||
return result.lastInsertRowid;
|
||||
}
|
||||
export default addLotTypeField;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@ import sqlite from "better-sqlite3";
|
|||
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
import type * as recordTypes from "../../types/recordTypes";
|
||||
import { clearLotTypesCache } from "../functions.cache.js";
|
||||
|
||||
interface AddLotTypeFieldForm {
|
||||
lotTypeId: string | number;
|
||||
|
|
@ -52,7 +53,7 @@ export function addLotTypeField(
|
|||
|
||||
database.close();
|
||||
|
||||
clearLotTypesCache();
|
||||
clearCacheByTableName("LotTypeFields");
|
||||
|
||||
return result.lastInsertRowid as number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
import type * as recordTypes from "../../types/recordTypes";
|
||||
interface AddOccupancyTypeForm {
|
||||
occupancyType: string;
|
||||
orderNumber?: number;
|
||||
}
|
||||
export declare function addOccupancyType(occupancyTypeForm: AddOccupancyTypeForm, requestSession: recordTypes.PartialSession): number;
|
||||
export default addOccupancyType;
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { addRecord } from "./addRecord.js";
|
||||
export function addOccupancyType(occupancyTypeForm, requestSession) {
|
||||
const occupancyTypeId = addRecord("OccupancyTypes", occupancyTypeForm.occupancyType, occupancyTypeForm.orderNumber || -1, requestSession);
|
||||
clearOccupancyTypesCache();
|
||||
return occupancyTypeId;
|
||||
}
|
||||
export default addOccupancyType;
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { addRecord } from "./addRecord.js";
|
||||
|
||||
import type * as recordTypes from "../../types/recordTypes";
|
||||
|
||||
interface AddOccupancyTypeForm {
|
||||
occupancyType: string;
|
||||
orderNumber?: number;
|
||||
}
|
||||
|
||||
export function addOccupancyType(
|
||||
occupancyTypeForm: AddOccupancyTypeForm,
|
||||
requestSession: recordTypes.PartialSession
|
||||
): number {
|
||||
const occupancyTypeId = addRecord(
|
||||
"OccupancyTypes",
|
||||
occupancyTypeForm.occupancyType,
|
||||
occupancyTypeForm.orderNumber || -1,
|
||||
requestSession
|
||||
);
|
||||
|
||||
clearOccupancyTypesCache();
|
||||
|
||||
return occupancyTypeId;
|
||||
}
|
||||
|
||||
export default addOccupancyType;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
export function addOccupancyTypeField(occupancyTypeFieldForm, requestSession) {
|
||||
const database = sqlite(databasePath);
|
||||
const rightNowMillis = Date.now();
|
||||
|
|
@ -15,7 +15,7 @@ export function addOccupancyTypeField(occupancyTypeFieldForm, requestSession) {
|
|||
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
||||
.run(occupancyTypeFieldForm.occupancyTypeId || undefined, occupancyTypeFieldForm.occupancyTypeField, occupancyTypeFieldForm.occupancyTypeFieldValues || "", occupancyTypeFieldForm.isRequired ? 1 : 0, occupancyTypeFieldForm.pattern || "", occupancyTypeFieldForm.minimumLength || 0, occupancyTypeFieldForm.maximumLength || 100, occupancyTypeFieldForm.orderNumber || -1, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
||||
database.close();
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypeFields");
|
||||
return result.lastInsertRowid;
|
||||
}
|
||||
export default addOccupancyTypeField;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import sqlite from "better-sqlite3";
|
|||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
|
||||
import type * as recordTypes from "../../types/recordTypes";
|
||||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
interface AddOccupancyTypeFieldForm {
|
||||
occupancyTypeId?: string | number;
|
||||
|
|
@ -52,7 +52,7 @@ export function addOccupancyTypeField(
|
|||
|
||||
database.close();
|
||||
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypeFields");
|
||||
|
||||
return result.lastInsertRowid as number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
export function addOccupancyTypePrint(occupancyTypePrintForm, requestSession) {
|
||||
const database = sqlite(databasePath);
|
||||
const rightNowMillis = Date.now();
|
||||
|
|
@ -23,7 +23,7 @@ export function addOccupancyTypePrint(occupancyTypePrintForm, requestSession) {
|
|||
.run(occupancyTypePrintForm.occupancyTypeId, occupancyTypePrintForm.printEJS, occupancyTypePrintForm.orderNumber || -1, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
||||
}
|
||||
database.close();
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypePrints");
|
||||
return result.changes > 0;
|
||||
}
|
||||
export default addOccupancyTypePrint;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import sqlite from "better-sqlite3";
|
|||
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
|
||||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
import type * as recordTypes from "../../types/recordTypes";
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ export function addOccupancyTypePrint(
|
|||
|
||||
database.close();
|
||||
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypePrints");
|
||||
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
const recordNameColumns = new Map();
|
||||
recordNameColumns.set("FeeCategories", "feeCategory");
|
||||
recordNameColumns.set("LotStatuses", "lotStatus");
|
||||
|
|
@ -18,5 +19,6 @@ export function addRecord(recordTable, recordName, orderNumber, requestSession)
|
|||
values (?, ?, ?, ?, ?, ?)`)
|
||||
.run(recordName, orderNumber, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
||||
database.close();
|
||||
clearCacheByTableName(recordTable);
|
||||
return result.lastInsertRowid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import sqlite from "better-sqlite3";
|
|||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
|
||||
import type * as recordTypes from "../../types/recordTypes";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
type RecordTable =
|
||||
| "FeeCategories"
|
||||
|
|
@ -49,5 +50,7 @@ export function addRecord(
|
|||
|
||||
database.close();
|
||||
|
||||
clearCacheByTableName(recordTable);
|
||||
|
||||
return result.lastInsertRowid as number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
import type * as recordTypes from "../../types/recordTypes";
|
||||
interface AddWorkOrderMilestoneTypeForm {
|
||||
workOrderMilestoneType: string;
|
||||
orderNumber?: number;
|
||||
}
|
||||
export declare function addWorkOrderMilestoneType(workOrderMilestoneTypeForm: AddWorkOrderMilestoneTypeForm, requestSession: recordTypes.PartialSession): number;
|
||||
export default addWorkOrderMilestoneType;
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import { clearWorkOrderMilestoneTypesCache } from "../functions.cache.js";
|
||||
import { addRecord } from "./addRecord.js";
|
||||
export function addWorkOrderMilestoneType(workOrderMilestoneTypeForm, requestSession) {
|
||||
const workOrderMilestoneId = addRecord("WorkOrderMilestoneTypes", workOrderMilestoneTypeForm.workOrderMilestoneType, workOrderMilestoneTypeForm.orderNumber || -1, requestSession);
|
||||
clearWorkOrderMilestoneTypesCache();
|
||||
return workOrderMilestoneId;
|
||||
}
|
||||
export default addWorkOrderMilestoneType;
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
import { clearWorkOrderMilestoneTypesCache } from "../functions.cache.js";
|
||||
import { addRecord } from "./addRecord.js";
|
||||
|
||||
import type * as recordTypes from "../../types/recordTypes";
|
||||
|
||||
interface AddWorkOrderMilestoneTypeForm {
|
||||
workOrderMilestoneType: string;
|
||||
orderNumber?: number;
|
||||
}
|
||||
|
||||
export function addWorkOrderMilestoneType(
|
||||
workOrderMilestoneTypeForm: AddWorkOrderMilestoneTypeForm,
|
||||
requestSession: recordTypes.PartialSession
|
||||
): number {
|
||||
const workOrderMilestoneId = addRecord(
|
||||
"WorkOrderMilestoneTypes",
|
||||
workOrderMilestoneTypeForm.workOrderMilestoneType,
|
||||
workOrderMilestoneTypeForm.orderNumber || -1,
|
||||
requestSession
|
||||
);
|
||||
|
||||
clearWorkOrderMilestoneTypesCache();
|
||||
|
||||
return workOrderMilestoneId;
|
||||
}
|
||||
|
||||
export default addWorkOrderMilestoneType;
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
import type * as recordTypes from "../../types/recordTypes";
|
||||
interface AddWorkOrderTypeForm {
|
||||
workOrderType: string;
|
||||
orderNumber?: number;
|
||||
}
|
||||
export declare function addWorkOrderType(workOrderTypeForm: AddWorkOrderTypeForm, requestSession: recordTypes.PartialSession): number;
|
||||
export default addWorkOrderType;
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import { clearWorkOrderTypesCache } from "../functions.cache.js";
|
||||
import { addRecord } from "./addRecord.js";
|
||||
export function addWorkOrderType(workOrderTypeForm, requestSession) {
|
||||
const workOrderTypeId = addRecord("WorkOrderTypes", workOrderTypeForm.workOrderType, workOrderTypeForm.orderNumber || -1, requestSession);
|
||||
clearWorkOrderTypesCache();
|
||||
return workOrderTypeId;
|
||||
}
|
||||
export default addWorkOrderType;
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
import { clearWorkOrderTypesCache } from "../functions.cache.js";
|
||||
import { addRecord } from "./addRecord.js";
|
||||
|
||||
import type * as recordTypes from "../../types/recordTypes";
|
||||
|
||||
interface AddWorkOrderTypeForm {
|
||||
workOrderType: string;
|
||||
orderNumber?: number;
|
||||
}
|
||||
|
||||
export function addWorkOrderType(
|
||||
workOrderTypeForm: AddWorkOrderTypeForm,
|
||||
requestSession: recordTypes.PartialSession
|
||||
): number {
|
||||
const workOrderTypeId = addRecord(
|
||||
"WorkOrderTypes",
|
||||
workOrderTypeForm.workOrderType,
|
||||
workOrderTypeForm.orderNumber || -1,
|
||||
requestSession
|
||||
);
|
||||
|
||||
clearWorkOrderTypesCache();
|
||||
|
||||
return workOrderTypeId;
|
||||
}
|
||||
|
||||
export default addWorkOrderType;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
export function deleteOccupancyTypePrint(occupancyTypeId, printEJS, requestSession) {
|
||||
const database = sqlite(databasePath);
|
||||
const rightNowMillis = Date.now();
|
||||
|
|
@ -12,7 +12,7 @@ export function deleteOccupancyTypePrint(occupancyTypeId, printEJS, requestSessi
|
|||
and printEJS = ?`)
|
||||
.run(requestSession.user.userName, rightNowMillis, occupancyTypeId, printEJS);
|
||||
database.close();
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypePrints");
|
||||
return result.changes > 0;
|
||||
}
|
||||
export default deleteOccupancyTypePrint;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import sqlite from "better-sqlite3";
|
|||
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
|
||||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
import type * as recordTypes from "../../types/recordTypes";
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ export function deleteOccupancyTypePrint(
|
|||
|
||||
database.close();
|
||||
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypePrints");
|
||||
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import * as cacheFunctions from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
const recordIdColumns = new Map();
|
||||
recordIdColumns.set("FeeCategories", "feeCategoryId");
|
||||
recordIdColumns.set("Fees", "feeId");
|
||||
|
|
@ -33,15 +33,6 @@ relatedTables.set("WorkOrders", [
|
|||
"WorkOrderLotOccupancies",
|
||||
"WorkOrderComments"
|
||||
]);
|
||||
const clearCacheFunctions = new Map();
|
||||
clearCacheFunctions.set("LotOccupantTypes", cacheFunctions.clearLotOccupantTypesCache);
|
||||
clearCacheFunctions.set("LotStatuses", cacheFunctions.clearLotStatusesCache);
|
||||
clearCacheFunctions.set("LotTypes", cacheFunctions.clearLotTypesCache);
|
||||
clearCacheFunctions.set("LotTypeFields", cacheFunctions.clearLotTypesCache);
|
||||
clearCacheFunctions.set("OccupancyTypes", cacheFunctions.clearOccupancyTypesCache);
|
||||
clearCacheFunctions.set("OccupancyTypeFields", cacheFunctions.clearOccupancyTypesCache);
|
||||
clearCacheFunctions.set("WorkOrderMilestoneTypes", cacheFunctions.clearWorkOrderMilestoneTypesCache);
|
||||
clearCacheFunctions.set("WorkOrderTypes", cacheFunctions.clearWorkOrderTypesCache);
|
||||
export function deleteRecord(recordTable, recordId, requestSession) {
|
||||
const database = sqlite(databasePath);
|
||||
const rightNowMillis = Date.now();
|
||||
|
|
@ -62,8 +53,6 @@ export function deleteRecord(recordTable, recordId, requestSession) {
|
|||
.run(requestSession.user.userName, rightNowMillis, recordId);
|
||||
}
|
||||
database.close();
|
||||
if (clearCacheFunctions.has(recordTable)) {
|
||||
clearCacheFunctions.get(recordTable)();
|
||||
}
|
||||
clearCacheByTableName(recordTable);
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import sqlite from "better-sqlite3";
|
|||
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
|
||||
import * as cacheFunctions from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
import type * as recordTypes from "../../types/recordTypes";
|
||||
|
||||
|
|
@ -60,16 +60,6 @@ relatedTables.set("WorkOrders", [
|
|||
"WorkOrderComments"
|
||||
]);
|
||||
|
||||
const clearCacheFunctions: Map<RecordTable, () => void> = new Map();
|
||||
clearCacheFunctions.set("LotOccupantTypes", cacheFunctions.clearLotOccupantTypesCache);
|
||||
clearCacheFunctions.set("LotStatuses", cacheFunctions.clearLotStatusesCache);
|
||||
clearCacheFunctions.set("LotTypes", cacheFunctions.clearLotTypesCache);
|
||||
clearCacheFunctions.set("LotTypeFields", cacheFunctions.clearLotTypesCache);
|
||||
clearCacheFunctions.set("OccupancyTypes", cacheFunctions.clearOccupancyTypesCache);
|
||||
clearCacheFunctions.set("OccupancyTypeFields", cacheFunctions.clearOccupancyTypesCache);
|
||||
clearCacheFunctions.set("WorkOrderMilestoneTypes", cacheFunctions.clearWorkOrderMilestoneTypesCache);
|
||||
clearCacheFunctions.set("WorkOrderTypes", cacheFunctions.clearWorkOrderTypesCache);
|
||||
|
||||
export function deleteRecord(
|
||||
recordTable: RecordTable,
|
||||
recordId: number | string,
|
||||
|
|
@ -103,9 +93,7 @@ export function deleteRecord(
|
|||
|
||||
database.close();
|
||||
|
||||
if (clearCacheFunctions.has(recordTable)) {
|
||||
clearCacheFunctions.get(recordTable)();
|
||||
}
|
||||
clearCacheByTableName(recordTable);
|
||||
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
import { clearLotOccupantTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordDown, moveRecordDownToBottom } from "./moveRecord.js";
|
||||
export function moveLotOccupantTypeDown(lotOccupantTypeId) {
|
||||
const success = moveRecordDown("LotOccupantTypes", lotOccupantTypeId);
|
||||
clearLotOccupantTypesCache();
|
||||
return success;
|
||||
}
|
||||
export function moveLotOccupantTypeDownToBottom(lotOccupantTypeId) {
|
||||
const success = moveRecordDownToBottom("LotOccupantTypes", lotOccupantTypeId);
|
||||
clearLotOccupantTypesCache();
|
||||
return success;
|
||||
}
|
||||
export default moveLotOccupantTypeDown;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
import { clearLotOccupantTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordDown, moveRecordDownToBottom } from "./moveRecord.js";
|
||||
|
||||
export function moveLotOccupantTypeDown(lotOccupantTypeId: number | string): boolean {
|
||||
const success = moveRecordDown("LotOccupantTypes", lotOccupantTypeId);
|
||||
clearLotOccupantTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
export function moveLotOccupantTypeDownToBottom(lotOccupantTypeId: number | string): boolean {
|
||||
const success = moveRecordDownToBottom("LotOccupantTypes", lotOccupantTypeId);
|
||||
clearLotOccupantTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
import { clearLotOccupantTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordUp, moveRecordUpToTop } from "./moveRecord.js";
|
||||
export function moveLotOccupantTypeUp(lotOccupantTypeId) {
|
||||
const success = moveRecordUp("LotOccupantTypes", lotOccupantTypeId);
|
||||
clearLotOccupantTypesCache();
|
||||
return success;
|
||||
}
|
||||
export function moveLotOccupantTypeUpToTop(lotOccupantTypeId) {
|
||||
const success = moveRecordUpToTop("LotOccupantTypes", lotOccupantTypeId);
|
||||
clearLotOccupantTypesCache();
|
||||
return success;
|
||||
}
|
||||
export default moveLotOccupantTypeUp;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
import { clearLotOccupantTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordUp, moveRecordUpToTop } from "./moveRecord.js";
|
||||
|
||||
export function moveLotOccupantTypeUp(lotOccupantTypeId: number | string): boolean {
|
||||
const success = moveRecordUp("LotOccupantTypes", lotOccupantTypeId);
|
||||
clearLotOccupantTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
export function moveLotOccupantTypeUpToTop(lotOccupantTypeId: number | string): boolean {
|
||||
const success = moveRecordUpToTop("LotOccupantTypes", lotOccupantTypeId);
|
||||
clearLotOccupantTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
import { clearLotStatusesCache } from "../functions.cache.js";
|
||||
import { moveRecordDown, moveRecordDownToBottom } from "./moveRecord.js";
|
||||
export function moveLotStatusDown(lotStatusId) {
|
||||
const success = moveRecordDown("LotStatuses", lotStatusId);
|
||||
clearLotStatusesCache();
|
||||
return success;
|
||||
}
|
||||
export function moveLotStatusDownToBottom(lotStatusId) {
|
||||
const success = moveRecordDownToBottom("LotStatuses", lotStatusId);
|
||||
clearLotStatusesCache();
|
||||
return success;
|
||||
}
|
||||
export default moveLotStatusDown;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
import { clearLotStatusesCache } from "../functions.cache.js";
|
||||
import { moveRecordDown, moveRecordDownToBottom } from "./moveRecord.js";
|
||||
|
||||
export function moveLotStatusDown(lotStatusId: number | string): boolean {
|
||||
const success = moveRecordDown("LotStatuses", lotStatusId);
|
||||
clearLotStatusesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
export function moveLotStatusDownToBottom(lotStatusId: number | string): boolean {
|
||||
const success = moveRecordDownToBottom("LotStatuses", lotStatusId);
|
||||
clearLotStatusesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
import { clearLotStatusesCache } from "../functions.cache.js";
|
||||
import { moveRecordUp, moveRecordUpToTop } from "./moveRecord.js";
|
||||
export function moveLotStatusUp(lotStatusId) {
|
||||
const success = moveRecordUp("LotStatuses", lotStatusId);
|
||||
clearLotStatusesCache();
|
||||
return success;
|
||||
}
|
||||
export function moveLotStatusUpToTop(lotStatusId) {
|
||||
const success = moveRecordUpToTop("LotStatuses", lotStatusId);
|
||||
clearLotStatusesCache();
|
||||
return success;
|
||||
}
|
||||
export default moveLotStatusUp;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
import { clearLotStatusesCache } from "../functions.cache.js";
|
||||
import { moveRecordUp, moveRecordUpToTop } from "./moveRecord.js";
|
||||
|
||||
export function moveLotStatusUp(lotStatusId: number | string): boolean {
|
||||
const success = moveRecordUp("LotStatuses", lotStatusId);
|
||||
clearLotStatusesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
export function moveLotStatusUpToTop(lotStatusId: number | string): boolean {
|
||||
const success = moveRecordUpToTop("LotStatuses", lotStatusId);
|
||||
clearLotStatusesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
import { clearLotTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordDown, moveRecordDownToBottom } from "./moveRecord.js";
|
||||
export function moveLotTypeDown(lotTypeId) {
|
||||
const success = moveRecordDown("LotTypes", lotTypeId);
|
||||
clearLotTypesCache();
|
||||
return success;
|
||||
}
|
||||
export function moveLotTypeDownToBottom(lotTypeId) {
|
||||
const success = moveRecordDownToBottom("LotTypes", lotTypeId);
|
||||
clearLotTypesCache();
|
||||
return success;
|
||||
}
|
||||
export default moveLotTypeDown;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
import { clearLotTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordDown, moveRecordDownToBottom } from "./moveRecord.js";
|
||||
|
||||
export function moveLotTypeDown(lotTypeId: number | string): boolean {
|
||||
const success = moveRecordDown("LotTypes", lotTypeId);
|
||||
clearLotTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
export function moveLotTypeDownToBottom(lotTypeId: number | string): boolean {
|
||||
const success = moveRecordDownToBottom("LotTypes", lotTypeId);
|
||||
clearLotTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import { clearLotTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
export function moveLotTypeFieldDown(lotTypeFieldId) {
|
||||
const database = sqlite(databasePath);
|
||||
const currentField = database
|
||||
|
|
@ -16,7 +16,7 @@ export function moveLotTypeFieldDown(lotTypeFieldId) {
|
|||
.prepare("update LotTypeFields set orderNumber = ? + 1 where lotTypeFieldId = ?")
|
||||
.run(currentField.orderNumber, lotTypeFieldId);
|
||||
database.close();
|
||||
clearLotTypesCache();
|
||||
clearCacheByTableName("LotTypeFields");
|
||||
return result.changes > 0;
|
||||
}
|
||||
export function moveLotTypeFieldDownToBottom(lotTypeFieldId) {
|
||||
|
|
@ -43,7 +43,7 @@ export function moveLotTypeFieldDownToBottom(lotTypeFieldId) {
|
|||
.run(currentField.lotTypeId, currentField.orderNumber);
|
||||
}
|
||||
database.close();
|
||||
clearLotTypesCache();
|
||||
clearCacheByTableName("LotTypeFields");
|
||||
return true;
|
||||
}
|
||||
export default moveLotTypeFieldDown;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import sqlite from "better-sqlite3";
|
|||
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
|
||||
import { clearLotTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
export function moveLotTypeFieldDown(lotTypeFieldId: number | string): boolean {
|
||||
const database = sqlite(databasePath);
|
||||
|
|
@ -26,7 +26,7 @@ export function moveLotTypeFieldDown(lotTypeFieldId: number | string): boolean {
|
|||
|
||||
database.close();
|
||||
|
||||
clearLotTypesCache();
|
||||
clearCacheByTableName("LotTypeFields");
|
||||
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
|
@ -65,7 +65,7 @@ export function moveLotTypeFieldDownToBottom(lotTypeFieldId: number | string): b
|
|||
|
||||
database.close();
|
||||
|
||||
clearLotTypesCache();
|
||||
clearCacheByTableName("LotTypeFields");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import { clearLotTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
export function moveLotTypeFieldUp(lotTypeFieldId) {
|
||||
const database = sqlite(databasePath);
|
||||
const currentField = database
|
||||
|
|
@ -21,7 +21,7 @@ export function moveLotTypeFieldUp(lotTypeFieldId) {
|
|||
.prepare("update LotTypeFields set orderNumber = ? - 1 where lotTypeFieldId = ?")
|
||||
.run(currentField.orderNumber, lotTypeFieldId);
|
||||
database.close();
|
||||
clearLotTypesCache();
|
||||
clearCacheByTableName("LotTypeFields");
|
||||
return result.changes > 0;
|
||||
}
|
||||
export function moveLotTypeFieldUpToTop(lotTypeFieldId) {
|
||||
|
|
@ -42,7 +42,7 @@ export function moveLotTypeFieldUpToTop(lotTypeFieldId) {
|
|||
.run(currentField.lotTypeId, currentField.orderNumber);
|
||||
}
|
||||
database.close();
|
||||
clearLotTypesCache();
|
||||
clearCacheByTableName("LotTypeFields");
|
||||
return true;
|
||||
}
|
||||
export default moveLotTypeFieldUp;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import sqlite from "better-sqlite3";
|
|||
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
|
||||
import { clearLotTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
export function moveLotTypeFieldUp(lotTypeFieldId: number | string): boolean {
|
||||
const database = sqlite(databasePath);
|
||||
|
|
@ -32,7 +32,7 @@ export function moveLotTypeFieldUp(lotTypeFieldId: number | string): boolean {
|
|||
|
||||
database.close();
|
||||
|
||||
clearLotTypesCache();
|
||||
clearCacheByTableName("LotTypeFields");
|
||||
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ export function moveLotTypeFieldUpToTop(lotTypeFieldId: number | string): boolea
|
|||
|
||||
database.close();
|
||||
|
||||
clearLotTypesCache();
|
||||
clearCacheByTableName("LotTypeFields");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
import { clearLotTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordUp, moveRecordUpToTop } from "./moveRecord.js";
|
||||
export function moveLotTypeUp(lotTypeId) {
|
||||
const success = moveRecordUp("LotTypes", lotTypeId);
|
||||
clearLotTypesCache();
|
||||
return success;
|
||||
}
|
||||
export function moveLotTypeUpToTop(lotTypeId) {
|
||||
const success = moveRecordUpToTop("LotTypes", lotTypeId);
|
||||
clearLotTypesCache();
|
||||
return success;
|
||||
}
|
||||
export default moveLotTypeUp;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
import { clearLotTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordUp, moveRecordUpToTop } from "./moveRecord.js";
|
||||
|
||||
export function moveLotTypeUp(lotTypeId: number | string): boolean {
|
||||
const success = moveRecordUp("LotTypes", lotTypeId);
|
||||
clearLotTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
export function moveLotTypeUpToTop(lotTypeId: number | string): boolean {
|
||||
const success = moveRecordUpToTop("LotTypes", lotTypeId);
|
||||
clearLotTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordDown, moveRecordDownToBottom } from "./moveRecord.js";
|
||||
export function moveOccupancyTypeDown(occupancyTypeId) {
|
||||
const success = moveRecordDown("OccupancyTypes", occupancyTypeId);
|
||||
clearOccupancyTypesCache();
|
||||
return success;
|
||||
}
|
||||
export function moveOccupancyTypeDownToBottom(occupancyTypeId) {
|
||||
const success = moveRecordDownToBottom("OccupancyTypes", occupancyTypeId);
|
||||
clearOccupancyTypesCache();
|
||||
return success;
|
||||
}
|
||||
export default moveOccupancyTypeDown;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordDown, moveRecordDownToBottom } from "./moveRecord.js";
|
||||
|
||||
export function moveOccupancyTypeDown(occupancyTypeId: number | string): boolean {
|
||||
const success = moveRecordDown("OccupancyTypes", occupancyTypeId);
|
||||
clearOccupancyTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
export function moveOccupancyTypeDownToBottom(occupancyTypeId: number | string): boolean {
|
||||
const success = moveRecordDownToBottom("OccupancyTypes", occupancyTypeId);
|
||||
clearOccupancyTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
export function moveOccupancyTypeFieldDown(occupancyTypeFieldId) {
|
||||
const database = sqlite(databasePath);
|
||||
const currentField = database
|
||||
|
|
@ -19,7 +19,7 @@ export function moveOccupancyTypeFieldDown(occupancyTypeFieldId) {
|
|||
.prepare(`update OccupancyTypeFields set orderNumber = ? + 1 where occupancyTypeFieldId = ?`)
|
||||
.run(currentField.orderNumber, occupancyTypeFieldId);
|
||||
database.close();
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypeFields");
|
||||
return result.changes > 0;
|
||||
}
|
||||
export function moveOccupancyTypeFieldDownToBottom(occupancyTypeFieldId) {
|
||||
|
|
@ -57,7 +57,7 @@ export function moveOccupancyTypeFieldDownToBottom(occupancyTypeFieldId) {
|
|||
.run(occupancyTypeParameters);
|
||||
}
|
||||
database.close();
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypeFields");
|
||||
return true;
|
||||
}
|
||||
export default moveOccupancyTypeFieldDown;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import sqlite from "better-sqlite3";
|
|||
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
|
||||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
export function moveOccupancyTypeFieldDown(occupancyTypeFieldId: number | string): boolean {
|
||||
const database = sqlite(databasePath);
|
||||
|
|
@ -33,7 +33,7 @@ export function moveOccupancyTypeFieldDown(occupancyTypeFieldId: number | string
|
|||
|
||||
database.close();
|
||||
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypeFields");
|
||||
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ export function moveOccupancyTypeFieldDownToBottom(occupancyTypeFieldId: number
|
|||
|
||||
database.close();
|
||||
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypeFields");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
export function moveOccupancyTypeFieldUp(occupancyTypeFieldId) {
|
||||
const database = sqlite(databasePath);
|
||||
const currentField = database
|
||||
|
|
@ -23,7 +23,7 @@ export function moveOccupancyTypeFieldUp(occupancyTypeFieldId) {
|
|||
.prepare(`update OccupancyTypeFields set orderNumber = ? - 1 where occupancyTypeFieldId = ?`)
|
||||
.run(currentField.orderNumber, occupancyTypeFieldId);
|
||||
database.close();
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypeFields");
|
||||
return result.changes > 0;
|
||||
}
|
||||
export function moveOccupancyTypeFieldUpToTop(occupancyTypeFieldId) {
|
||||
|
|
@ -51,7 +51,7 @@ export function moveOccupancyTypeFieldUpToTop(occupancyTypeFieldId) {
|
|||
.run(occupancyTypeParameters);
|
||||
}
|
||||
database.close();
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypeFields");
|
||||
return true;
|
||||
}
|
||||
export default moveOccupancyTypeFieldUp;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import sqlite from "better-sqlite3";
|
|||
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
|
||||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
export function moveOccupancyTypeFieldUp(occupancyTypeFieldId: number | string): boolean {
|
||||
const database = sqlite(databasePath);
|
||||
|
|
@ -38,7 +38,7 @@ export function moveOccupancyTypeFieldUp(occupancyTypeFieldId: number | string):
|
|||
|
||||
database.close();
|
||||
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypeFields");
|
||||
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
|
@ -82,7 +82,7 @@ export function moveOccupancyTypeFieldUpToTop(occupancyTypeFieldId: number | str
|
|||
|
||||
database.close();
|
||||
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypeFields");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
export function moveOccupancyTypePrintDown(occupancyTypeId, printEJS) {
|
||||
const database = sqlite(databasePath);
|
||||
const currentOrderNumber = database
|
||||
|
|
@ -17,7 +17,7 @@ export function moveOccupancyTypePrintDown(occupancyTypeId, printEJS) {
|
|||
.prepare(`update OccupancyTypePrints set orderNumber = ? + 1 where occupancyTypeId = ? and printEJS = ?`)
|
||||
.run(currentOrderNumber, occupancyTypeId, printEJS);
|
||||
database.close();
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypePrints");
|
||||
return result.changes > 0;
|
||||
}
|
||||
export function moveOccupancyTypePrintDownToBottom(occupancyTypeId, printEJS) {
|
||||
|
|
@ -47,7 +47,7 @@ export function moveOccupancyTypePrintDownToBottom(occupancyTypeId, printEJS) {
|
|||
.run(occupancyTypeId, currentOrderNumber);
|
||||
}
|
||||
database.close();
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypePrints");
|
||||
return true;
|
||||
}
|
||||
export default moveOccupancyTypePrintDown;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import sqlite from "better-sqlite3";
|
|||
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
|
||||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
export function moveOccupancyTypePrintDown(
|
||||
occupancyTypeId: number | string,
|
||||
|
|
@ -34,7 +34,7 @@ export function moveOccupancyTypePrintDown(
|
|||
|
||||
database.close();
|
||||
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypePrints");
|
||||
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ export function moveOccupancyTypePrintDownToBottom(
|
|||
|
||||
database.close();
|
||||
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypePrints");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
export function moveOccupancyTypePrintUp(occupancyTypeId, printEJS) {
|
||||
const database = sqlite(databasePath);
|
||||
const currentOrderNumber = database
|
||||
|
|
@ -21,7 +21,7 @@ export function moveOccupancyTypePrintUp(occupancyTypeId, printEJS) {
|
|||
.prepare(`update OccupancyTypePrints set orderNumber = ? - 1 where occupancyTypeId = ? and printEJS = ?`)
|
||||
.run(currentOrderNumber, occupancyTypeId, printEJS);
|
||||
database.close();
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypePrints");
|
||||
return result.changes > 0;
|
||||
}
|
||||
export function moveOccupancyTypePrintUpToTop(occupancyTypeId, printEJS) {
|
||||
|
|
@ -45,7 +45,7 @@ export function moveOccupancyTypePrintUpToTop(occupancyTypeId, printEJS) {
|
|||
.run(occupancyTypeId, currentOrderNumber);
|
||||
}
|
||||
database.close();
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypePrints");
|
||||
return true;
|
||||
}
|
||||
export default moveOccupancyTypePrintUp;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import sqlite from "better-sqlite3";
|
|||
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
|
||||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
export function moveOccupancyTypePrintUp(
|
||||
occupancyTypeId: number | string,
|
||||
|
|
@ -39,7 +39,7 @@ export function moveOccupancyTypePrintUp(
|
|||
|
||||
database.close();
|
||||
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypePrints");
|
||||
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
|
@ -79,7 +79,7 @@ export function moveOccupancyTypePrintUpToTop(
|
|||
|
||||
database.close();
|
||||
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypePrints");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordUp, moveRecordUpToTop } from "./moveRecord.js";
|
||||
export function moveOccupancyTypeUp(occupancyTypeId) {
|
||||
const success = moveRecordUp("OccupancyTypes", occupancyTypeId);
|
||||
clearOccupancyTypesCache();
|
||||
return success;
|
||||
}
|
||||
export function moveOccupancyTypeUpToTop(occupancyTypeId) {
|
||||
const success = moveRecordUpToTop("OccupancyTypes", occupancyTypeId);
|
||||
clearOccupancyTypesCache();
|
||||
return success;
|
||||
}
|
||||
export default moveOccupancyTypeUp;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordUp, moveRecordUpToTop } from "./moveRecord.js";
|
||||
|
||||
export function moveOccupancyTypeUp(occupancyTypeId: number | string): boolean {
|
||||
const success = moveRecordUp("OccupancyTypes", occupancyTypeId);
|
||||
clearOccupancyTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
export function moveOccupancyTypeUpToTop(occupancyTypeId: number | string): boolean {
|
||||
const success = moveRecordUpToTop("OccupancyTypes", occupancyTypeId);
|
||||
clearOccupancyTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
const recordIdColumns = new Map();
|
||||
recordIdColumns.set("FeeCategories", "feeCategoryId");
|
||||
recordIdColumns.set("LotOccupantTypes", "lotOccupantTypeId");
|
||||
|
|
@ -31,6 +32,7 @@ export function moveRecordDown(recordTable, recordId) {
|
|||
where ${recordIdColumns.get(recordTable)} = ?`)
|
||||
.run(currentOrderNumber, recordId);
|
||||
database.close();
|
||||
clearCacheByTableName(recordTable);
|
||||
return result.changes > 0;
|
||||
}
|
||||
export function moveRecordDownToBottom(recordTable, recordId) {
|
||||
|
|
@ -53,6 +55,7 @@ export function moveRecordDownToBottom(recordTable, recordId) {
|
|||
.run(currentOrderNumber);
|
||||
}
|
||||
database.close();
|
||||
clearCacheByTableName(recordTable);
|
||||
return true;
|
||||
}
|
||||
export function moveRecordUp(recordTable, recordId) {
|
||||
|
|
@ -74,6 +77,7 @@ export function moveRecordUp(recordTable, recordId) {
|
|||
where ${recordIdColumns.get(recordTable)} = ?`)
|
||||
.run(currentOrderNumber, recordId);
|
||||
database.close();
|
||||
clearCacheByTableName(recordTable);
|
||||
return result.changes > 0;
|
||||
}
|
||||
export function moveRecordUpToTop(recordTable, recordId) {
|
||||
|
|
@ -91,5 +95,6 @@ export function moveRecordUpToTop(recordTable, recordId) {
|
|||
.run(currentOrderNumber);
|
||||
}
|
||||
database.close();
|
||||
clearCacheByTableName(recordTable);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
type RecordTable =
|
||||
| "FeeCategories"
|
||||
|
|
@ -60,6 +61,8 @@ export function moveRecordDown(recordTable: RecordTable, recordId: number | stri
|
|||
|
||||
database.close();
|
||||
|
||||
clearCacheByTableName(recordTable);
|
||||
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
||||
|
|
@ -95,6 +98,8 @@ export function moveRecordDownToBottom(recordTable: RecordTable, recordId: numbe
|
|||
|
||||
database.close();
|
||||
|
||||
clearCacheByTableName(recordTable);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -127,6 +132,8 @@ export function moveRecordUp(recordTable: RecordTable, recordId: number | string
|
|||
|
||||
database.close();
|
||||
|
||||
clearCacheByTableName(recordTable);
|
||||
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
||||
|
|
@ -154,5 +161,7 @@ export function moveRecordUpToTop(recordTable: RecordTable, recordId: number | s
|
|||
|
||||
database.close();
|
||||
|
||||
clearCacheByTableName(recordTable);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
import { clearWorkOrderMilestoneTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordDown, moveRecordDownToBottom } from "./moveRecord.js";
|
||||
export function moveWorkOrderMilestoneTypeDown(workOrderMilestoneTypeId) {
|
||||
const success = moveRecordDown("WorkOrderMilestoneTypes", workOrderMilestoneTypeId);
|
||||
clearWorkOrderMilestoneTypesCache();
|
||||
return success;
|
||||
}
|
||||
export function moveWorkOrderMilestoneTypeDownToBottom(workOrderMilestoneTypeId) {
|
||||
const success = moveRecordDownToBottom("WorkOrderMilestoneTypes", workOrderMilestoneTypeId);
|
||||
clearWorkOrderMilestoneTypesCache();
|
||||
return success;
|
||||
}
|
||||
export default moveWorkOrderMilestoneTypeDown;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
import { clearWorkOrderMilestoneTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordDown, moveRecordDownToBottom } from "./moveRecord.js";
|
||||
|
||||
export function moveWorkOrderMilestoneTypeDown(workOrderMilestoneTypeId: number | string): boolean {
|
||||
const success = moveRecordDown("WorkOrderMilestoneTypes", workOrderMilestoneTypeId);
|
||||
clearWorkOrderMilestoneTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
export function moveWorkOrderMilestoneTypeDownToBottom(workOrderMilestoneTypeId: number | string): boolean {
|
||||
const success = moveRecordDownToBottom("WorkOrderMilestoneTypes", workOrderMilestoneTypeId);
|
||||
clearWorkOrderMilestoneTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
import { clearWorkOrderMilestoneTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordUp, moveRecordUpToTop } from "./moveRecord.js";
|
||||
export function moveWorkOrderMilestoneTypeUp(workOrderMilestoneTypeId) {
|
||||
const success = moveRecordUp("WorkOrderMilestoneTypes", workOrderMilestoneTypeId);
|
||||
clearWorkOrderMilestoneTypesCache();
|
||||
return success;
|
||||
}
|
||||
export function moveWorkOrderMilestoneTypeUpToTop(workOrderMilestoneTypeId) {
|
||||
const success = moveRecordUpToTop("WorkOrderMilestoneTypes", workOrderMilestoneTypeId);
|
||||
clearWorkOrderMilestoneTypesCache();
|
||||
return success;
|
||||
}
|
||||
export default moveWorkOrderMilestoneTypeUp;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
import { clearWorkOrderMilestoneTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordUp, moveRecordUpToTop } from "./moveRecord.js";
|
||||
|
||||
export function moveWorkOrderMilestoneTypeUp(workOrderMilestoneTypeId: number | string): boolean {
|
||||
const success = moveRecordUp("WorkOrderMilestoneTypes", workOrderMilestoneTypeId);
|
||||
clearWorkOrderMilestoneTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
export function moveWorkOrderMilestoneTypeUpToTop(workOrderMilestoneTypeId: number | string): boolean {
|
||||
const success = moveRecordUpToTop("WorkOrderMilestoneTypes", workOrderMilestoneTypeId);
|
||||
clearWorkOrderMilestoneTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
import { clearWorkOrderTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordDown, moveRecordDownToBottom } from "./moveRecord.js";
|
||||
export function moveWorkOrderTypeDown(workOrderTypeId) {
|
||||
const success = moveRecordDown("WorkOrderTypes", workOrderTypeId);
|
||||
clearWorkOrderTypesCache();
|
||||
return success;
|
||||
}
|
||||
export function moveWorkOrderTypeDownToBottom(workOrderTypeId) {
|
||||
const success = moveRecordDownToBottom("WorkOrderTypes", workOrderTypeId);
|
||||
clearWorkOrderTypesCache();
|
||||
return success;
|
||||
}
|
||||
export default moveWorkOrderTypeDown;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
import { clearWorkOrderTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordDown, moveRecordDownToBottom } from "./moveRecord.js";
|
||||
|
||||
export function moveWorkOrderTypeDown(workOrderTypeId: number | string): boolean {
|
||||
const success = moveRecordDown("WorkOrderTypes", workOrderTypeId);
|
||||
clearWorkOrderTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
export function moveWorkOrderTypeDownToBottom(workOrderTypeId: number | string): boolean {
|
||||
const success = moveRecordDownToBottom("WorkOrderTypes", workOrderTypeId);
|
||||
clearWorkOrderTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
import { clearWorkOrderTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordUp, moveRecordUpToTop } from "./moveRecord.js";
|
||||
export function moveWorkOrderTypeUp(workOrderTypeId) {
|
||||
const success = moveRecordUp("WorkOrderTypes", workOrderTypeId);
|
||||
clearWorkOrderTypesCache();
|
||||
return success;
|
||||
}
|
||||
export function moveWorkOrderTypeUpToTop(workOrderTypeId) {
|
||||
const success = moveRecordUpToTop("WorkOrderTypes", workOrderTypeId);
|
||||
clearWorkOrderTypesCache();
|
||||
return success;
|
||||
}
|
||||
export default moveWorkOrderTypeUp;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
import { clearWorkOrderTypesCache } from "../functions.cache.js";
|
||||
import { moveRecordUp, moveRecordUpToTop } from "./moveRecord.js";
|
||||
|
||||
export function moveWorkOrderTypeUp(workOrderTypeId: number | string): boolean {
|
||||
const success = moveRecordUp("WorkOrderTypes", workOrderTypeId);
|
||||
clearWorkOrderTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
export function moveWorkOrderTypeUpToTop(workOrderTypeId: number | string): boolean {
|
||||
const success = moveRecordUpToTop("WorkOrderTypes", workOrderTypeId);
|
||||
clearWorkOrderTypesCache();
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import { clearLotOccupantTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
export function updateLotOccupantType(lotOccupantTypeForm, requestSession) {
|
||||
const database = sqlite(databasePath);
|
||||
const rightNowMillis = Date.now();
|
||||
|
|
@ -14,7 +14,7 @@ export function updateLotOccupantType(lotOccupantTypeForm, requestSession) {
|
|||
and recordDelete_timeMillis is null`)
|
||||
.run(lotOccupantTypeForm.lotOccupantType, lotOccupantTypeForm.fontAwesomeIconClass || "", requestSession.user.userName, rightNowMillis, lotOccupantTypeForm.lotOccupantTypeId);
|
||||
database.close();
|
||||
clearLotOccupantTypesCache();
|
||||
clearCacheByTableName("LotOccupantTypes");
|
||||
return result.changes > 0;
|
||||
}
|
||||
export default updateLotOccupantType;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import sqlite from "better-sqlite3";
|
|||
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
|
||||
import { clearLotOccupantTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
import type * as recordTypes from "../../types/recordTypes";
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ export function updateLotOccupantType(
|
|||
|
||||
database.close();
|
||||
|
||||
clearLotOccupantTypesCache();
|
||||
clearCacheByTableName("LotOccupantTypes");
|
||||
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import { clearLotTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
export function updateLotTypeField(lotTypeFieldForm, requestSession) {
|
||||
const database = sqlite(databasePath);
|
||||
const rightNowMillis = Date.now();
|
||||
|
|
@ -18,7 +18,7 @@ export function updateLotTypeField(lotTypeFieldForm, requestSession) {
|
|||
and recordDelete_timeMillis is null`)
|
||||
.run(lotTypeFieldForm.lotTypeField, Number.parseInt(lotTypeFieldForm.isRequired, 10), lotTypeFieldForm.minimumLength || 0, lotTypeFieldForm.maximumLength || 100, lotTypeFieldForm.pattern || "", lotTypeFieldForm.lotTypeFieldValues, requestSession.user.userName, rightNowMillis, lotTypeFieldForm.lotTypeFieldId);
|
||||
database.close();
|
||||
clearLotTypesCache();
|
||||
clearCacheByTableName("LotTypeFields");
|
||||
return result.changes > 0;
|
||||
}
|
||||
export default updateLotTypeField;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import sqlite from "better-sqlite3";
|
|||
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
|
||||
import { clearLotTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
import type * as recordTypes from "../../types/recordTypes";
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ export function updateLotTypeField(
|
|||
|
||||
database.close();
|
||||
|
||||
clearLotTypesCache();
|
||||
clearCacheByTableName("LotTypeFields");
|
||||
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
export function updateOccupancyTypeField(occupancyTypeFieldForm, requestSession) {
|
||||
const database = sqlite(databasePath);
|
||||
const rightNowMillis = Date.now();
|
||||
|
|
@ -18,7 +18,7 @@ export function updateOccupancyTypeField(occupancyTypeFieldForm, requestSession)
|
|||
and recordDelete_timeMillis is null`)
|
||||
.run(occupancyTypeFieldForm.occupancyTypeField, Number.parseInt(occupancyTypeFieldForm.isRequired, 10), occupancyTypeFieldForm.minimumLength || 0, occupancyTypeFieldForm.maximumLength || 100, occupancyTypeFieldForm.pattern || "", occupancyTypeFieldForm.occupancyTypeFieldValues, requestSession.user.userName, rightNowMillis, occupancyTypeFieldForm.occupancyTypeFieldId);
|
||||
database.close();
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypeFields");
|
||||
return result.changes > 0;
|
||||
}
|
||||
export default updateOccupancyTypeField;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import sqlite from "better-sqlite3";
|
|||
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
|
||||
import { clearOccupancyTypesCache } from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
import type * as recordTypes from "../../types/recordTypes";
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ export function updateOccupancyTypeField(
|
|||
|
||||
database.close();
|
||||
|
||||
clearOccupancyTypesCache();
|
||||
clearCacheByTableName("OccupancyTypeFields");
|
||||
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import type * as recordTypes from "../../types/recordTypes";
|
||||
declare type RecordTable = "FeeCategories" | "LotStatuses" | "LotTypes" | "OccupancyTypes" | "WorkOrderMilestoneTypes" | "WorkOrderTypes";
|
||||
export declare const clearCacheFunctions: Map<RecordTable, () => void>;
|
||||
export declare function updateRecord(recordTable: RecordTable, recordId: number | string, recordName: string, requestSession: recordTypes.PartialSession): boolean;
|
||||
export {};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import sqlite from "better-sqlite3";
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
import * as cacheFunctions from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
const recordNameIdColumns = new Map();
|
||||
recordNameIdColumns.set("FeeCategories", ["feeCategory", "feeCategoryId"]);
|
||||
recordNameIdColumns.set("LotStatuses", ["lotStatus", "lotStatusId"]);
|
||||
|
|
@ -8,12 +8,6 @@ recordNameIdColumns.set("LotTypes", ["lotType", "lotTypeId"]);
|
|||
recordNameIdColumns.set("OccupancyTypes", ["occupancyType", "occupancyTypeId"]);
|
||||
recordNameIdColumns.set("WorkOrderMilestoneTypes", ["workOrderMilestoneType", "workOrderMilestoneTypeId"]);
|
||||
recordNameIdColumns.set("WorkOrderTypes", ["workOrderType", "workOrderTypeId"]);
|
||||
export const clearCacheFunctions = new Map();
|
||||
clearCacheFunctions.set("LotStatuses", cacheFunctions.clearLotStatusesCache);
|
||||
clearCacheFunctions.set("LotTypes", cacheFunctions.clearLotTypesCache);
|
||||
clearCacheFunctions.set("OccupancyTypes", cacheFunctions.clearOccupancyTypesCache);
|
||||
clearCacheFunctions.set("WorkOrderMilestoneTypes", cacheFunctions.clearWorkOrderMilestoneTypesCache);
|
||||
clearCacheFunctions.set("WorkOrderTypes", cacheFunctions.clearWorkOrderTypesCache);
|
||||
export function updateRecord(recordTable, recordId, recordName, requestSession) {
|
||||
const database = sqlite(databasePath);
|
||||
const rightNowMillis = Date.now();
|
||||
|
|
@ -26,8 +20,6 @@ export function updateRecord(recordTable, recordId, recordName, requestSession)
|
|||
and ${recordNameIdColumns.get(recordTable)[1]} = ?`)
|
||||
.run(recordName, requestSession.user.userName, rightNowMillis, recordId);
|
||||
database.close();
|
||||
if (clearCacheFunctions.has(recordTable)) {
|
||||
clearCacheFunctions.get(recordTable)();
|
||||
}
|
||||
clearCacheByTableName(recordTable);
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import sqlite from "better-sqlite3";
|
|||
|
||||
import { lotOccupancyDB as databasePath } from "../../data/databasePaths.js";
|
||||
|
||||
import * as cacheFunctions from "../functions.cache.js";
|
||||
import { clearCacheByTableName } from "../functions.cache.js";
|
||||
|
||||
import type * as recordTypes from "../../types/recordTypes";
|
||||
|
||||
|
|
@ -22,13 +22,6 @@ recordNameIdColumns.set("OccupancyTypes", ["occupancyType", "occupancyTypeId"]);
|
|||
recordNameIdColumns.set("WorkOrderMilestoneTypes", ["workOrderMilestoneType", "workOrderMilestoneTypeId"]);
|
||||
recordNameIdColumns.set("WorkOrderTypes", ["workOrderType", "workOrderTypeId"]);
|
||||
|
||||
export const clearCacheFunctions: Map<RecordTable, () => void> = new Map();
|
||||
clearCacheFunctions.set("LotStatuses", cacheFunctions.clearLotStatusesCache);
|
||||
clearCacheFunctions.set("LotTypes", cacheFunctions.clearLotTypesCache);
|
||||
clearCacheFunctions.set("OccupancyTypes", cacheFunctions.clearOccupancyTypesCache);
|
||||
clearCacheFunctions.set("WorkOrderMilestoneTypes", cacheFunctions.clearWorkOrderMilestoneTypesCache);
|
||||
clearCacheFunctions.set("WorkOrderTypes", cacheFunctions.clearWorkOrderTypesCache);
|
||||
|
||||
export function updateRecord(
|
||||
recordTable: RecordTable,
|
||||
recordId: number | string,
|
||||
|
|
@ -52,9 +45,7 @@ export function updateRecord(
|
|||
|
||||
database.close();
|
||||
|
||||
if (clearCacheFunctions.has(recordTable)) {
|
||||
clearCacheFunctions.get(recordTable)();
|
||||
}
|
||||
clearCacheByTableName(recordTable);
|
||||
|
||||
return result.changes > 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue