type linting

deepsource-autofix-76c6eb20
Dan Gowans 2024-06-24 10:18:40 -04:00
parent 3eeea38b30
commit 5a9074eb20
8 changed files with 23 additions and 21 deletions

View File

@ -38,7 +38,7 @@ export default async function addLotOccupancy(
const rightNowMillis = Date.now() const rightNowMillis = Date.now()
const occupancyStartDate = dateTimeFunctions.dateStringToInteger( const occupancyStartDate = dateTimeFunctions.dateStringToInteger(
lotOccupancyForm.occupancyStartDateString lotOccupancyForm.occupancyStartDateString as dateTimeFunctions.DateString
) )
if (occupancyStartDate <= 0) { if (occupancyStartDate <= 0) {
@ -61,7 +61,7 @@ export default async function addLotOccupancy(
lotOccupancyForm.occupancyEndDateString === '' lotOccupancyForm.occupancyEndDateString === ''
? undefined ? undefined
: dateTimeFunctions.dateStringToInteger( : dateTimeFunctions.dateStringToInteger(
lotOccupancyForm.occupancyEndDateString lotOccupancyForm.occupancyEndDateString as dateTimeFunctions.DateString
), ),
user.userName, user.userName,
rightNowMillis, rightNowMillis,

View File

@ -1,4 +1,6 @@
import { import {
type DateString,
type TimeString,
dateStringToInteger, dateStringToInteger,
dateToInteger, dateToInteger,
dateToTimeInteger, dateToTimeInteger,
@ -21,14 +23,14 @@ export default async function addLotOccupancyComment(
const rightNow = new Date() const rightNow = new Date()
let lotOccupancyCommentDate: number let lotOccupancyCommentDate: number
let lotOccupancyCommentTime: number let lotOccupancyCommentTime: number | undefined
if (commentForm.lotOccupancyCommentDateString) { if (commentForm.lotOccupancyCommentDateString) {
lotOccupancyCommentDate = dateStringToInteger( lotOccupancyCommentDate = dateStringToInteger(
commentForm.lotOccupancyCommentDateString commentForm.lotOccupancyCommentDateString as DateString
) )
lotOccupancyCommentTime = timeStringToInteger( lotOccupancyCommentTime = timeStringToInteger(
commentForm.lotOccupancyCommentTimeString ?? '' (commentForm.lotOccupancyCommentTimeString as TimeString) ?? ''
) )
} else { } else {
lotOccupancyCommentDate = dateToInteger(rightNow) lotOccupancyCommentDate = dateToInteger(rightNow)

View File

@ -15,7 +15,7 @@ export async function getFees(feeCategoryId, additionalFilters, connectedDatabas
sqlParameters.push(additionalFilters.lotTypeId); sqlParameters.push(additionalFilters.lotTypeId);
} }
const fees = database const fees = database
.prepare(`select f.feeId, .prepare(`select f.feeId, f.feeCategoryId,
f.feeName, f.feeDescription, f.feeAccount, f.feeName, f.feeDescription, f.feeAccount,
f.occupancyTypeId, o.occupancyType, f.occupancyTypeId, o.occupancyType,
f.lotTypeId, l.lotType, f.lotTypeId, l.lotType,

View File

@ -41,7 +41,7 @@ export async function getFees(
const fees = database const fees = database
.prepare( .prepare(
`select f.feeId, `select f.feeId, f.feeCategoryId,
f.feeName, f.feeDescription, f.feeAccount, f.feeName, f.feeDescription, f.feeAccount,
f.occupancyTypeId, o.occupancyType, f.occupancyTypeId, o.occupancyType,
f.lotTypeId, l.lotType, f.lotTypeId, l.lotType,

View File

@ -3,7 +3,7 @@ import { acquireConnection } from './pool.js';
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'; import { updateRecordOrderNumber } from './updateRecordOrderNumber.js';
export async function moveFeeDown(feeId) { export async function moveFeeDown(feeId) {
const database = await acquireConnection(); const database = await acquireConnection();
const currentFee = await getFee(feeId, database); const currentFee = (await getFee(feeId, database));
database database
.prepare(`update Fees .prepare(`update Fees
set orderNumber = orderNumber - 1 set orderNumber = orderNumber - 1
@ -17,7 +17,7 @@ export async function moveFeeDown(feeId) {
} }
export async function moveFeeDownToBottom(feeId) { export async function moveFeeDownToBottom(feeId) {
const database = await acquireConnection(); const database = await acquireConnection();
const currentFee = await getFee(feeId, database); const currentFee = (await getFee(feeId, database));
const maxOrderNumber = database const maxOrderNumber = database
.prepare(`select max(orderNumber) as maxOrderNumber .prepare(`select max(orderNumber) as maxOrderNumber
from Fees from Fees
@ -38,7 +38,7 @@ export async function moveFeeDownToBottom(feeId) {
} }
export async function moveFeeUp(feeId) { export async function moveFeeUp(feeId) {
const database = await acquireConnection(); const database = await acquireConnection();
const currentFee = await getFee(feeId, database); const currentFee = (await getFee(feeId, database));
if (currentFee.orderNumber <= 0) { if (currentFee.orderNumber <= 0) {
database.release(); database.release();
return true; return true;

View File

@ -7,7 +7,7 @@ import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'
export async function moveFeeDown(feeId: number | string): Promise<boolean> { export async function moveFeeDown(feeId: number | string): Promise<boolean> {
const database = await acquireConnection() const database = await acquireConnection()
const currentFee = await getFee(feeId, database) const currentFee = (await getFee(feeId, database)) as Fee
database database
.prepare( .prepare(
@ -22,7 +22,7 @@ export async function moveFeeDown(feeId: number | string): Promise<boolean> {
const success = updateRecordOrderNumber( const success = updateRecordOrderNumber(
'Fees', 'Fees',
feeId, feeId,
currentFee.orderNumber! + 1, currentFee.orderNumber + 1,
database database
) )
@ -36,7 +36,7 @@ export async function moveFeeDownToBottom(
): Promise<boolean> { ): Promise<boolean> {
const database = await acquireConnection() const database = await acquireConnection()
const currentFee = await getFee(feeId, database) const currentFee = (await getFee(feeId, database)) as Fee
const maxOrderNumber = ( const maxOrderNumber = (
database database
@ -70,9 +70,9 @@ export async function moveFeeDownToBottom(
export async function moveFeeUp(feeId: number): Promise<boolean> { export async function moveFeeUp(feeId: number): Promise<boolean> {
const database = await acquireConnection() 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() database.release()
return true return true
} }
@ -90,7 +90,7 @@ export async function moveFeeUp(feeId: number): Promise<boolean> {
const success = updateRecordOrderNumber( const success = updateRecordOrderNumber(
'Fees', 'Fees',
feeId, feeId,
currentFee.orderNumber! - 1, currentFee.orderNumber - 1,
database database
) )
@ -104,7 +104,7 @@ export async function moveFeeUpToTop(feeId: number | string): Promise<boolean> {
const currentFee = (await getFee(feeId, database)) as Fee const currentFee = (await getFee(feeId, database)) as Fee
if (currentFee.orderNumber! > 0) { if (currentFee.orderNumber > 0) {
updateRecordOrderNumber('Fees', feeId, -1, database) updateRecordOrderNumber('Fees', feeId, -1, database)
database database

View File

@ -114,7 +114,7 @@ export interface FeeCategory extends Record {
} }
export interface Fee extends Record { export interface Fee extends Record {
feeId: number; feeId: number;
feeCategoryId?: number; feeCategoryId: number;
feeCategory?: string; feeCategory?: string;
feeName?: string; feeName?: string;
feeDescription?: string; feeDescription?: string;
@ -130,7 +130,7 @@ export interface Fee extends Record {
taxAmount?: number; taxAmount?: number;
taxPercentage?: number; taxPercentage?: number;
isRequired?: boolean; isRequired?: boolean;
orderNumber?: number; orderNumber: number;
lotOccupancyFeeCount?: number; lotOccupancyFeeCount?: number;
} }
export interface LotOccupancyFee extends Fee, Record { export interface LotOccupancyFee extends Fee, Record {

View File

@ -149,7 +149,7 @@ export interface FeeCategory extends Record {
export interface Fee extends Record { export interface Fee extends Record {
feeId: number feeId: number
feeCategoryId?: number feeCategoryId: number
feeCategory?: string feeCategory?: string
feeName?: string feeName?: string
@ -173,7 +173,7 @@ export interface Fee extends Record {
isRequired?: boolean isRequired?: boolean
orderNumber?: number orderNumber: number
lotOccupancyFeeCount?: number lotOccupancyFeeCount?: number
} }