Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
feat(types): ✨ add previews
Browse files Browse the repository at this point in the history
  • Loading branch information
ecxyzzy committed Dec 28, 2023
1 parent 1a9195c commit fa9910e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
22 changes: 20 additions & 2 deletions packages/types/types/courses.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CourseLevel, GECategory } from "./constants";
import { InstructorPreview } from "./instructor";

/**
* An object representing a prerequisite.
Expand Down Expand Up @@ -44,6 +45,11 @@ export type PrerequisiteTree = {
NOT?: Array<Prerequisite | PrerequisiteTree>;
};

/**
* An object that contains a subset of a course's metadata, for preview purposes.
*/
export type CoursePreview = Pick<Course, "id" | "department" | "courseNumber" | "title">;

/**
* An object that represents a course.
* The type of the payload returned on a successful response from querying
Expand Down Expand Up @@ -103,15 +109,15 @@ export type Course = {
*/
prerequisiteTree: PrerequisiteTree;
/**
* The list of prerequisites for the course.
* The list of prerequisites' IDs for the course.
*/
prerequisiteList: string[];
/**
* The catalogue's prerequisite text for the course.
*/
prerequisiteText: string;
/**
* The courses for which this course is a prerequisite.
* The IDs of the courses for which this course is a prerequisite.
*/
prerequisiteFor: string[];
/**
Expand Down Expand Up @@ -154,6 +160,18 @@ export type Course = {
* The list of terms in which this course was offered.
*/
terms: string[];
/**
*
*/
instructors: InstructorPreview[];
/**
*
*/
prerequisites: CoursePreview[];
/**
*
*/
dependencies: CoursePreview[];
};

/**
Expand Down
8 changes: 8 additions & 0 deletions packages/types/types/instructor.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { CoursePreview } from "./courses";

/**
* An object representing an instructor.
* The type of the payload returned on a successful response from querying
Expand Down Expand Up @@ -42,10 +44,16 @@ export type Instructor = {
* the instructor taught the corresponding course.
*/
courseHistory: Record<string, string[]>;
/**
*
*/
courses: CoursePreview[];
};

/**
* The type of the payload returned on a successful response from querying
* ``/v1/rest/instructors/all``.
*/
export type Instructors = Instructor[];

export type InstructorPreview = Pick<Instructor, "ucinetid" | "name" | "shortenedName">;

0 comments on commit fa9910e

Please sign in to comment.