Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Oct 31, 2024
1 parent 7011ab1 commit 33e2bbe
Show file tree
Hide file tree
Showing 105 changed files with 546 additions and 577 deletions.
2 changes: 1 addition & 1 deletion app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ app.use(`${urlPrefix}/dashboard`, sessionChecker, routerDashboard)

app.use(
`${urlPrefix}/api/:apiKey`,
permissionHandlers.apiGetHandler as RequestHandler,
permissionHandlers.apiGetHandler,
routerApi
)

Expand Down
2 changes: 1 addition & 1 deletion database/moveFee.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export declare function moveFeeDown(feeId: number | string): Promise<boolean>;
export declare function moveFeeDownToBottom(feeId: number | string): Promise<boolean>;
export declare function moveFeeUp(feeId: number): Promise<boolean>;
export declare function moveFeeUp(feeId: number | string): Promise<boolean>;
export declare function moveFeeUpToTop(feeId: number | string): Promise<boolean>;
export default moveFeeUp;
2 changes: 1 addition & 1 deletion database/moveFee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export async function moveFeeDownToBottom(
return true
}

export async function moveFeeUp(feeId: number): Promise<boolean> {
export async function moveFeeUp(feeId: number | string): Promise<boolean> {
const database = await acquireConnection()

const currentFee = (await getFee(feeId, database)) as Fee
Expand Down
8 changes: 4 additions & 4 deletions database/moveOccupancyTypeField.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export declare function moveOccupancyTypeFieldDown(occupancyTypeFieldId: number): Promise<boolean>;
export declare function moveOccupancyTypeFieldDownToBottom(occupancyTypeFieldId: number): Promise<boolean>;
export declare function moveOccupancyTypeFieldUp(occupancyTypeFieldId: number): Promise<boolean>;
export declare function moveOccupancyTypeFieldUpToTop(occupancyTypeFieldId: number): Promise<boolean>;
export declare function moveOccupancyTypeFieldDown(occupancyTypeFieldId: number | string): Promise<boolean>;
export declare function moveOccupancyTypeFieldDownToBottom(occupancyTypeFieldId: number | string): Promise<boolean>;
export declare function moveOccupancyTypeFieldUp(occupancyTypeFieldId: number | string): Promise<boolean>;
export declare function moveOccupancyTypeFieldUpToTop(occupancyTypeFieldId: number | string): Promise<boolean>;
10 changes: 5 additions & 5 deletions database/moveOccupancyTypeField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { acquireConnection } from './pool.js'
import { updateRecordOrderNumber } from './updateRecordOrderNumber.js'

function getCurrentField(
occupancyTypeFieldId: number,
occupancyTypeFieldId: number | string,
connectedDatabase: PoolConnection
): { occupancyTypeId?: number; orderNumber: number } {
return connectedDatabase
Expand All @@ -22,7 +22,7 @@ function getCurrentField(
}

export async function moveOccupancyTypeFieldDown(
occupancyTypeFieldId: number
occupancyTypeFieldId: number | string
): Promise<boolean> {
const database = await acquireConnection()

Expand Down Expand Up @@ -57,7 +57,7 @@ export async function moveOccupancyTypeFieldDown(
}

export async function moveOccupancyTypeFieldDownToBottom(
occupancyTypeFieldId: number
occupancyTypeFieldId: number | string
): Promise<boolean> {
const database = await acquireConnection()

Expand Down Expand Up @@ -116,7 +116,7 @@ export async function moveOccupancyTypeFieldDownToBottom(
}

export async function moveOccupancyTypeFieldUp(
occupancyTypeFieldId: number
occupancyTypeFieldId: number | string
): Promise<boolean> {
const database = await acquireConnection()

Expand Down Expand Up @@ -156,7 +156,7 @@ export async function moveOccupancyTypeFieldUp(
}

export async function moveOccupancyTypeFieldUpToTop(
occupancyTypeFieldId: number
occupancyTypeFieldId: number | string
): Promise<boolean> {
const database = await acquireConnection()

Expand Down
8 changes: 4 additions & 4 deletions database/moveRecord.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type RecordTable = 'FeeCategories' | 'LotOccupantTypes' | 'LotStatuses' | 'LotTypes' | 'OccupancyTypes' | 'WorkOrderMilestoneTypes' | 'WorkOrderTypes';
export declare function moveRecordDown(recordTable: RecordTable, recordId: number): Promise<boolean>;
export declare function moveRecordDownToBottom(recordTable: RecordTable, recordId: number): Promise<boolean>;
export declare function moveRecordUp(recordTable: RecordTable, recordId: number): Promise<boolean>;
export declare function moveRecordUpToTop(recordTable: RecordTable, recordId: number): Promise<boolean>;
export declare function moveRecordDown(recordTable: RecordTable, recordId: number | string): Promise<boolean>;
export declare function moveRecordDownToBottom(recordTable: RecordTable, recordId: number | string): Promise<boolean>;
export declare function moveRecordUp(recordTable: RecordTable, recordId: number | string): Promise<boolean>;
export declare function moveRecordUpToTop(recordTable: RecordTable, recordId: number | string): Promise<boolean>;
export {};
10 changes: 5 additions & 5 deletions database/moveRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function getCurrentOrderNumber(
.prepare(
`select orderNumber
from ${recordTable}
where ${recordIdColumns.get(recordTable)!} = ?`
where ${recordIdColumns.get(recordTable)} = ?`
)
.get(recordId) as { orderNumber: number }
).orderNumber
Expand All @@ -43,7 +43,7 @@ function getCurrentOrderNumber(

export async function moveRecordDown(
recordTable: RecordTable,
recordId: number
recordId: number | string
): Promise<boolean> {
const database = await acquireConnection()

Expand Down Expand Up @@ -78,7 +78,7 @@ export async function moveRecordDown(

export async function moveRecordDownToBottom(
recordTable: RecordTable,
recordId: number
recordId: number | string
): Promise<boolean> {
const database = await acquireConnection()

Expand Down Expand Up @@ -120,7 +120,7 @@ export async function moveRecordDownToBottom(

export async function moveRecordUp(
recordTable: RecordTable,
recordId: number
recordId: number | string
): Promise<boolean> {
const database = await acquireConnection()

Expand Down Expand Up @@ -160,7 +160,7 @@ export async function moveRecordUp(

export async function moveRecordUpToTop(
recordTable: RecordTable,
recordId: number
recordId: number | string
): Promise<boolean> {
const database = await acquireConnection()

Expand Down
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const config = tseslint.config(...configWebApp, {
'warn',
{
cspell: {
words: [...cspellWords, 'ical', 'ntfy']
words: [...cspellWords, 'ical', 'preneed', 'ntfy']
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const config = tseslint.config(...configWebApp, {
'warn',
{
cspell: {
words: [...cspellWords, 'ical', 'ntfy']
words: [...cspellWords, 'ical', 'preneed', 'ntfy']
}
}
]
Expand Down
2 changes: 0 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, n/no-unpublished-import */
import gulp from 'gulp';
import gulpSass from 'gulp-sass';
import * as dartSass from 'sass';
Expand Down
3 changes: 0 additions & 3 deletions gulpfile.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, n/no-unpublished-import */

import gulp from 'gulp'
import gulpSass from 'gulp-sass'
import * as dartSass from 'sass'
Expand Down
4 changes: 3 additions & 1 deletion handlers/admin-post/doDeleteWorkOrderType.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import type { Request, Response } from 'express';
export default function handler(request: Request, response: Response): Promise<void>;
export default function handler(request: Request<unknown, unknown, {
workOrderTypeId: string;
}>, response: Response): Promise<void>;
5 changes: 2 additions & 3 deletions handlers/admin-post/doDeleteWorkOrderType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { deleteRecord } from '../../database/deleteRecord.js'
import { getWorkOrderTypes } from '../../helpers/functions.cache.js'

export default async function handler(
request: Request,
request: Request<unknown, unknown, { workOrderTypeId: string }>,
response: Response
): Promise<void> {
const success = await deleteRecord(
'WorkOrderTypes',
request.body.workOrderTypeId as string,
request.body.workOrderTypeId,
request.session.user as User
)

Expand All @@ -20,4 +20,3 @@ export default async function handler(
workOrderTypes
})
}

5 changes: 4 additions & 1 deletion handlers/admin-post/doMoveFeeCategoryDown.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
import type { Request, Response } from 'express';
export default function handler(request: Request, response: Response): Promise<void>;
export default function handler(request: Request<unknown, unknown, {
feeCategoryId: string;
moveToEnd: '0' | '1';
}>, response: Response): Promise<void>;
6 changes: 5 additions & 1 deletion handlers/admin-post/doMoveFeeCategoryDown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import {
} from '../../database/moveRecord.js'

export default async function handler(
request: Request,
request: Request<
unknown,
unknown,
{ feeCategoryId: string; moveToEnd: '0' | '1' }
>,
response: Response
): Promise<void> {
const success =
Expand Down
5 changes: 4 additions & 1 deletion handlers/admin-post/doMoveFeeCategoryUp.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
import type { Request, Response } from 'express';
export default function handler(request: Request, response: Response): Promise<void>;
export default function handler(request: Request<unknown, unknown, {
feeCategoryId: string;
moveToEnd: '0' | '1';
}>, response: Response): Promise<void>;
2 changes: 1 addition & 1 deletion handlers/admin-post/doMoveFeeCategoryUp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import getFeeCategories from '../../database/getFeeCategories.js'
import { moveRecordUp, moveRecordUpToTop } from '../../database/moveRecord.js'

export default async function handler(
request: Request,
request: Request<unknown, unknown, { feeCategoryId: string; moveToEnd: '0' | '1' }>,
response: Response
): Promise<void> {
const success =
Expand Down
5 changes: 4 additions & 1 deletion handlers/admin-post/doMoveFeeDown.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
import type { Request, Response } from 'express';
export default function handler(request: Request, response: Response): Promise<void>;
export default function handler(request: Request<unknown, unknown, {
feeId: string;
moveToEnd: '0' | '1';
}>, response: Response): Promise<void>;
2 changes: 1 addition & 1 deletion handlers/admin-post/doMoveFeeDown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import getFeeCategories from '../../database/getFeeCategories.js'
import { moveFeeDown, moveFeeDownToBottom } from '../../database/moveFee.js'

export default async function handler(
request: Request,
request: Request<unknown, unknown, { feeId: string; moveToEnd: '0' | '1' }>,
response: Response
): Promise<void> {
const success =
Expand Down
5 changes: 4 additions & 1 deletion handlers/admin-post/doMoveFeeUp.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
import type { Request, Response } from 'express';
export default function handler(request: Request, response: Response): Promise<void>;
export default function handler(request: Request<unknown, unknown, {
feeId: string;
moveToEnd: '0' | '1';
}>, response: Response): Promise<void>;
2 changes: 1 addition & 1 deletion handlers/admin-post/doMoveFeeUp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import getFeeCategories from '../../database/getFeeCategories.js'
import { moveFeeUp, moveFeeUpToTop } from '../../database/moveFee.js'

export default async function handler(
request: Request,
request: Request<unknown, unknown, { feeId: string; moveToEnd: '0' | '1' }>,
response: Response
): Promise<void> {
const success =
Expand Down
5 changes: 4 additions & 1 deletion handlers/admin-post/doMoveLotOccupantTypeDown.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
import type { Request, Response } from 'express';
export default function handler(request: Request, response: Response): Promise<void>;
export default function handler(request: Request<unknown, unknown, {
lotOccupantTypeId: string;
moveToEnd: '0' | '1';
}>, response: Response): Promise<void>;
7 changes: 5 additions & 2 deletions handlers/admin-post/doMoveLotOccupantTypeDown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import {
import { getLotOccupantTypes } from '../../helpers/functions.cache.js'

export default async function handler(
request: Request,
request: Request<
unknown,
unknown,
{ lotOccupantTypeId: string; moveToEnd: '0' | '1' }
>,
response: Response
): Promise<void> {
const success =
Expand All @@ -25,4 +29,3 @@ export default async function handler(
lotOccupantTypes
})
}

5 changes: 4 additions & 1 deletion handlers/admin-post/doMoveLotOccupantTypeUp.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
import type { Request, Response } from 'express';
export default function handler(request: Request, response: Response): Promise<void>;
export default function handler(request: Request<unknown, unknown, {
lotOccupantTypeId: string;
moveToEnd: '0' | '1';
}>, response: Response): Promise<void>;
17 changes: 10 additions & 7 deletions handlers/admin-post/doMoveLotOccupantTypeUp.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import type { Request, Response } from 'express'

import {
moveRecordUp,
moveRecordUpToTop
} from '../../database/moveRecord.js'
import { moveRecordUp, moveRecordUpToTop } from '../../database/moveRecord.js'
import { getLotOccupantTypes } from '../../helpers/functions.cache.js'

export default async function handler(
request: Request,
request: Request<
unknown,
unknown,
{ lotOccupantTypeId: string; moveToEnd: '0' | '1' }
>,
response: Response
): Promise<void> {
const success =
request.body.moveToEnd === '1'
? await moveRecordUpToTop('LotOccupantTypes', request.body.lotOccupantTypeId)
? await moveRecordUpToTop(
'LotOccupantTypes',
request.body.lotOccupantTypeId
)
: await moveRecordUp('LotOccupantTypes', request.body.lotOccupantTypeId)

const lotOccupantTypes = await getLotOccupantTypes()
Expand All @@ -22,4 +26,3 @@ export default async function handler(
lotOccupantTypes
})
}

5 changes: 4 additions & 1 deletion handlers/admin-post/doMoveLotStatusDown.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
import type { Request, Response } from 'express';
export default function handler(request: Request, response: Response): Promise<void>;
export default function handler(request: Request<unknown, unknown, {
lotStatusId: string;
moveToEnd: '0' | '1';
}>, response: Response): Promise<void>;
7 changes: 5 additions & 2 deletions handlers/admin-post/doMoveLotStatusDown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import {
import { getLotStatuses } from '../../helpers/functions.cache.js'

export default async function handler(
request: Request,
request: Request<
unknown,
unknown,
{ lotStatusId: string; moveToEnd: '0' | '1' }
>,
response: Response
): Promise<void> {
const success =
Expand All @@ -22,4 +26,3 @@ export default async function handler(
lotStatuses
})
}

5 changes: 4 additions & 1 deletion handlers/admin-post/doMoveLotStatusUp.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
import type { Request, Response } from 'express';
export default function handler(request: Request, response: Response): Promise<void>;
export default function handler(request: Request<unknown, unknown, {
lotStatusId: string;
moveToEnd: '0' | '1';
}>, response: Response): Promise<void>;
12 changes: 6 additions & 6 deletions handlers/admin-post/doMoveLotStatusUp.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import type { Request, Response } from 'express'

import {
moveRecordUp,
moveRecordUpToTop
} from '../../database/moveRecord.js'
import { moveRecordUp, moveRecordUpToTop } from '../../database/moveRecord.js'
import { getLotStatuses } from '../../helpers/functions.cache.js'

export default async function handler(
request: Request,
request: Request<
unknown,
unknown,
{ lotStatusId: string; moveToEnd: '0' | '1' }
>,
response: Response
): Promise<void> {
const success =
Expand All @@ -22,4 +23,3 @@ export default async function handler(
lotStatuses
})
}

5 changes: 4 additions & 1 deletion handlers/admin-post/doMoveLotTypeDown.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
import type { Request, Response } from 'express';
export default function handler(request: Request, response: Response): Promise<void>;
export default function handler(request: Request<unknown, unknown, {
lotTypeId: string;
moveToEnd: '0' | '1';
}>, response: Response): Promise<void>;
Loading

0 comments on commit 33e2bbe

Please sign in to comment.