From ab61a3e340c4367c40a012b8a1c96f093d8bc34b Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Tue, 29 Apr 2025 13:17:31 -0400 Subject: [PATCH] fix initializing database --- database/addIntermentContainerType.d.ts | 6 +++--- database/addIntermentContainerType.js | 2 +- database/addIntermentContainerType.ts | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/database/addIntermentContainerType.d.ts b/database/addIntermentContainerType.d.ts index bde5846c..e4e9aa96 100644 --- a/database/addIntermentContainerType.d.ts +++ b/database/addIntermentContainerType.d.ts @@ -1,7 +1,7 @@ -export interface AddForm { +export interface AddIntermentContainerTypeForm { intermentContainerType: string; intermentContainerTypeKey?: string; - isCremationType: '0' | '1'; + isCremationType?: '0' | '1'; orderNumber?: number | string; } -export default function addIntermentContainerType(addForm: AddForm, user: User): number; +export default function addIntermentContainerType(addForm: AddIntermentContainerTypeForm, user: User): number; diff --git a/database/addIntermentContainerType.js b/database/addIntermentContainerType.js index c605fc63..54a24440 100644 --- a/database/addIntermentContainerType.js +++ b/database/addIntermentContainerType.js @@ -10,7 +10,7 @@ export default function addIntermentContainerType(addForm, user) { recordCreate_userName, recordCreate_timeMillis, recordUpdate_userName, recordUpdate_timeMillis) values (?, ?, ?, ?, ?, ?, ?, ?)`) - .run(addForm.intermentContainerType, addForm.intermentContainerTypeKey ?? '', addForm.isCremationType, addForm.orderNumber ?? -1, user.userName, rightNowMillis, user.userName, rightNowMillis); + .run(addForm.intermentContainerType, addForm.intermentContainerTypeKey ?? '', addForm.isCremationType ?? '0', addForm.orderNumber ?? -1, user.userName, rightNowMillis, user.userName, rightNowMillis); database.close(); clearCacheByTableName('IntermentContainerTypes'); return result.lastInsertRowid; diff --git a/database/addIntermentContainerType.ts b/database/addIntermentContainerType.ts index 12a3ea50..4aa715e1 100644 --- a/database/addIntermentContainerType.ts +++ b/database/addIntermentContainerType.ts @@ -3,15 +3,15 @@ import sqlite from 'better-sqlite3' import { sunriseDB } from '../helpers/database.helpers.js' import { clearCacheByTableName } from '../helpers/functions.cache.js' -export interface AddForm { +export interface AddIntermentContainerTypeForm { intermentContainerType: string intermentContainerTypeKey?: string - isCremationType: '0' | '1' + isCremationType?: '0' | '1' orderNumber?: number | string } export default function addIntermentContainerType( - addForm: AddForm, + addForm: AddIntermentContainerTypeForm, user: User ): number { const database = sqlite(sunriseDB) @@ -29,7 +29,7 @@ export default function addIntermentContainerType( .run( addForm.intermentContainerType, addForm.intermentContainerTypeKey ?? '', - addForm.isCremationType, + addForm.isCremationType ?? '0', addForm.orderNumber ?? -1, user.userName, rightNowMillis,