diff --git a/components/search/Blurb.tsx b/components/search/Blurb.tsx index 353fca1..92ecd99 100644 --- a/components/search/Blurb.tsx +++ b/components/search/Blurb.tsx @@ -1,12 +1,12 @@ import React from "react"; -import { CollegeObject, FilterValues } from "./Search"; +import { CourseObject, FilterValues } from "./Search"; interface BlurbProps { filterData: ( - data: CollegeObject[], + data: CourseObject[], filterValues: FilterValues, - ) => CollegeObject[]; - data: CollegeObject[] | undefined; + ) => CourseObject[]; + data: CourseObject[] | undefined; filterValues: FilterValues; } diff --git a/components/search/Search.tsx b/components/search/Search.tsx index a0aef05..37cedd9 100644 --- a/components/search/Search.tsx +++ b/components/search/Search.tsx @@ -19,28 +19,30 @@ import Link from "next/link"; import { SearchSelect } from "./SearchSelect"; import { getDismissedRecently, getNumSearches } from "@/lib/utils/search"; -export interface CollegeObject { +export interface CourseObject { sendingInstitution: string; courseCode: string; courseName: string; cvcId: string; + assistPath: string; niceToHaves: string[]; units: number; - term: string; - startMonth: number; - startDay: number; - endMonth: number; - endDay: number; tuition: number; + startDate: number; + endDate: number; async: boolean; hasOpenSeats: boolean; hasPrereqs: boolean; instantEnrollment: boolean; - fulfillsGEs: string[]; + fulfillsGEs: FullFillsGE[]; articulatesTo: string[]; - assistPath: string; } +type FullFillsGE = { + category: string; + count: number; +}; + export type FilterValues = { format: boolean[]; enrollment: boolean[]; @@ -112,7 +114,7 @@ const Search = () => { const [sort, setSort] = useState("Default Sort"); - const [courses, setCourses] = useState(); + const [courses, setCourses] = useState(); const [filterValues, setFilterValues] = useState({ format: format, diff --git a/components/search/filter/FilterComponents.tsx b/components/search/filter/FilterComponents.tsx index 319bedb..49e6fae 100644 --- a/components/search/filter/FilterComponents.tsx +++ b/components/search/filter/FilterComponents.tsx @@ -2,7 +2,7 @@ import React, { ChangeEvent, Dispatch, SetStateAction, useState } from "react"; import { FaCheck } from "react-icons/fa"; -import { CollegeObject } from "../Search"; +import { CourseObject } from "../Search"; import { format } from "date-fns"; import { Calendar } from "@/components/ui/calendar"; @@ -185,7 +185,7 @@ export const CalendarFilter = (props: CalendarFilterProps) => { interface InstitutionDropdownProps { defaultValue: string; - courses: CollegeObject[] | undefined; + courses: CourseObject[] | undefined; onChange: Dispatch>; } @@ -203,7 +203,7 @@ export const InstitutionDropdown = (props: InstitutionDropdownProps) => { defaultValue == "Any Institution" ? [] : [defaultValue]; const sendingInstitutions = courses?.map( - (course: CollegeObject) => course.sendingInstitution, + (course: CourseObject) => course.sendingInstitution, ); if (sendingInstitutions) { diff --git a/components/search/filter/Filters.tsx b/components/search/filter/Filters.tsx index 87ceb00..75a3924 100644 --- a/components/search/filter/Filters.tsx +++ b/components/search/filter/Filters.tsx @@ -6,7 +6,7 @@ import { UnitsFilter, } from "./FilterComponents"; import { FaCircleXmark } from "react-icons/fa6"; -import { CollegeObject, FilterValues } from "../Search"; +import { CourseObject, FilterValues } from "../Search"; interface SearchFilterProps { handleClick: () => void; @@ -19,7 +19,7 @@ interface SearchFilterProps { setMin: Dispatch>; setMax: Dispatch>; filterValues: FilterValues; - courses: CollegeObject[] | undefined; + courses: CourseObject[] | undefined; } export const SearchFilters = (props: SearchFilterProps) => { diff --git a/lib/utils/query-db.ts b/lib/utils/query-db.ts index 0e58090..c8cef58 100644 --- a/lib/utils/query-db.ts +++ b/lib/utils/query-db.ts @@ -1,11 +1,11 @@ -import { CollegeObject } from "../../components/search/Search"; +import { CourseObject } from "../../components/search/Search"; -const cache: Record = {}; +const cache: Record = {}; export async function queryDatabase( university: string, ge: string, -): Promise { +): Promise { const cacheKey = university + ge; if (cache[cacheKey] && cache[cacheKey][0]) {