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

Activity UX/UI alignment #12

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/environments/values.pr.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
patroni:
enabled: false
enabled: true
replicaCount: 2
resources:
limits:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ jobs:
- name: Install dependencies
if: steps.cache-app.outputs.cache-hit != 'true'
run: npm ci
- name: Generate Prisma Schema
run: npm run prisma:generate
- name: Test
run: npm run test
env:
Expand Down
31 changes: 20 additions & 11 deletions app/src/db/migrations/20231212000000_init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,35 @@ export async function up(knex: Knex): Promise<void> {
table.uuid('submissionId').primary();
table.uuid('assignedToUserId').references('userId').inTable('user').onUpdate('CASCADE').onDelete('CASCADE');
table.text('confirmationId').notNullable();
table.text('contactEmail');
table.timestamp('submittedAt', { useTz: true }).notNullable();
table.text('submittedBy').notNullable();
table.text('locationPIDs');
table.text('contactName');
table.text('contactPhoneNumber');
table.text('contactFirstName');
table.text('contactLastName');
table.text('intakeStatus');
table.text('contactEmail');
table.text('projectName');
table.integer('queuePriority');
table.text('singleFamilyUnits');
table.text('streetAddress');
table.text('atsClientNumber');
table.integer('latitude');
table.integer('longitude');
table.integer('queuePriority');
table.text('relatedPermits');
table.text('astNotes');
table.boolean('astUpdated');
table.boolean('addedToATS');
table.text('atsClientNumber');
table.boolean('ltsaCompleted');
table.boolean('naturalDisaster');
table.boolean('financiallySupported');
table.text('applicationStatus');
table.text('relatedPermits');
table.boolean('updatedAai');
table.boolean('financiallySupportedBC');
table.boolean('financiallySupportedIndigenous');
table.boolean('financiallySupportedNonProfit');
table.boolean('financiallySupportedHousingCoop');
table.text('waitingOn');
table.timestamp('submittedAt', { useTz: true }).notNullable();
table.text('submittedBy').notNullable();
table.timestamp('bringForwardDate', { useTz: true });
table.text('notes');
table.text('intakeStatus');
table.text('applicationStatus');
stamps(knex, table);
})
)
Expand Down
75 changes: 46 additions & 29 deletions app/src/db/models/submission.ts
jujaga marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Prisma } from '@prisma/client';
import { default as user } from './user';
import disconnectRelation from '../utils/disconnectRelation';
import { fromYrn, toYrn } from '../../components/utils';

import type { IStamps } from '../../interfaces/IStamps';
import type { ChefsSubmissionForm } from '../../types';
Expand Down Expand Up @@ -33,57 +32,75 @@ export default {
return {
submissionId: input.submissionId,
confirmationId: input.confirmationId,
contactEmail: input.contactEmail,
submittedAt: new Date(input.submittedAt ?? Date.now()),
submittedBy: input.submittedBy,
locationPIDs: input.locationPIDs,
contactName: input.contactName,
contactPhoneNumber: input.contactPhoneNumber,
contactFirstName: input.contactFirstName,
contactLastName: input.contactLastName,
intakeStatus: input.intakeStatus,
contactEmail: input.contactEmail,
projectName: input.projectName,
queuePriority: input.queuePriority,
singleFamilyUnits: input.singleFamilyUnits,
streetAddress: input.streetAddress,
atsClientNumber: input.atsClientNumber,
addedToATS: fromYrn(input.addedToATS),
financiallySupported: fromYrn(input.financiallySupported),
applicationStatus: input.applicationStatus,
latitude: input.latitude,
longitude: input.longitude,
queuePriority: input.queuePriority,
relatedPermits: input.relatedPermits,
updatedAai: fromYrn(input.updatedAai),
astNotes: input.astNotes,
astUpdated: input.astUpdated,
addedToATS: input.addedToATS,
atsClientNumber: input.atsClientNumber,
ltsaCompleted: input.ltsaCompleted,
naturalDisaster: input.naturalDisaster,
financiallySupported: input.financiallySupported,
financiallySupportedBC: input.financiallySupportedBC,
financiallySupportedIndigenous: input.financiallySupportedIndigenous,
financiallySupportedNonProfit: input.financiallySupportedNonProfit,
financiallySupportedHousingCoop: input.financiallySupportedHousingCoop,
waitingOn: input.waitingOn,
submittedAt: new Date(input.submittedAt),
submittedBy: input.submittedBy,
bringForwardDate: input.bringForwardDate ? new Date(input.bringForwardDate) : null,
notes: input.notes,
user: input.user?.userId ? { connect: { userId: input.user.userId } } : disconnectRelation
user: input.user?.userId ? { connect: { userId: input.user.userId } } : disconnectRelation,
intakeStatus: input.intakeStatus,
applicationStatus: input.applicationStatus
};
},

fromDBModel(input: Submission | null): ChefsSubmissionForm | null {
if (!input) return null;

return {
submissionId: input.submissionId as string,
confirmationId: input.confirmationId as string,
contactEmail: input.contactEmail,
submissionId: input.submissionId,
confirmationId: input.confirmationId,
submittedAt: input.submittedAt?.toISOString() as string,
submittedBy: input.submittedBy as string,
locationPIDs: input.locationPIDs,
contactName: input.contactName,
contactPhoneNumber: input.contactPhoneNumber,
contactFirstName: input.contactFirstName,
contactLastName: input.contactLastName,
intakeStatus: input.intakeStatus,
contactEmail: input.contactEmail,
projectName: input.projectName,
queuePriority: input.queuePriority,
singleFamilyUnits: input.singleFamilyUnits,
streetAddress: input.streetAddress,
atsClientNumber: input.atsClientNumber,
addedToATS: toYrn(input.addedToATS as boolean | null),
financiallySupported: toYrn(input.financiallySupported as boolean | null),
applicationStatus: input.applicationStatus,
latitude: input.latitude,
longitude: input.longitude,
queuePriority: input.queuePriority,
relatedPermits: input.relatedPermits,
updatedAai: toYrn(input.updatedAai as boolean | null),
astNotes: input.astNotes,
astUpdated: input.astUpdated,
addedToATS: input.addedToATS,
atsClientNumber: input.atsClientNumber,
ltsaCompleted: input.ltsaCompleted,
naturalDisaster: input.naturalDisaster,
financiallySupported: input.financiallySupported,
financiallySupportedBC: input.financiallySupportedBC,
financiallySupportedIndigenous: input.financiallySupportedIndigenous,
financiallySupportedNonProfit: input.financiallySupportedNonProfit,
financiallySupportedHousingCoop: input.financiallySupportedHousingCoop,
waitingOn: input.waitingOn,
submittedAt: input.submittedAt?.toISOString() as string,
submittedBy: input.submittedBy as string,
bringForwardDate: input.bringForwardDate?.toISOString() ?? null,
notes: input.notes,
user: user.fromDBModel(input.user)
user: user.fromDBModel(input.user),
intakeStatus: input.intakeStatus,
applicationStatus: input.applicationStatus
};
}
};
65 changes: 37 additions & 28 deletions app/src/db/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,43 @@ model knex_migrations_lock {
}

model submission {
submissionId String @id @db.Uuid
assignedToUserId String? @db.Uuid
confirmationId String
contactEmail String?
contactPhoneNumber String?
contactFirstName String?
contactLastName String?
intakeStatus String?
projectName String?
queuePriority Int?
singleFamilyUnits String?
streetAddress String?
atsClientNumber String?
addedToATS Boolean?
financiallySupported Boolean?
applicationStatus String?
relatedPermits String?
updatedAai Boolean?
waitingOn String?
submittedAt DateTime @db.Timestamptz(6)
submittedBy String
bringForwardDate DateTime? @db.Timestamptz(6)
notes String?
createdBy String? @default("00000000-0000-0000-0000-000000000000")
createdAt DateTime? @default(now()) @db.Timestamptz(6)
updatedBy String?
updatedAt DateTime? @db.Timestamptz(6)
user user? @relation(fields: [assignedToUserId], references: [userId], onDelete: Cascade, map: "submission_assignedtouserid_foreign")
submissionId String @id @db.Uuid
assignedToUserId String? @db.Uuid
confirmationId String
submittedAt DateTime @db.Timestamptz(6)
submittedBy String
locationPIDs String?
contactName String?
contactPhoneNumber String?
contactEmail String?
projectName String?
singleFamilyUnits String?
streetAddress String?
latitude Int?
longitude Int?
queuePriority Int?
relatedPermits String?
astNotes String?
astUpdated Boolean?
addedToATS Boolean?
atsClientNumber String?
ltsaCompleted Boolean?
naturalDisaster Boolean?
financiallySupported Boolean?
financiallySupportedBC Boolean?
financiallySupportedIndigenous Boolean?
financiallySupportedNonProfit Boolean?
financiallySupportedHousingCoop Boolean?
waitingOn String?
bringForwardDate DateTime? @db.Timestamptz(6)
notes String?
intakeStatus String?
applicationStatus String?
createdBy String? @default("00000000-0000-0000-0000-000000000000")
createdAt DateTime? @default(now()) @db.Timestamptz(6)
updatedBy String?
updatedAt DateTime? @db.Timestamptz(6)
user user? @relation(fields: [assignedToUserId], references: [userId], onDelete: Cascade, map: "submission_assignedtouserid_foreign")
}

model user {
Expand Down
31 changes: 22 additions & 9 deletions app/src/services/chefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import axios from 'axios';
import config from 'config';

import { getChefsApiKey } from '../components/utils';
import { getChefsApiKey, isTruthy } from '../components/utils';
import prisma from '../db/dataConnection';
import { submission } from '../db/models';

Expand Down Expand Up @@ -50,19 +50,32 @@ const service = {
const response = (await chefsAxios(formId).get(`submissions/${submissionId}`)).data;
const status = (await chefsAxios(formId).get(`submissions/${submissionId}/status`)).data;

const submission = response.submission.submission.data;

const financiallySupportedValues = {
financiallySupportedBC: isTruthy(submission.isBCHousingSupported),
financiallySupportedIndigenous: isTruthy(submission.isIndigenousHousingProviderSupported),
financiallySupportedNonProfit: isTruthy(submission.isNonProfitSupported),
financiallySupportedHousingCoop: isTruthy(submission.isHousingCooperativeSupported)
};

await prisma.submission.create({
data: {
submissionId: response.submission.id,
confirmationId: response.submission.confirmationId,
contactEmail: response.submission.submission.data.contactEmail,
contactPhoneNumber: response.submission.submission.data.contactPhoneNumber,
contactFirstName: response.submission.submission.data.contactFirstName,
contactLastName: response.submission.submission.data.contactLastName,
contactEmail: submission.contactEmail,
contactPhoneNumber: submission.contactPhoneNumber,
contactName: `${submission.contactFirstName} ${submission.contactLastName}`,
financiallySupported: Object.values(financiallySupportedValues).includes(true),
...financiallySupportedValues,
intakeStatus: status[0].code,
projectName: response.submission.submission.data.projectName,
queuePriority: parseInt(response.submission.submission.data.queuePriority),
singleFamilyUnits: response.submission.submission.data.singleFamilyUnits,
streetAddress: response.submission.submission.data.streetAddress,
latitude: parseInt(submission.latitude),
longitude: parseInt(submission.longitude),
naturalDisaster: submission.naturalDisasterInd,
projectName: submission.companyNameRegistered,
queuePriority: parseInt(submission.queuePriority),
singleFamilyUnits: submission.singleFamilyUnits ?? submission.multiFamilyUnits,
kyle1morel marked this conversation as resolved.
Show resolved Hide resolved
streetAddress: submission.streetAddress,
submittedAt: response.submission.createdAt,
submittedBy: response.submission.createdBy
}
Expand Down
38 changes: 23 additions & 15 deletions app/src/types/ChefsSubmissionForm.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
import { User } from './User';
import { YRN } from './YRN';
import { IStamps } from '../interfaces/IStamps';

export type ChefsSubmissionForm = {
submissionId: string; // Primary Key
submissionId: string;
confirmationId: string;
contactEmail: string | null;
submittedAt: string;
submittedBy: string;
locationPIDs: string | null;
contactName: string | null;
contactPhoneNumber: string | null;
contactFirstName: string | null;
contactLastName: string | null;
intakeStatus: string | null;
contactEmail: string | null;
projectName: string | null;
queuePriority: number | null;
singleFamilyUnits: string | null;
streetAddress: string | null;
atsClientNumber: string | null;
addedToATS: YRN;
financiallySupported: YRN;
applicationStatus: string | null;
latitude: number | null;
longitude: number | null;
queuePriority: number | null;
relatedPermits: string | null;
updatedAai: YRN;
astNotes: string | null;
astUpdated: boolean | null;
addedToATS: boolean | null;
atsClientNumber: string | null;
ltsaCompleted: boolean | null;
naturalDisaster: boolean | null;
financiallySupported: boolean | null;
financiallySupportedBC: boolean | null;
financiallySupportedIndigenous: boolean | null;
financiallySupportedNonProfit: boolean | null;
financiallySupportedHousingCoop: boolean | null;
waitingOn: string | null;
submittedAt: string;
submittedBy: string;
bringForwardDate: string | null;
notes: string | null;
user: User | null;
user: User | null; // assigned to
intakeStatus: string | null;
applicationStatus: string | null;
} & Partial<IStamps>;
4 changes: 4 additions & 0 deletions frontend/src/assets/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ a:visited {
}
}

label {
color: #38598a;
}

.wrap-block {
display: inline-block;
overflow-wrap: break-word;
Expand Down
Loading