17 lines
943 B
JavaScript
17 lines
943 B
JavaScript
import { clearCacheByTableName } from '../helpers/functions.cache.js';
|
|
import { acquireConnection } from './pool.js';
|
|
export default async function addIntermentContainerType(addForm, user) {
|
|
const database = await acquireConnection();
|
|
const rightNowMillis = Date.now();
|
|
const result = database
|
|
.prepare(`insert into IntermentContainerTypes (
|
|
intermentContainerType, intermentContainerTypeKey, isCremationType, orderNumber,
|
|
recordCreate_userName, recordCreate_timeMillis,
|
|
recordUpdate_userName, recordUpdate_timeMillis)
|
|
values (?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
.run(addForm.intermentContainerType, addForm.intermentContainerTypeKey ?? '', addForm.isCremationType === undefined ? 0 : 1, addForm.orderNumber ?? -1, user.userName, rightNowMillis, user.userName, rightNowMillis);
|
|
database.release();
|
|
clearCacheByTableName('IntermentContainerTypes');
|
|
return result.lastInsertRowid;
|
|
}
|