Skip to content

Commit

Permalink
Merge pull request #39 from uwblueprint/INTF23-updateappschema
Browse files Browse the repository at this point in the history
[INTF23] updates application schema F23
  • Loading branch information
HeetShah authored Nov 2, 2023
2 parents 8e45bb9 + 1afb798 commit ee9594e
Show file tree
Hide file tree
Showing 6 changed files with 260 additions and 463 deletions.
36 changes: 12 additions & 24 deletions backend/typescript/graphql/types/dashboardType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,25 @@ const dashboardType = gql`
type ApplicationDTO {
id: Int!
academicYear: String
binaryQuestion1: String!
binaryQuestion2: String!
binaryQuestions: [String!]!
dropdownQuestion1: String!
dropdownQuestions: [String!]!
academicOrCoop: String!
academicYear: String!
email: String!
firstChoiceRole: String!
firstName: String!
heardFrom: String!
lastName: String!
positions: [String!]!
locationPreference: String!
program: String!
question1: String!
question2: String!
question3: String!
question4: String!
question5: String!
questions: [String!]!
resume: String!
resumeInput: String!
pronouns: String!
pronounsSpecified: String!
resumeUrl: String!
roleQuestion1: String!
roleQuestion2: String!
roleQuestion3: String!
roleQuestion4: String!
roleQuestion5: String!
roleQuestion6: String!
roleQuestion7: String!
roleQuestion8: String!
roleQuestion9: String!
roleSpecificQuestions: [String!]!
secondChoiceRole: String!
shortAnswerQuestions: [String!]!
status: String!
secondChoiceStatus: String!
term: String!
timesApplied: String!
timestamp: Int!
}
Expand Down
151 changes: 44 additions & 107 deletions backend/typescript/migrations/2023.04.05T17.43.42.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { DataType } from "sequelize-typescript";

import { Migration } from "../umzug";
import allApplications from "./applicationlist.json";
import { DataTypes } from "sequelize";

Check failure on line 7 in backend/typescript/migrations/2023.04.05T17.43.42.ts

View workflow job for this annotation

GitHub Actions / run-lint

`sequelize` import should occur before import of `../umzug`
import { statusType, secondChoiceStatusType } from "../types";

const TABLE_NAME = "applicantresponse";

Expand All @@ -12,57 +14,36 @@ const TABLE_NAME = "applicantresponse";
const importApplicationData = () => {
const seededData = allApplications.map((currApplication) => {
return {
academicOrCoop: currApplication.academicOrCoop,
academicYear: currApplication.academicYear,
binaryQuestion1: currApplication.binaryQuestion1,
binaryQuestion2: currApplication.binaryQuestion2,
binaryQuestions: currApplication.binaryQuestions.map((x) =>
JSON.stringify(x),
),
dropdownQuestion1: currApplication.dropdownQuestion1,
dropdownQuestions: currApplication.dropdownQuestions.map((x) =>
JSON.stringify(x),
),
email: currApplication.email,
firstChoiceRole: currApplication.firstChoiceRole,
firstName: currApplication.firstName,
heardFrom: currApplication.heardFrom,
lastName: currApplication.lastName,
positions: currApplication.positions,
locationPreference: currApplication.locationPreference,
program: currApplication.program,
question1: currApplication.question1,
question2: currApplication.question2,
question3: currApplication.question3,
question4: currApplication.question4,
question5: currApplication.question5,
questions: currApplication.questions.map((x) => JSON.stringify(x)),
resume: "C:\\fakepath\\resume (3).pdf",
resumeInput: currApplication.resumeInput,
pronouns: currApplication.pronouns,
pronounsSpecified: currApplication.pronounsSpecified,
resumeUrl: currApplication.resumeUrl,
roleQuestion1: currApplication.roleQuestion1,
roleQuestion2: currApplication.roleQuestion2,
roleQuestion3: currApplication.roleQuestion3,
roleQuestion4: currApplication.roleQuestion4,
roleQuestion5: currApplication.roleQuestion5,
roleQuestion6: currApplication.roleQuestion6,
roleQuestion7: currApplication.roleQuestion7,
roleQuestion8: currApplication.roleQuestion8,
roleQuestion9: currApplication.roleQuestion9,
roleSpecificQuestions: [
JSON.stringify(currApplication.roleSpecificQuestions),
],
secondChoiceRole: currApplication.secondChoiceRole,
shortAnswerQuestions: [
JSON.stringify(currApplication.shortAnswerQuestions),
],
status: currApplication.status,
timestamp: currApplication.timestamp,
term: currApplication.term,
timesApplied: currApplication.timesApplied,
timestamp: currApplication.timestamp

Check failure on line 39 in backend/typescript/migrations/2023.04.05T17.43.42.ts

View workflow job for this annotation

GitHub Actions / run-lint

Insert `,`
};
});

Check failure on line 42 in backend/typescript/migrations/2023.04.05T17.43.42.ts

View workflow job for this annotation

GitHub Actions / run-lint

Delete `··`
return seededData;
};

export const up: Migration = async ({ context: sequelize }) => {
const binaryQuestions = sequelize.define(
"binaryQuestion",
{ question: DataType.STRING(4000), selected: DataType.STRING(4000) },
{},
);

await sequelize.getQueryInterface().createTable(TABLE_NAME, {
id: {
type: DataType.INTEGER,
Expand All @@ -71,130 +52,84 @@ export const up: Migration = async ({ context: sequelize }) => {
autoIncrement: true,
unique: true,
},
academicYear: {
type: DataType.STRING(4000),
allowNull: true,
},
binaryQuestion1: {
type: DataType.STRING(4000),
allowNull: true,
},
binaryQuestion2: {
academicOrCoop: {
type: DataType.STRING(4000),
allowNull: true,
},
binaryQuestions: {
type: DataType.ARRAY(DataType.STRING(4000)),
allowNull: true,
},
dropdownQuestion1: {
academicYear: {
type: DataType.STRING(4000),
allowNull: true,
},
dropdownQuestions: {
type: DataType.ARRAY(DataType.STRING(4000)),
allowNull: true,
},
email: {
type: DataType.STRING(4000),
allowNull: true,
},
firstName: {
type: DataType.STRING(4000),
allowNull: true,
},
lastName: {
firstChoiceRole: {
type: DataType.STRING(4000),
allowNull: true,
},
positions: {
type: DataType.ARRAY(DataType.STRING(4000)),
allowNull: true,
},
program: {
firstName: {
type: DataType.STRING(4000),
allowNull: true,
},
question1: {
heardFrom: {
type: DataType.STRING(4000),
allowNull: true,
},
question2: {
lastName: {
type: DataType.STRING(4000),
allowNull: true,
},
question3: {
locationPreference: {
type: DataType.STRING(4000),
allowNull: true,
},
question4: {
program: {
type: DataType.STRING(4000),
allowNull: true,
},
question5: {
pronouns: {
type: DataType.STRING(4000),
allowNull: true,
},
questions: {
type: DataType.ARRAY(DataType.STRING(4000)),
allowNull: true,
},
resume: {
type: DataType.STRING(4000),
allowNull: true,
},
resumeInput: {
pronounsSpecified: {
type: DataType.STRING(4000),
allowNull: true,
},
resumeUrl: {
type: DataType.STRING(4000),
allowNull: true,
},
roleQuestion1: {
type: DataType.STRING(4000),
allowNull: true,
},
roleQuestion2: {
type: DataType.STRING(4000),
allowNull: true,
allowNull: true,

Check failure on line 101 in backend/typescript/migrations/2023.04.05T17.43.42.ts

View workflow job for this annotation

GitHub Actions / run-lint

Insert `··`
},
roleQuestion3: {
type: DataType.STRING(4000),
roleSpecificQuestions: {
type: DataType.ARRAY(DataType.STRING(4000)),
allowNull: true,
},
roleQuestion4: {
secondChoiceRole: {
type: DataType.STRING(4000),
allowNull: true,
},
roleQuestion5: {
type: DataType.STRING(4000),
shortAnswerQuestions: {
type: DataType.ARRAY(DataType.STRING(4000)),
allowNull: true,
},
roleQuestion6: {
type: DataType.STRING(4000),
allowNull: true,
status: {
type: DataType.ENUM(...Object.values(statusType)),
allowNull: false,
defaultValue: statusType.PENDING

Check failure on line 118 in backend/typescript/migrations/2023.04.05T17.43.42.ts

View workflow job for this annotation

GitHub Actions / run-lint

Insert `,`
},
roleQuestion7: {
type: DataType.STRING(4000),
allowNull: true,
secondChoiceStatus: {
type: DataTypes.ENUM(...Object.values(secondChoiceStatusType)),
allowNull: false,
defaultValue: secondChoiceStatusType.NOT_APPLICABLE

Check failure on line 123 in backend/typescript/migrations/2023.04.05T17.43.42.ts

View workflow job for this annotation

GitHub Actions / run-lint

Insert `,`
},
roleQuestion8: {
term: {
type: DataType.STRING(4000),
allowNull: true,
},
roleQuestion9: {
timesApplied: {
type: DataType.STRING(4000),
allowNull: true,
},
roleSpecificQuestions: {
type: DataType.ARRAY(DataType.STRING(4000)),
allowNull: true,
},
status: {
type: DataType.ENUM("pending", "accepted", "rejected"),
allowNull: true,
},
timestamp: {
type: DataType.BIGINT,
allowNull: true,
Expand All @@ -204,7 +139,9 @@ export const up: Migration = async ({ context: sequelize }) => {
});

const SEEDED_DATA = importApplicationData();

await sequelize.getQueryInterface().bulkInsert(TABLE_NAME, SEEDED_DATA);

Check failure on line 143 in backend/typescript/migrations/2023.04.05T17.43.42.ts

View workflow job for this annotation

GitHub Actions / run-lint

Delete `⏎`

};

export const down: Migration = async ({ context: sequelize }) => {
Expand Down
Loading

0 comments on commit ee9594e

Please sign in to comment.