17 lines
674 B
JavaScript
17 lines
674 B
JavaScript
import sqlite from 'better-sqlite3';
|
|
import { sunriseDB } from '../helpers/database.helpers.js';
|
|
export default function deleteBurialSiteField(burialSiteId, burialSiteTypeFieldId, user, connectedDatabase) {
|
|
const database = connectedDatabase ?? sqlite(sunriseDB);
|
|
const result = database
|
|
.prepare(`update BurialSiteFields
|
|
set recordDelete_userName = ?,
|
|
recordDelete_timeMillis = ?
|
|
where burialSiteId = ?
|
|
and burialSiteTypeFieldId = ?`)
|
|
.run(user.userName, Date.now(), burialSiteId, burialSiteTypeFieldId);
|
|
if (connectedDatabase === undefined) {
|
|
database.close();
|
|
}
|
|
return result.changes > 0;
|
|
}
|