fix initializing database

pull/11/head
Dan Gowans 2025-04-29 13:17:31 -04:00
parent 111663a274
commit ab61a3e340
3 changed files with 8 additions and 8 deletions

View File

@ -1,7 +1,7 @@
export interface AddForm { export interface AddIntermentContainerTypeForm {
intermentContainerType: string; intermentContainerType: string;
intermentContainerTypeKey?: string; intermentContainerTypeKey?: string;
isCremationType: '0' | '1'; isCremationType?: '0' | '1';
orderNumber?: number | string; orderNumber?: number | string;
} }
export default function addIntermentContainerType(addForm: AddForm, user: User): number; export default function addIntermentContainerType(addForm: AddIntermentContainerTypeForm, user: User): number;

View File

@ -10,7 +10,7 @@ export default function addIntermentContainerType(addForm, user) {
recordCreate_userName, recordCreate_timeMillis, recordCreate_userName, recordCreate_timeMillis,
recordUpdate_userName, recordUpdate_timeMillis) recordUpdate_userName, recordUpdate_timeMillis)
values (?, ?, ?, ?, ?, ?, ?, ?)`) 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(); database.close();
clearCacheByTableName('IntermentContainerTypes'); clearCacheByTableName('IntermentContainerTypes');
return result.lastInsertRowid; return result.lastInsertRowid;

View File

@ -3,15 +3,15 @@ import sqlite from 'better-sqlite3'
import { sunriseDB } from '../helpers/database.helpers.js' import { sunriseDB } from '../helpers/database.helpers.js'
import { clearCacheByTableName } from '../helpers/functions.cache.js' import { clearCacheByTableName } from '../helpers/functions.cache.js'
export interface AddForm { export interface AddIntermentContainerTypeForm {
intermentContainerType: string intermentContainerType: string
intermentContainerTypeKey?: string intermentContainerTypeKey?: string
isCremationType: '0' | '1' isCremationType?: '0' | '1'
orderNumber?: number | string orderNumber?: number | string
} }
export default function addIntermentContainerType( export default function addIntermentContainerType(
addForm: AddForm, addForm: AddIntermentContainerTypeForm,
user: User user: User
): number { ): number {
const database = sqlite(sunriseDB) const database = sqlite(sunriseDB)
@ -29,7 +29,7 @@ export default function addIntermentContainerType(
.run( .run(
addForm.intermentContainerType, addForm.intermentContainerType,
addForm.intermentContainerTypeKey ?? '', addForm.intermentContainerTypeKey ?? '',
addForm.isCremationType, addForm.isCremationType ?? '0',
addForm.orderNumber ?? -1, addForm.orderNumber ?? -1,
user.userName, user.userName,
rightNowMillis, rightNowMillis,