Skip to content

Commit

Permalink
Added minor to Plan entity with migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Suraj-Ram committed Dec 14, 2024
1 parent f14393b commit 60e25a9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/api/migrations/1734207079520-add-minor-to-plan.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class addMinorToPlan1734207079520 implements MigrationInterface {
name = "addMinorToPlan1734207079520";

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "plan" RENAME COLUMN "notes" TO "minor"`
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "plan" RENAME COLUMN "minor" TO "notes"`
);
}
}
3 changes: 3 additions & 0 deletions packages/api/src/plan/entities/plan.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export class Plan {
@Column({ nullable: true })
major: string;

@Column({ nullable: true })
minor: string;

@Column({ nullable: true })
concentration: string;

Expand Down
2 changes: 2 additions & 0 deletions packages/frontend/hooks/useMinor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ type MinorReturn = MinorResponse & {
* @param minorName The name of the major, ex: "Computer Science, BSCS".
*/
export function useMinor(catalogYear: number, minorName: string): MinorReturn {
console.log("useMinor called with: ", catalogYear, minorName);
// debugger;
const key = `api/minor/${catalogYear}/${minorName}`;

const { data, ...rest } = useSWR(
Expand Down
2 changes: 2 additions & 0 deletions packages/frontend/pages/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ const HomePage: NextPage = () => {
let renderedSidebar = <NoPlanSidebar />;
if (selectedPlan) {
if (selectedPlan.major) {
console.log("PRINTING SELECTED PLAN");
console.log(selectedPlan);
renderedSidebar = (
<Sidebar
selectedPlan={selectedPlan}
Expand Down

0 comments on commit 60e25a9

Please sign in to comment.