Skip to content

Commit

Permalink
feat: add bcOnlineCompleted field to data model and frontend, update …
Browse files Browse the repository at this point in the history
…submissionTypes logic
  • Loading branch information
wilwong89 committed Feb 2, 2024
1 parent 4299573 commit b0afeb9
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 162 deletions.
8 changes: 8 additions & 0 deletions app/src/components/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ export const IdentityProvider = Object.freeze({
BCEID: 'bceidbasic',
BCEIDBUSINESS: 'bceidbusiness'
});

/** CHEFS form statuses */
export const APPLICATION_STATUS_LIST = Object.freeze({
NEW: 'New',
IN_PROGRESS: 'In Progress',
DELAYED: 'Delayed',
COMPLETED: 'Completed'
});
1 change: 1 addition & 0 deletions app/src/db/migrations/20231212000000_init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export async function up(knex: Knex): Promise<void> {
table.boolean('addedToATS');
table.text('atsClientNumber');
table.boolean('ltsaCompleted');
table.boolean('bcOnlineCompleted');
table.boolean('naturalDisaster');
table.boolean('financiallySupported');
table.boolean('financiallySupportedBC');
Expand Down
12 changes: 7 additions & 5 deletions app/src/db/models/submission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default {
addedToATS: input.addedToATS,
atsClientNumber: input.atsClientNumber,
ltsaCompleted: input.ltsaCompleted,
bcOnlineCompleted: input.bcOnlineCompleted,
naturalDisaster: input.naturalDisaster,
financiallySupported: input.financiallySupported,
financiallySupportedBC: input.financiallySupportedBC,
Expand All @@ -66,11 +67,11 @@ export default {
user: input.user?.userId ? { connect: { userId: input.user.userId } } : disconnectRelation,
intakeStatus: input.intakeStatus,
applicationStatus: input.applicationStatus,
guidance: input.guidance,
statusRequest: input.statusRequest,
inquiry: input.inquiry,
emergencyAssist: input.emergencyAssist,
inapplicable: input.inapplicable
guidance: input.guidance ? input.guidance : false,
statusRequest: input.statusRequest ? input.statusRequest : false,
inquiry: input.inquiry ? input.inquiry : false,
emergencyAssist: input.emergencyAssist ? input.emergencyAssist : false,
inapplicable: input.inapplicable ? input.inapplicable : false
};
},

Expand Down Expand Up @@ -98,6 +99,7 @@ export default {
addedToATS: input.addedToATS,
atsClientNumber: input.atsClientNumber,
ltsaCompleted: input.ltsaCompleted,
bcOnlineCompleted: input.bcOnlineCompleted,
naturalDisaster: input.naturalDisaster,
financiallySupported: input.financiallySupported,
financiallySupportedBC: input.financiallySupportedBC,
Expand Down
1 change: 1 addition & 0 deletions app/src/db/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ model submission {
addedToATS Boolean?
atsClientNumber String?
ltsaCompleted Boolean?
bcOnlineCompleted Boolean?
naturalDisaster Boolean?
financiallySupported Boolean?
financiallySupportedBC Boolean?
Expand Down
2 changes: 2 additions & 0 deletions app/src/services/chefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import axios from 'axios';
import config from 'config';

import { APPLICATION_STATUS_LIST } from '../components/constants';
import { getChefsApiKey, isTruthy } from '../components/utils';
import prisma from '../db/dataConnection';
import { submission } from '../db/models';
Expand Down Expand Up @@ -90,6 +91,7 @@ const service = {
await prisma.submission.create({
data: {
submissionId: response.submission.id,
applicationStatus: APPLICATION_STATUS_LIST.NEW,
confirmationId: response.submission.confirmationId,
contactEmail: submission.contactEmail,
contactPhoneNumber: submission.contactPhoneNumber,
Expand Down
11 changes: 6 additions & 5 deletions app/src/types/ChefsSubmissionForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type ChefsSubmissionForm = {
addedToATS: boolean | null;
atsClientNumber: string | null;
ltsaCompleted: boolean | null;
bcOnlineCompleted: boolean | null;
naturalDisaster: boolean | null;
financiallySupported: boolean | null;
financiallySupportedBC: boolean | null;
Expand All @@ -35,9 +36,9 @@ export type ChefsSubmissionForm = {
user: User | null; // assigned to
intakeStatus: string | null;
applicationStatus: string | null;
guidance: boolean | null;
statusRequest: boolean | null;
inquiry: boolean | null;
emergencyAssist: boolean | null;
inapplicable: boolean | null;
guidance: boolean;
statusRequest: boolean;
inquiry: boolean;
emergencyAssist: boolean;
inapplicable: boolean;
} & Partial<IStamps>;
Loading

0 comments on commit b0afeb9

Please sign in to comment.