Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Add Education Section to Student Application Endpoint Response #92

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
254b53f
:construction: Add application and application draft routing concepts.
klondikemarlen Jul 31, 2023
1906dde
:construction: Begin fleshing out application controller and services.
klondikemarlen Aug 1, 2023
92de07f
:construction: Flesh out application controller and backing service a…
klondikemarlen Aug 1, 2023
2b5fc17
:truck: Require a little to make space for other components.
klondikemarlen Aug 1, 2023
52758a5
:rewind: Avoid mutating application service as I'm no longer using it.
klondikemarlen Aug 1, 2023
a15ab03
:recycle: Make class the default export.
klondikemarlen Aug 1, 2023
f18a75a
:construction: Add basic student application drafts wiring.
klondikemarlen Aug 1, 2023
bc90d5d
:sparkles: Add data serialization to student applications controller.
klondikemarlen Aug 2, 2023
4341ef2
:construction: Add minimal serialization to application drafts endpoint.
klondikemarlen Aug 2, 2023
31a10fe
:recycle: Implemented controller instance per request usage.
klondikemarlen Aug 2, 2023
8f46ce6
:art: Add better type checking to "routedTo" helper.
klondikemarlen Aug 2, 2023
da3e01d
:beetle: Return functions from controllers or external dependencies c…
klondikemarlen Aug 3, 2023
c057e98
:white_check_mark: Ugly and hacky test example for controller.
klondikemarlen Aug 3, 2023
4313942
:beetle: Fix binding of this in controller routing instantiator.
klondikemarlen Aug 3, 2023
181c81a
:art: Standardize naming convention of application draft model file.
klondikemarlen Aug 3, 2023
3a2fd87
:sparkles: Standardize application list view with as much info as I h…
klondikemarlen Aug 3, 2023
8ec7216
:construction: Begin serializing a detailed application view.
klondikemarlen Aug 3, 2023
04d4da6
:sparkles: Add institution model.
klondikemarlen Aug 3, 2023
146653a
:sparkles: Support returning the application institution if it exists.
klondikemarlen Aug 3, 2023
a1610bb
:construction: Return institution info in serializer.
klondikemarlen Aug 3, 2023
ca16958
:sparkles: Add program modeling to application.
klondikemarlen Aug 3, 2023
09dff96
:art: Match application_draft interface with null constraint in datab…
klondikemarlen Aug 3, 2023
3ee614a
:art: Match application interface with database null constraints.
klondikemarlen Aug 3, 2023
ad0e3a0
:construction: Add program details to program details hash.
klondikemarlen Aug 3, 2023
32e5b36
:recycle: Drop program hash and just return details as name.
klondikemarlen Aug 3, 2023
3e15e5c
:construction: Add attendance files to application serializer.
klondikemarlen Aug 3, 2023
ce2969d
:art: Fix some casing in model interfaces.
klondikemarlen Aug 3, 2023
64d494e
:tophat: Begin modeling database.
klondikemarlen Aug 3, 2023
311b7e8
:pencil: Update comment about legacy application.
klondikemarlen Aug 3, 2023
1ac965a
:sparkles: Add funding request modeling.
klondikemarlen Aug 3, 2023
d2639d2
:tophat: Add request type modelling.
klondikemarlen Aug 3, 2023
9a010a3
:sparkles: Add helper service to load application funding requests.
klondikemarlen Aug 3, 2023
655db9a
:sparkles: Add funding sources (funding_requests) serialization.
klondikemarlen Aug 3, 2023
9d7328a
:construction: Building out funding sources csfaAmounts.
klondikemarlen Aug 7, 2023
0fc9790
:recycle: Use singular name for model.
klondikemarlen Aug 8, 2023
33a5f1e
:recycle: Use shared constant for CSFA amounts.
klondikemarlen Aug 8, 2023
557d60c
:abc: Alphabetize imports.
klondikemarlen Aug 8, 2023
a6bdaa2
:tophat: Model funding source and csfa amount constants.
klondikemarlen Aug 8, 2023
13e2123
:abc: Alphabetize relationships.
klondikemarlen Aug 8, 2023
15d45e9
:sparkles: Add student model linked to application.
klondikemarlen Aug 8, 2023
c23b5bb
:art: Prettify erd code.
klondikemarlen Aug 8, 2023
1cbe4db
:tophat: Add student modeling info.
klondikemarlen Aug 8, 2023
a3a3e46
:construction: Add placeholder wiring for personal details in applica…
klondikemarlen Aug 8, 2023
699b524
:fire: Drop now redundant manual reference to schema.
klondikemarlen Aug 8, 2023
e694b18
:sparkles: Add person model linked to student.
klondikemarlen Aug 8, 2023
e8ad758
:tophat: Diagram person model.
klondikemarlen Aug 8, 2023
8397d72
:sparkles: Load student and person data; serialize to personal details.
klondikemarlen Aug 8, 2023
1ff078c
:construction: Add mock of addresses section.
klondikemarlen Aug 8, 2023
500348f
:sparkles: Add person address model.
klondikemarlen Aug 8, 2023
2ca7980
:tophat: Add person address modeling to erd.
klondikemarlen Aug 8, 2023
782f645
:sparkles: Add address serialization to application serializer.
klondikemarlen Aug 8, 2023
68b1ede
:tophat: Add erd info about address types.
klondikemarlen Aug 8, 2023
e6b9c55
:recycle: Simply person details generation.
klondikemarlen Aug 8, 2023
83b7034
:construction: begin building out statistical section of application …
klondikemarlen Aug 8, 2023
5a2c217
:beetle: Fix bug in student retrieval.
klondikemarlen Aug 8, 2023
d65c74c
:construction: Add citizenship to application data.
klondikemarlen Aug 9, 2023
a34641a
:fire: Drop now unused language import.
klondikemarlen Aug 9, 2023
f3c59ef
:pencil: Add note about serializer future patterns.
klondikemarlen Aug 9, 2023
6a7264b
:ok_hand: Add missing program details section field.
klondikemarlen Aug 9, 2023
471ee49
:pencil: Add note about possibility of needing a "parents" field.
klondikemarlen Aug 9, 2023
444b86c
:sparkles: Add statistical section to application serializer.
klondikemarlen Aug 9, 2023
63ec4dd
:sparkles: Add student consent model.
klondikemarlen Aug 9, 2023
b0069cc
:tophat: Add disability, language, sex and student consent modeling.
klondikemarlen Aug 9, 2023
ab85ffa
:beetle: Fix join condition between person and sex and language.
klondikemarlen Aug 9, 2023
30583da
:recycle: Rename addresses assocation on person to personAddresses.
klondikemarlen Aug 9, 2023
29b45d8
:sparkles: Add student consents section.
klondikemarlen Aug 9, 2023
43564b7
:sparkles: Return residency info in student application endpoint.
klondikemarlen Aug 9, 2023
7642975
:tophat: Add residency to ERD.
klondikemarlen Aug 9, 2023
9333799
:construction: Begin work on returning education info.
klondikemarlen Aug 9, 2023
d259888
:truck: Rename funding request to funding sources.
klondikemarlen Aug 10, 2023
31299f0
:recycle: Switch to return full funding request and request type obje…
klondikemarlen Aug 10, 2023
2b6c817
:sparkles: Return assessments from funding request service.
klondikemarlen Aug 10, 2023
11e3182
:sparkles: Add disbursements to assessments payload.
klondikemarlen Aug 10, 2023
aa17ef6
:hammer: Add plantuml server to development environment.
klondikemarlen Aug 10, 2023
fd7f023
:tophat: Add assessement to funding request modeling.
klondikemarlen Aug 10, 2023
424ffda
:tophat: Add data modeling for disbursement model.
klondikemarlen Aug 10, 2023
57023d8
:wrench: Change default schema for test setup.
klondikemarlen Aug 11, 2023
3292155
:beetle: Fix typo in route naming.
klondikemarlen Aug 11, 2023
28eb33a
:european_castle: Handle case where application is not found.
klondikemarlen Aug 11, 2023
ad22ab2
:art: Prettify portal index.
klondikemarlen Aug 11, 2023
165e1db
:art: Clean up student application draft database access and prettify.
klondikemarlen Aug 11, 2023
2bdbe41
:beetle: Fix student application draft service return type.
klondikemarlen Aug 11, 2023
388bda0
:sparkles: Return application draft application json as object instea…
klondikemarlen Aug 11, 2023
3249f4f
:sparkles: Add education history to student application blob.
klondikemarlen Aug 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Design/Entity Relationship Diagrams.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
533 changes: 533 additions & 0 deletions Design/Entity Relationship Diagrams.wsd

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion docker-compose.development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
<<: *environment-definition
NODE_ENV: test
DB_NAME: sfa_client_test
DB_DEFAULT_SCHEMA: dbo
DB_DEFAULT_SCHEMA: sfa
tty: true
volumes:
- ./src/api:/usr/src/api
Expand Down Expand Up @@ -85,6 +85,16 @@ services:
- 8081:8080
- 8085:8085

# For easily generating large PlantUML diagrams
# Not relevant to production environment.
# Accessible at http://localhost:9999
plantuml:
image: plantuml/plantuml-server:jetty
ports:
- 9999:8080
environment:
PLANTUML_LIMIT_SIZE: 8192

volumes:
db_data:
s3storage:
17 changes: 17 additions & 0 deletions src/api/controllers/base-controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Request, Response, NextFunction } from "express"

export default class BaseController {
protected request: Request
protected response: Response
protected next: NextFunction

constructor(request: Request, response: Response, next: NextFunction) {
this.request = request
this.response = response
this.next = next
}

protected get params() {
return this.request.params
}
}
19 changes: 19 additions & 0 deletions src/api/controllers/helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Request, Response, NextFunction } from "express"

import BaseController from "@/controllers/base-controller"

export function routedTo<T extends typeof BaseController>(
controllerClass: T,
method: string & keyof InstanceType<T>
) {
return (req: Request, res: Response, next: NextFunction) => {
const controllerInstance = new controllerClass(req, res, next) as InstanceType<T>
const unboundControllerMethod = controllerInstance[method]

if (typeof unboundControllerMethod === "function") {
return unboundControllerMethod.call(controllerInstance)
} else {
throw new Error(`Method ${method} is not a function on the provided controller class`)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import BaseController from "@/controllers/base-controller"

import ApplicationDraftsSerializer from "@/serializers/application-drafts-serializer";
import StudentApplicationDraftsService from "@/services/portal/students/student-application-drafts-service";

export default class StudentApplicationDraftsController extends BaseController {
listStudentApplicationDrafts() {
const studentId = parseInt(this.params.studentId)

const applicationService = new StudentApplicationDraftsService({ studentId })
return applicationService
.getApplicationDrafts()
.then((applicationDrafts) => {
const applicationDraftsSerializer = new ApplicationDraftsSerializer(applicationDrafts);
const data = applicationDraftsSerializer.asListView()
this.response.json({ data })
})
.catch((error: { message: string }) => {
this.response.status(404).json({ error: error.message })
})
}

getStudentApplicationDraft() {
const studentId = parseInt(this.params.studentId)
const applicationDraftId = parseInt(this.params.applicationDraftId)

const applicationService = new StudentApplicationDraftsService({ studentId, applicationDraftId })
return applicationService
.getApplicationDraft()
.then((applicationDraft) => {
const applicationDraftsSerializer = new ApplicationDraftsSerializer(applicationDraft);
const data = applicationDraftsSerializer.asDetailedView()
this.response.json({ data })
})
.catch((error: { message: string }) => {
this.response.status(404).json({ error: error.message })
})
}

#getStudent(studentId: number) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import BaseController from "@/controllers/base-controller"

import ApplicationsSerializer from "@/serializers/applications-serializer"
import StudentApplicationsService from "@/services/portal/students/student-applications-service"

export default class StudentApplicationsController extends BaseController {
listStudentApplications() {
const studentId = parseInt(this.params.studentId)

const applicationService = new StudentApplicationsService({ studentId })
return applicationService
.getApplications()
.then((applications) => {
const applicationSerializer = new ApplicationsSerializer(applications)
const data = applicationSerializer.asListView()
this.response.json({ data })
})
.catch((error: { message: string }) => {
this.response.status(404).json({ error: error.message })
})
}

getStudentApplication() {
const studentId = parseInt(this.params.studentId)
const applicationId = parseInt(this.params.applicationId)

const applicationService = new StudentApplicationsService({ studentId, applicationId })
return applicationService
.getApplication()
.then((application) => {
const applicationSerializer = new ApplicationsSerializer(application)
const data = applicationSerializer.asDetailedView()
this.response.json({ data })
})
.catch((error: { message: string }) => {
this.response.status(404).json({ error: error.message })
})
}

#getStudent(studentId: number) {}
}
31 changes: 31 additions & 0 deletions src/api/models/address-type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// TODO: question whether this should be in the database at all.
// And if so, why is it its own table?
enum AddressTypes {
HOME = 1,
MAILING = 2,
SCHOOL = 3,
PARENT = 4,
}

export default class AddressType {
id: number
description: string
isActive: boolean

constructor({
id,
description,
isActive,
}: {
id: number
description: string
isActive: boolean
}) {
this.id = id
this.description = description
this.isActive = isActive
}

// not in database
static readonly Types = AddressTypes
}
11 changes: 11 additions & 0 deletions src/api/models/application-draft.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default interface ApplicationDraft {
id: number
studentId: number
academicYearId: number
createDate: Date
updateDate: Date
isActive?: boolean
applicationJson: string
submitDate?: Date
status?: string
}
167 changes: 167 additions & 0 deletions src/api/models/application.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,170 @@
import Attendance from "@/models/attendance"
import FundingRequest from "@/models/funding-request"
import Institution from "@/models/institution"
import PersonAddress from "@/models/person-address"
import Program from "@/models/program"
import Student from "@/models/student"

// Application with standard JS naming conventions
// trailing underscore to avoid conflicting with legacy Application format
export default interface Application_ {
id: number
studentId: number
academicYearId: number
institutionCampusId?: number
studyAreaId?: number
programId?: number
aboriginalStatusId?: number
maritalStatusId?: number
categoryId?: number
firstNationId?: number
spouseId?: number
parent1Id?: number
parent2Id?: number
primaryAddressId?: number
parent1RelationshipId?: number
parent2RelationshipId?: number
parent1Income?: number
parent1NetIncome?: number
parent1TaxPaid?: number
parent2Income?: number
parent2NetIncome?: number
parent2TaxPaid?: number
schoolEmail?: string
schoolTelephone?: string
spouseHsEndYear?: number
spouseHsEndMonth?: number
spousePrestudyEmpStatusId?: number
spousePstudySchoolFrom?: Date
spousePstudySchoolTo?: Date
spousePstudyIncomeComment?: string
spouseStudyEmpStatusId?: number
spouseStudySchoolFrom?: Date
spouseStudySchoolTo?: Date
isSpouseStudyCsl: boolean
isSpouseStudyBus: boolean
spouseStudyDistance?: number
spouseStudyIncomeComment?: string
classesStartDate?: Date
classesEndDate?: Date
isCorrespondence: boolean
isCoopPaid: boolean
citizenshipStatus?: number
isDisabled: boolean
isMinority: boolean
studentNumber?: string
programYearTotal?: number
programYear?: number
isTwoResidence: boolean
isMoving: boolean
cslClassification?: number
cslPreviousProvinceId?: number
programDivisionExplanation?: string
prestudyAccomCode?: number
prestudyOwnHome: boolean
prestudyBoardAmount?: number
prestudyCityId?: number
prestudyProvinceId?: number
prestudyBus: boolean
prestudyDistance?: number
prestudyEmployStatusId?: number
prestudyEmployedFromDate?: Date
prestudyEmployedToDate?: Date
prestudyEmployerName?: string
prestudyEmployerCityId?: number
prestudyEmployerProvinceId?: number
studyAccomCode?: number
studyOwnHome: boolean
studyBoardAmount?: number
studyCityId?: number
studyProvinceId?: number
studyBus: boolean
studyDistance?: number
statInfoComment?: string
booksSuppliesCost?: number
outstandingCslptAmount?: number
previousCsgPtAmount?: number
percentOfFullTime?: number
isPartOfFt: boolean
studyWeeksCount?: number
classHoursPerWeek?: number
parentResidenceComment?: string
studyLivingWSpouse: boolean
prestudyLivingWSpouse: boolean
tuitionEstimateAmount?: number
programDivision?: number
isPreviousCslft: boolean
isPreviousCslpt: boolean
coopStartYear?: number
coopStartMonth?: number
coopEndYear?: number
coopEndMonth?: number
excludeFromCount: boolean
isPermDisabled: boolean
disabledEquipment?: string
previousCsgDisabilityAmount?: number
previousCsgFemDocAmount?: number
creditChkReqdDate?: Date
creditChkFaxSentDate?: Date
creditChkPassedDate?: Date
creditChkPassed: boolean
creditChkAppealDate?: Date
creditChkAppCompDate?: Date
creditChkAppComp: boolean
creditChkCompDate?: Date
cslClearanceDate?: Date
prestudyCslClassification?: number
yeaTotReceiptAmount?: number
academicPercent?: number
cslRestrictionComment?: string
inProgressPage?: number
onlineStartDate?: Date
onlineSubmitDate?: Date
remTransitionGrantYears?: number
studentLn150Income?: number
spouseLn150Income?: number
taxes1FiledYear?: number
taxes2FiledYear?: number
taxes1FiledProvinceId?: number
taxes2FiledProvinceId?: number
taxes1NotFiled: boolean
taxes2NotFiled: boolean
taxes1Verified: boolean
taxes2Verified: boolean
appliedOtherFunding: boolean
cslRestrictionWarnId?: number
cslRestrictionReasonId?: number
coursesPerWeek?: number
prestudyStartDate?: Date
prestudyEndDate?: Date
validDriverLicense?: boolean
validDriverLicenseComment?: string
validYhcip?: boolean
validYhcipComment?: string
attendanceId?: number
hasConsentToShareData: boolean
permanentDisability: boolean
persOrProlongDisability: boolean
disabilityStartDate?: Date
requiresCreditCheck: boolean
lastCheckedOn?: Date
seen: boolean
updatedAt?: Date
lastJurisdictionId?: number
otherJurisdiction?: string
spouseLastJurisdictionId?: number
spouseOtherJurisdiction?: string
isPersistDisabled: boolean
persistDisabledStartDate?: Date
isChequesToInstitution: boolean
attendance?: Attendance
fundingRequests?: FundingRequest[]
institution?: Institution
primaryAddress?: PersonAddress
program?: Program
student?: Student
}

export interface Application {
id: number;
student_id: number;
Expand Down
Loading