UniHunt / src /lib /types.ts
ashnhash's picture
Cursor
Report only courses published on the university's own website, and give candidates a wishlist they can label, share, and document.
3929396
Raw History Blame Contribute Delete
4.74 kB
import type { FitCategory } from "./candidate-fit";
export type { FitCategory };
export type CourseLevel =
| "Diploma"
| "Certificate"
| "Associate"
| "Undergraduate"
| "Postgraduate"
| "Masters"
| "Doctorate"
| "Postdoctoral";
export type CourseType =
| "Engineering"
| "Medicine"
| "Bachelor's"
| "Master's"
| "Masters Integrated"
| "PhD"
| "Business"
| "Law"
| "Arts & Humanities"
| "Science"
| "Technology"
| "Other";
export type CandidateType = "in-state" | "out-of-state" | "out-of-country";
export interface SearchCriteria {
courseLevel: CourseLevel | "";
courseType: CourseType | "";
specialization: string;
countries: string[];
candidateType: CandidateType | "";
lastQualification: string;
lastSchool: string;
curriculum: string;
subjects: string;
grades: string;
budgetMax: string;
additionalNotes: string;
}
/**
* Wire format accepted by the search API: the same shape as `SearchCriteria`,
* but with the form's literal unions widened to plain strings so request
* validation does not have to re-declare them.
*/
export type SearchCriteriaInput = Omit<
SearchCriteria,
"courseLevel" | "courseType" | "candidateType"
> & {
courseLevel: string;
courseType: string;
candidateType: string;
};
export interface UniversityCourseResult {
id: string;
universityName: string;
universityLocation: string;
courseName: string;
courseLevel: string;
courseType: string;
specialization: string;
country: string;
qsWorldRanking: number | null;
tuitionFee: string;
admissionRequirements: string;
courseUrl: string;
duration: string;
language: string;
intakePeriod: string;
scholarshipInfo: string;
/** How this course fits the candidate profile used for the search. */
fit?: FitCategory;
fitReason?: string;
}
export interface CourseSearchOutcome {
results: UniversityCourseResult[];
warning?: string;
}
export type ImportantDateCategory =
| "application_open"
| "application_deadline"
| "entrance_exam"
| "scholarship"
| "offer_or_result"
| "fee_payment"
| "session_start"
| "orientation"
| "other";
export interface ImportantDate {
label: string;
category: ImportantDateCategory;
/** ISO calendar date (YYYY-MM-DD) when it could be resolved, else null. */
date: string | null;
/** The date exactly as the university wrote it, e.g. "15 June 2026". */
dateText: string;
details: string;
sourceUrl: string;
}
export interface ImportantDatesReport {
dates: ImportantDate[];
sources: Array<{ title: string; url: string }>;
/** Registrable host the search was restricted to, e.g. "bits-pilani.ac.in". */
host: string | null;
checkedAt: string;
summary: string;
method: "model" | "heuristic";
}
export interface ShortlistedCourse {
id: string;
user_id: string;
important_dates: ImportantDatesReport | null;
important_dates_checked_at: string | null;
university_name: string;
university_location: string | null;
course_name: string;
course_level: string | null;
course_type: string | null;
specialization: string | null;
country: string | null;
qs_world_ranking: number | null;
tuition_fee: string | null;
admission_requirements: string | null;
course_url: string | null;
duration: string | null;
language: string | null;
intake_period: string | null;
scholarship_info: string | null;
notes: string | null;
fit: FitCategory | null;
fit_reason: string | null;
fit_source: "auto" | "manual" | null;
is_manual: boolean;
created_at: string;
updated_at: string;
}
export interface ShortlistInsert {
university_name: string;
university_location?: string;
course_name: string;
course_level?: string;
course_type?: string;
specialization?: string;
country?: string;
qs_world_ranking?: number | null;
tuition_fee?: string;
admission_requirements?: string;
course_url?: string;
duration?: string;
language?: string;
intake_period?: string;
scholarship_info?: string;
notes?: string;
fit?: FitCategory | null;
fit_reason?: string;
fit_source?: "auto" | "manual";
is_manual?: boolean;
}
export interface ShortlistShare {
id: string;
owner_id: string;
owner_email: string;
invite_email: string;
permission: "read" | "comment" | "edit" | "delete";
created_at: string;
}
export interface ShortlistComment {
id: string;
course_id: string;
author_id: string;
author_email: string;
body: string;
created_at: string;
}
export interface ApplicationDocument {
id: string;
course_id: string;
label: string;
details: string | null;
required: boolean;
storage_path: string | null;
file_name: string | null;
uploaded_at: string | null;
created_at: string;
}