@byu-oit/admissions-report-class
Two class definitions used to help format metadata in various report handlers
Installation
npm install @byu-oit/admissions-report-class
Usage
const { Report } = require('@byu-oit/admissions-report-class')
exports.getMetaData = () => {
return new Report('pathwayFieldSupportMissionaries')
.description('Field Support Missionaries Contacts')
.longDescription('Student contact information for field support missionaries.')
.category('reports')
.institutions('PW')
.contentTypes('text/csv')
.parameters('admitPeriod')
.column('Application ID', '/detail-new/:value', 'link_app')
.column('Pathway ID')
.column('First Name', '', 'sort')
.column('Surname', '', 'sort')
.column('Phone Number')
.column('Email Address')
.column('Applicant Type', '', 'sort', 'filter')
.column('Certificate Selected', '', 'sort', 'filter')
.column('Application Start Date', '', 'sort', 'timestamp')
.column('Application Submit Date', '', 'sort', 'timestamp')
.column('Application Complete Date', '', 'sort', 'timestamp')
.column('Admit Decision Date', '', 'sort', 'timestamp')
.column('Admit Decision Details', '', 'sort', 'filter')
.column('Application Status', '', 'sort', 'filter')
.column('Admit Period', '', 'sort', 'filter')
.column('Endorsement Status')
.column('Transcripts')
.column('Application Status Progress')
.toJSON()
}
Notes
- The return value for 'institutions' is variablized, and will only be returned in the JSON if
there is at least one value
- In the member functions that accept a list of values, the
(...values)
syntax is used so
pass in elements one at a time as separate parameters and not as a list/array
(e.g. .institutions('PW', 'BYUH', 'BYUI')
not .institutions(['PW', 'BYUH', 'BYUI'])
) - Columns in the report class, when transformed to JSON, will be auto assigned an ordinal value
based on the order they are added to the class. The first value will be 1, the second 2, etc.
- Be careful to use the member functions that accept multiple parameters (e.g. contentTypes() instead of contentType()).
The former will accept multiple parameters, the latter will only accept one. If you try to add multiple parameters
to a function that only accepts one, it won't throw an error, but it will only use the first parameter. which is
probably not what you want. You can pass only one parameter into a function that accepts multiple parameters with
no problems, so it's safe to use the plural version of the function even if you only have one parameter to pass in.