Skip to content

Commit

Permalink
add birth date and place to initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Jul 2, 2024
1 parent d08ffcb commit 169dc4b
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 12 deletions.
40 changes: 34 additions & 6 deletions helpers/initializer.database.cemetery.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand All @@ -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);
Expand All @@ -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, {
Expand All @@ -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);
Expand All @@ -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,
Expand Down
61 changes: 55 additions & 6 deletions helpers/initializer.database.cemetery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,60 @@ export async function initializeCemeteryDatabase(): Promise<boolean> {
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)
Expand All @@ -137,6 +181,7 @@ export async function initializeCemeteryDatabase(): Promise<boolean> {
)

// Death Age

const deathAgeField = {
occupancyTypeId: intermentOccupancyTypeId,
occupancyTypeField: 'Death Age',
Expand All @@ -145,7 +190,7 @@ export async function initializeCemeteryDatabase(): Promise<boolean> {
isRequired: '',
minimumLength: 1,
maximumLength: 3,
orderNumber: 2
orderNumber: 4
}

await addOccupancyTypeField(deathAgeField, user)
Expand All @@ -156,6 +201,7 @@ export async function initializeCemeteryDatabase(): Promise<boolean> {
)

// Death Age Period

const deathAgePeriod = {
occupancyTypeId: intermentOccupancyTypeId,
occupancyTypeField: 'Death Age Period',
Expand All @@ -164,7 +210,7 @@ export async function initializeCemeteryDatabase(): Promise<boolean> {
isRequired: '',
minimumLength: 1,
maximumLength: 10,
orderNumber: 3
orderNumber: 5
}

await addOccupancyTypeField(deathAgePeriod, user)
Expand All @@ -177,6 +223,7 @@ export async function initializeCemeteryDatabase(): Promise<boolean> {
)

// Death Place

const deathPlace = {
occupancyTypeId: intermentOccupancyTypeId,
occupancyTypeField: 'Death Place',
Expand All @@ -185,7 +232,7 @@ export async function initializeCemeteryDatabase(): Promise<boolean> {
isRequired: '',
minimumLength: 1,
maximumLength: 100,
orderNumber: 4
orderNumber: 6
}

await addOccupancyTypeField(deathPlace, user)
Expand All @@ -196,6 +243,7 @@ export async function initializeCemeteryDatabase(): Promise<boolean> {
)

// Funeral Home

const funeralHome = {
occupancyTypeId: intermentOccupancyTypeId,
occupancyTypeField: 'Funeral Home',
Expand All @@ -215,11 +263,12 @@ export async function initializeCemeteryDatabase(): Promise<boolean> {
)

// 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,
Expand Down

0 comments on commit 169dc4b

Please sign in to comment.