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;
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;

View File

@ -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;

View File

@ -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,