Skip to content

Commit

Permalink
chore: add emergency contact info
Browse files Browse the repository at this point in the history
  • Loading branch information
tataihono committed Dec 19, 2024
1 parent f840bbe commit 3b4897b
Show file tree
Hide file tree
Showing 16 changed files with 7,047 additions and 4,274 deletions.
1 change: 1 addition & 0 deletions scripts/downloadSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const client = axios.create({

async function downloadSchema(): Promise<void> {
const REST_CONTROLLER_NAMES = [
'Attributes',
'Campuses',
'DefinedTypes',
'DefinedValues',
Expand Down
110 changes: 110 additions & 0 deletions src/extract/attribute/attribute.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import type { components } from '../../load/client'
import type { ExtractIterator } from '../types'

import { entityTypes } from './entityTypes'
import { fieldTypes } from './fieldTypes'

export type FluroAttribute = Omit<
components['schemas']['Rock.Model.Attribute'],
'Key'
> & {
_id: string
}

const attributes: FluroAttribute[] = [
{
_id: 'EmergencyContactName',
AbbreviatedName: 'Emergency Contact Name',
FieldTypeId: fieldTypes.Text,
EntityTypeId: entityTypes['Rock.Model.Person'],
Name: 'Emergency Contact Name',
Description: 'If Parent/Guardian cannot be reached',
Categories: [
{
EntityTypeId: entityTypes['Rock.Model.Attribute'],
Order: 0,
Id: 54,
Name: 'Childhood Information',
IsSystem: true
}
],
IsSystem: false,
Order: 1,
IsGridColumn: false,
IsMultiValue: false,
IsRequired: false,
AllowSearch: false
},
{
_id: 'EmergencyContactRelationship',
AbbreviatedName: 'Emergency Contact Relationship',
FieldTypeId: fieldTypes.Text,
EntityTypeId: entityTypes['Rock.Model.Person'],
Name: 'Emergency Contact Relationship',
Description: "Emergency Contact's Relationship to the child",
Categories: [
{
EntityTypeId: entityTypes['Rock.Model.Attribute'],
Order: 0,
Id: 54,
Name: 'Childhood Information',
IsSystem: true
}
],
IsSystem: false,
Order: 2,
IsGridColumn: false,
IsMultiValue: false,
IsRequired: false,
AllowSearch: false
},
{
_id: 'EmergencyContactNumber',
AbbreviatedName: 'Emergency Contact Number',
FieldTypeId: fieldTypes.PhoneNumber,
EntityTypeId: entityTypes['Rock.Model.Person'],
Name: 'Emergency Contact Number',
Description: "Emergency Contact's Phone Number",
Categories: [
{
EntityTypeId: entityTypes['Rock.Model.Attribute'],
Order: 0,
Id: 54,
Name: 'Childhood Information',
IsSystem: true
}
],
IsSystem: false,
Order: 3,
IsGridColumn: false,
IsMultiValue: false,
IsRequired: false,
AllowSearch: false
}
]

export async function extract(): Promise<
AsyncIterator<ExtractIterator<FluroAttribute>>
> {
let repeat = 1

return await Promise.resolve({
next: async (): Promise<{
value: { collection: FluroAttribute[]; max: number }
done: boolean
}> => {
if (repeat === 0) {
return await Promise.resolve({
value: { collection: [], max: attributes.length },
done: true
})
} else {
repeat -= 1
return await Promise.resolve({
value: { collection: attributes, max: attributes.length },
done: false
})
}
}
})
}
Loading

0 comments on commit 3b4897b

Please sign in to comment.