Skip to content

Commit

Permalink
add nupath types and to fetch course
Browse files Browse the repository at this point in the history
  • Loading branch information
daisykucharski committed Nov 11, 2023
1 parent 8a325e5 commit 521681c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 8 additions & 1 deletion packages/api-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
ForgotPasswordDto,
ResetPasswordDto,
courseToString,
NUPath,
} from "@graduate/common";
import { ClassConstructor, plainToInstance } from "class-transformer";

Expand Down Expand Up @@ -131,6 +132,7 @@ interface SearchClass {
subject: string;
prereqs?: INEUAndReq | INEUOrReq;
coreqs?: INEUAndReq | INEUOrReq;
nupaths?: NUPath[];
maxCredits: number;
minCredits: number;
termId: string;
Expand Down Expand Up @@ -188,6 +190,7 @@ function occurrenceToCourse(occurrence: SearchClass): ScheduleCourse2<null> {
numCreditsMin: occurrence.minCredits,
prereqs: occurrence.prereqs,
coreqs: occurrence.coreqs,
nupaths: occurrence.nupaths,
id: null,
};
}
Expand Down Expand Up @@ -228,13 +231,15 @@ class SearchAPIClient {
minCredits
prereqs
coreqs
nupath
}
}
}`,
},
});

const courseData = await res.data.data;
console.log("test");
if (courseData && courseData.class && courseData.class.allOccurrences) {
return occurrencesToCourseByCatalogYear(
courseData?.class?.allOccurrences,
Expand Down Expand Up @@ -268,6 +273,7 @@ class SearchAPIClient {
maxCredits
prereqs
coreqs
nupath
termId
}
}
Expand Down Expand Up @@ -352,7 +358,7 @@ class SearchAPIClient {
search(termId:"${termId}", query: "${searchQuery}", classIdRange: {min: ${minIndex}, max: ${maxIndex}}) {
totalCount
pageInfo { hasNextPage }
nodes { ... on ClassOccurrence { name subject maxCredits minCredits prereqs coreqs classId
nodes { ... on ClassOccurrence { name subject maxCredits minCredits prereqs coreqs nupath classId
}
}
}
Expand All @@ -370,6 +376,7 @@ class SearchAPIClient {
subject: result.subject,
prereqs: result.prereqs,
coreqs: result.coreqs,
nupaths: result.nupaths,
numCreditsMin: result.minCredits,
numCreditsMax: result.maxCredits,
};
Expand Down
8 changes: 5 additions & 3 deletions packages/common/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export enum NUPathEnum {
AD = "Analyzing/Using Data",
DD = "Difference and Diversity",
ER = "Ethical Reasoning",
WF = "First Year Writing",
WD = "Advanced Writing in the Disciplines",
WF = "1st Yr Writing",
WD = "Adv Writ Dscpl",
WI = "Writing Intensive",
EX = "Integration Experience",
CE = "Capstone Experience",
Expand Down Expand Up @@ -170,7 +170,8 @@ export type Requirement2 =
| IOrCourse2
| ICourseRange2
| IRequiredCourse
| Section;
| Section
| "nupath";

/**
* Represents a requirement where X number of credits need to be completed from
Expand Down Expand Up @@ -329,6 +330,7 @@ export interface ScheduleCourse2<T> {
subject: string;
prereqs?: INEUAndReq | INEUOrReq;
coreqs?: INEUAndReq | INEUOrReq;
nupaths?: NUPath[];
numCreditsMin: number;
numCreditsMax: number;
id: T;
Expand Down

0 comments on commit 521681c

Please sign in to comment.