diff --git a/helpers/initializer.database.cemetery.js b/helpers/initializer.database.cemetery.js index ccb8154a..ae024482 100644 --- a/helpers/initializer.database.cemetery.js +++ b/helpers/initializer.database.cemetery.js @@ -71,16 +71,44 @@ export async function initializeCemeteryDatabase() { await addRecord('OccupancyTypes', 'Preneed', 1, user); const intermentOccupancyTypeId = await addRecord('OccupancyTypes', 'Interment', 2, user); const cremationOccupancyTypeId = await addRecord('OccupancyTypes', 'Cremation', 3, user); + // Birth Date + const birthDateField = { + occupancyTypeId: intermentOccupancyTypeId, + occupancyTypeField: 'Birth Date', + occupancyTypeFieldValues: '', + pattern: String.raw `\d{4}-\d{2}-\d{2}`, + isRequired: '', + minimumLength: 10, + maximumLength: 10, + orderNumber: 1 + }; + await addOccupancyTypeField(birthDateField, user); + await addOccupancyTypeField(Object.assign(birthDateField, { + occupancyTypeId: cremationOccupancyTypeId + }), user); + // Birth Place + const birthPlace = { + occupancyTypeId: intermentOccupancyTypeId, + occupancyTypeField: 'Birth Place', + occupancyTypeFieldValues: '', + pattern: '', + isRequired: '', + minimumLength: 1, + maximumLength: 100, + orderNumber: 2 + }; + await addOccupancyTypeField(birthPlace, user); + await addOccupancyTypeField(Object.assign(birthPlace, { occupancyTypeId: cremationOccupancyTypeId }), user); // Death Date const deathDateField = { occupancyTypeId: intermentOccupancyTypeId, occupancyTypeField: 'Death Date', occupancyTypeFieldValues: '', - pattern: String.raw `\d{4}([\/-]\d{2}){2}`, + pattern: String.raw `\d{4}-\d{2}-\d{2}`, isRequired: '', minimumLength: 10, maximumLength: 10, - orderNumber: 1 + orderNumber: 3 }; await addOccupancyTypeField(deathDateField, user); await addOccupancyTypeField(Object.assign(deathDateField, { @@ -95,7 +123,7 @@ export async function initializeCemeteryDatabase() { isRequired: '', minimumLength: 1, maximumLength: 3, - orderNumber: 2 + orderNumber: 4 }; await addOccupancyTypeField(deathAgeField, user); await addOccupancyTypeField(Object.assign(deathAgeField, { occupancyTypeId: cremationOccupancyTypeId }), user); @@ -108,7 +136,7 @@ export async function initializeCemeteryDatabase() { isRequired: '', minimumLength: 1, maximumLength: 10, - orderNumber: 3 + orderNumber: 5 }; await addOccupancyTypeField(deathAgePeriod, user); await addOccupancyTypeField(Object.assign(deathAgePeriod, { @@ -123,7 +151,7 @@ export async function initializeCemeteryDatabase() { isRequired: '', minimumLength: 1, maximumLength: 100, - orderNumber: 4 + orderNumber: 6 }; await addOccupancyTypeField(deathPlace, user); await addOccupancyTypeField(Object.assign(deathPlace, { occupancyTypeId: cremationOccupancyTypeId }), user); @@ -145,7 +173,7 @@ export async function initializeCemeteryDatabase() { occupancyTypeId: intermentOccupancyTypeId, occupancyTypeField: 'Funeral Date', occupancyTypeFieldValues: '', - pattern: String.raw `\d{4}([\/-]\d{2}){2}`, + pattern: String.raw `\d{4}-\d{2}-\d{2}`, isRequired: '', minimumLength: 10, maximumLength: 10, diff --git a/helpers/initializer.database.cemetery.ts b/helpers/initializer.database.cemetery.ts index 9a000b8d..32d60eba 100644 --- a/helpers/initializer.database.cemetery.ts +++ b/helpers/initializer.database.cemetery.ts @@ -115,16 +115,60 @@ export async function initializeCemeteryDatabase(): Promise { user ) + // Birth Date + + const birthDateField = { + occupancyTypeId: intermentOccupancyTypeId, + occupancyTypeField: 'Birth Date', + occupancyTypeFieldValues: '', + pattern: String.raw`\d{4}-\d{2}-\d{2}`, + isRequired: '', + minimumLength: 10, + maximumLength: 10, + orderNumber: 1 + } + + await addOccupancyTypeField(birthDateField, user) + + await addOccupancyTypeField( + Object.assign(birthDateField, { + occupancyTypeId: cremationOccupancyTypeId + }), + user + ) + + // Birth Place + + const birthPlace = { + occupancyTypeId: intermentOccupancyTypeId, + occupancyTypeField: 'Birth Place', + occupancyTypeFieldValues: '', + pattern: '', + isRequired: '', + minimumLength: 1, + maximumLength: 100, + orderNumber: 2 + } + + await addOccupancyTypeField(birthPlace, user) + + await addOccupancyTypeField( + Object.assign(birthPlace, { occupancyTypeId: cremationOccupancyTypeId }), + user + ) + + // Death Date + const deathDateField = { occupancyTypeId: intermentOccupancyTypeId, occupancyTypeField: 'Death Date', occupancyTypeFieldValues: '', - pattern: String.raw`\d{4}([\/-]\d{2}){2}`, + pattern: String.raw`\d{4}-\d{2}-\d{2}`, isRequired: '', minimumLength: 10, maximumLength: 10, - orderNumber: 1 + orderNumber: 3 } await addOccupancyTypeField(deathDateField, user) @@ -137,6 +181,7 @@ export async function initializeCemeteryDatabase(): Promise { ) // Death Age + const deathAgeField = { occupancyTypeId: intermentOccupancyTypeId, occupancyTypeField: 'Death Age', @@ -145,7 +190,7 @@ export async function initializeCemeteryDatabase(): Promise { isRequired: '', minimumLength: 1, maximumLength: 3, - orderNumber: 2 + orderNumber: 4 } await addOccupancyTypeField(deathAgeField, user) @@ -156,6 +201,7 @@ export async function initializeCemeteryDatabase(): Promise { ) // Death Age Period + const deathAgePeriod = { occupancyTypeId: intermentOccupancyTypeId, occupancyTypeField: 'Death Age Period', @@ -164,7 +210,7 @@ export async function initializeCemeteryDatabase(): Promise { isRequired: '', minimumLength: 1, maximumLength: 10, - orderNumber: 3 + orderNumber: 5 } await addOccupancyTypeField(deathAgePeriod, user) @@ -177,6 +223,7 @@ export async function initializeCemeteryDatabase(): Promise { ) // Death Place + const deathPlace = { occupancyTypeId: intermentOccupancyTypeId, occupancyTypeField: 'Death Place', @@ -185,7 +232,7 @@ export async function initializeCemeteryDatabase(): Promise { isRequired: '', minimumLength: 1, maximumLength: 100, - orderNumber: 4 + orderNumber: 6 } await addOccupancyTypeField(deathPlace, user) @@ -196,6 +243,7 @@ export async function initializeCemeteryDatabase(): Promise { ) // Funeral Home + const funeralHome = { occupancyTypeId: intermentOccupancyTypeId, occupancyTypeField: 'Funeral Home', @@ -215,11 +263,12 @@ export async function initializeCemeteryDatabase(): Promise { ) // Funeral Date + const funeralDate = { occupancyTypeId: intermentOccupancyTypeId, occupancyTypeField: 'Funeral Date', occupancyTypeFieldValues: '', - pattern: String.raw`\d{4}([\/-]\d{2}){2}`, + pattern: String.raw`\d{4}-\d{2}-\d{2}`, isRequired: '', minimumLength: 10, maximumLength: 10,