diff --git a/database/addLotOccupancy.ts b/database/addLotOccupancy.ts index 76e88594..dfb7e054 100644 --- a/database/addLotOccupancy.ts +++ b/database/addLotOccupancy.ts @@ -38,7 +38,7 @@ export default async function addLotOccupancy( const rightNowMillis = Date.now() const occupancyStartDate = dateTimeFunctions.dateStringToInteger( - lotOccupancyForm.occupancyStartDateString + lotOccupancyForm.occupancyStartDateString as dateTimeFunctions.DateString ) if (occupancyStartDate <= 0) { @@ -61,7 +61,7 @@ export default async function addLotOccupancy( lotOccupancyForm.occupancyEndDateString === '' ? undefined : dateTimeFunctions.dateStringToInteger( - lotOccupancyForm.occupancyEndDateString + lotOccupancyForm.occupancyEndDateString as dateTimeFunctions.DateString ), user.userName, rightNowMillis, diff --git a/database/addLotOccupancyComment.ts b/database/addLotOccupancyComment.ts index d5d43ad5..8503fd33 100644 --- a/database/addLotOccupancyComment.ts +++ b/database/addLotOccupancyComment.ts @@ -1,4 +1,6 @@ import { + type DateString, + type TimeString, dateStringToInteger, dateToInteger, dateToTimeInteger, @@ -21,14 +23,14 @@ export default async function addLotOccupancyComment( const rightNow = new Date() let lotOccupancyCommentDate: number - let lotOccupancyCommentTime: number + let lotOccupancyCommentTime: number | undefined if (commentForm.lotOccupancyCommentDateString) { lotOccupancyCommentDate = dateStringToInteger( - commentForm.lotOccupancyCommentDateString + commentForm.lotOccupancyCommentDateString as DateString ) lotOccupancyCommentTime = timeStringToInteger( - commentForm.lotOccupancyCommentTimeString ?? '' + (commentForm.lotOccupancyCommentTimeString as TimeString) ?? '' ) } else { lotOccupancyCommentDate = dateToInteger(rightNow) diff --git a/database/getFees.js b/database/getFees.js index bd4351c2..1b3f5823 100644 --- a/database/getFees.js +++ b/database/getFees.js @@ -15,7 +15,7 @@ export async function getFees(feeCategoryId, additionalFilters, connectedDatabas sqlParameters.push(additionalFilters.lotTypeId); } const fees = database - .prepare(`select f.feeId, + .prepare(`select f.feeId, f.feeCategoryId, f.feeName, f.feeDescription, f.feeAccount, f.occupancyTypeId, o.occupancyType, f.lotTypeId, l.lotType, diff --git a/database/getFees.ts b/database/getFees.ts index 7edbee0d..6b16c492 100644 --- a/database/getFees.ts +++ b/database/getFees.ts @@ -41,7 +41,7 @@ export async function getFees( const fees = database .prepare( - `select f.feeId, + `select f.feeId, f.feeCategoryId, f.feeName, f.feeDescription, f.feeAccount, f.occupancyTypeId, o.occupancyType, f.lotTypeId, l.lotType, diff --git a/database/moveFee.js b/database/moveFee.js index 8bba8862..202a35cd 100644 --- a/database/moveFee.js +++ b/database/moveFee.js @@ -3,7 +3,7 @@ import { acquireConnection } from './pool.js'; import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'; export async function moveFeeDown(feeId) { const database = await acquireConnection(); - const currentFee = await getFee(feeId, database); + const currentFee = (await getFee(feeId, database)); database .prepare(`update Fees set orderNumber = orderNumber - 1 @@ -17,7 +17,7 @@ export async function moveFeeDown(feeId) { } export async function moveFeeDownToBottom(feeId) { const database = await acquireConnection(); - const currentFee = await getFee(feeId, database); + const currentFee = (await getFee(feeId, database)); const maxOrderNumber = database .prepare(`select max(orderNumber) as maxOrderNumber from Fees @@ -38,7 +38,7 @@ export async function moveFeeDownToBottom(feeId) { } export async function moveFeeUp(feeId) { const database = await acquireConnection(); - const currentFee = await getFee(feeId, database); + const currentFee = (await getFee(feeId, database)); if (currentFee.orderNumber <= 0) { database.release(); return true; diff --git a/database/moveFee.ts b/database/moveFee.ts index 6deef10d..452bb4ca 100644 --- a/database/moveFee.ts +++ b/database/moveFee.ts @@ -7,7 +7,7 @@ import { updateRecordOrderNumber } from './updateRecordOrderNumber.js' export async function moveFeeDown(feeId: number | string): Promise { const database = await acquireConnection() - const currentFee = await getFee(feeId, database) + const currentFee = (await getFee(feeId, database)) as Fee database .prepare( @@ -22,7 +22,7 @@ export async function moveFeeDown(feeId: number | string): Promise { const success = updateRecordOrderNumber( 'Fees', feeId, - currentFee.orderNumber! + 1, + currentFee.orderNumber + 1, database ) @@ -36,7 +36,7 @@ export async function moveFeeDownToBottom( ): Promise { const database = await acquireConnection() - const currentFee = await getFee(feeId, database) + const currentFee = (await getFee(feeId, database)) as Fee const maxOrderNumber = ( database @@ -70,9 +70,9 @@ export async function moveFeeDownToBottom( export async function moveFeeUp(feeId: number): Promise { const database = await acquireConnection() - const currentFee = await getFee(feeId, database) + const currentFee = (await getFee(feeId, database)) as Fee - if (currentFee.orderNumber! <= 0) { + if (currentFee.orderNumber <= 0) { database.release() return true } @@ -90,7 +90,7 @@ export async function moveFeeUp(feeId: number): Promise { const success = updateRecordOrderNumber( 'Fees', feeId, - currentFee.orderNumber! - 1, + currentFee.orderNumber - 1, database ) @@ -104,7 +104,7 @@ export async function moveFeeUpToTop(feeId: number | string): Promise { const currentFee = (await getFee(feeId, database)) as Fee - if (currentFee.orderNumber! > 0) { + if (currentFee.orderNumber > 0) { updateRecordOrderNumber('Fees', feeId, -1, database) database diff --git a/types/recordTypes.d.ts b/types/recordTypes.d.ts index 315ad57f..32eb009a 100644 --- a/types/recordTypes.d.ts +++ b/types/recordTypes.d.ts @@ -114,7 +114,7 @@ export interface FeeCategory extends Record { } export interface Fee extends Record { feeId: number; - feeCategoryId?: number; + feeCategoryId: number; feeCategory?: string; feeName?: string; feeDescription?: string; @@ -130,7 +130,7 @@ export interface Fee extends Record { taxAmount?: number; taxPercentage?: number; isRequired?: boolean; - orderNumber?: number; + orderNumber: number; lotOccupancyFeeCount?: number; } export interface LotOccupancyFee extends Fee, Record { diff --git a/types/recordTypes.ts b/types/recordTypes.ts index e0b43622..94191da2 100644 --- a/types/recordTypes.ts +++ b/types/recordTypes.ts @@ -149,7 +149,7 @@ export interface FeeCategory extends Record { export interface Fee extends Record { feeId: number - feeCategoryId?: number + feeCategoryId: number feeCategory?: string feeName?: string @@ -173,7 +173,7 @@ export interface Fee extends Record { isRequired?: boolean - orderNumber?: number + orderNumber: number lotOccupancyFeeCount?: number }