Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion server/drizzle/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export const meetingFormatEnum = pgEnum("meeting_format_enum", [
"in-person",
"virtual",
"hybrid",
"no-preference",
]);
export const menteeStatusEnum = pgEnum("mentee_status_enum", [
"active",
Expand Down
4 changes: 2 additions & 2 deletions server/scripts/test-recommendations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type MentorInput = {
whyInterestedResponses: string[];
careerAdvice: string;
preferredMenteeCareerStages: string[];
preferredMeetingFormat: "in-person" | "virtual" | "hybrid" | "no-preference";
preferredMeetingFormat: "in-person" | "virtual" | "hybrid";
hoursPerMonthCommitment: number;
};

Expand All @@ -49,7 +49,7 @@ type MenteeInput = {
roleModelInspiration: string;
hopeToGainResponses: string[];
mentorQualities: string[];
preferredMeetingFormat: "in-person" | "virtual" | "hybrid" | "no-preference";
preferredMeetingFormat: "in-person" | "virtual" | "hybrid";
hoursPerMonthCommitment: number;
};

Expand Down
11 changes: 4 additions & 7 deletions server/src/data/db/recommendation-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,13 @@ scored_mentors AS (
) * ${sql.raw(String(VECTOR_SIMILARITY_WEIGHT))} AS vector_score,

-- Meeting format compatibility (weight: 0.15)
-- Full match: 1.0, partial match: 0.6, no preference involved: 0.8, no match: 0.3
-- Full match: 1.0, partial match: 0.8, no match: 0.3
CASE
-- Exact match
WHEN m.preferred_meeting_format = md.mentee_meeting_format THEN 1.0
-- Either has no preference
WHEN m.preferred_meeting_format = 'no-preference' OR md.mentee_meeting_format = 'no-preference' THEN 0.9
WHEN m.preferred_meeting_format IS NULL OR md.mentee_meeting_format IS NULL THEN 0.8
-- Hybrid matches with in-person or virtual
WHEN m.preferred_meeting_format = 'hybrid' OR md.mentee_meeting_format = 'hybrid' THEN 0.7
-- No match but still consider (diffusion)
-- Either has hybrid
WHEN m.preferred_meeting_format = 'hybrid' AND md.mentee_meeting_format != 'hybrid' THEN 0.8
WHEN m.preferred_meeting_format != 'hybrid' AND md.mentee_meeting_format = 'hybrid' THEN 0.8
ELSE 0.3
END * ${sql.raw(String(MEETING_FORMAT_WEIGHT))} AS format_score,

Expand Down
1 change: 0 additions & 1 deletion server/src/data/db/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export const meetingFormatEnum = pgEnum("meeting_format_enum", [
"in-person",
"virtual",
"hybrid",
"no-preference",
]);

export const careerStageEnum = pgEnum("career_stage_enum", [
Expand Down
12 changes: 2 additions & 10 deletions server/src/data/repository/mentee-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ export class MenteeRepository {
roleModelInspiration?: string,
hopeToGainResponses?: string[],
mentorQualities?: string[],
preferredMeetingFormat?:
| "in-person"
| "virtual"
| "hybrid"
| "no-preference",
preferredMeetingFormat?: "in-person" | "virtual" | "hybrid",
hoursPerMonthCommitment?: number,
): Promise<CreateMenteeOutput> {
// Check if mentee already exists for this user
Expand Down Expand Up @@ -220,11 +216,7 @@ export class MenteeRepository {
roleModelInspiration?: string,
hopeToGainResponses?: string[],
mentorQualities?: string[],
preferredMeetingFormat?:
| "in-person"
| "virtual"
| "hybrid"
| "no-preference",
preferredMeetingFormat?: "in-person" | "virtual" | "hybrid",
hoursPerMonthCommitment?: number,
): Promise<UpdateMenteeOutput> {
const updateData: Partial<typeof mentees.$inferInsert> = {
Expand Down
6 changes: 1 addition & 5 deletions server/src/data/repository/mentor-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ export class MentorRepository {
whyInterestedResponses?: string[],
careerAdvice?: string,
preferredMenteeCareerStages?: string[],
preferredMeetingFormat?:
| "in-person"
| "virtual"
| "hybrid"
| "no-preference",
preferredMeetingFormat?: "in-person" | "virtual" | "hybrid",
hoursPerMonthCommitment?: number,
): Promise<CreateMentorOutput> {
// Check if mentor already exists for this user
Expand Down
24 changes: 5 additions & 19 deletions server/src/types/mentee-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const menteeSchema = z.object({
hopeToGainResponses: z.array(z.string()).nullable().optional(),
mentorQualities: z.array(z.string()).nullable().optional(),
preferredMeetingFormat: z
.enum(["in-person", "virtual", "hybrid", "no-preference"])
.enum(["in-person", "virtual", "hybrid"])
.nullable()
.optional(),
hoursPerMonthCommitment: z.number().int().positive().nullable().optional(),
Expand All @@ -36,9 +36,7 @@ export const createMenteeInputSchema = z.object({
roleModelInspiration: z.string().optional(),
hopeToGainResponses: z.array(z.string()).optional(),
mentorQualities: z.array(z.string()).optional(),
preferredMeetingFormat: z
.enum(["in-person", "virtual", "hybrid", "no-preference"])
.optional(),
preferredMeetingFormat: z.enum(["in-person", "virtual", "hybrid"]).optional(),
hoursPerMonthCommitment: z.number().int().positive().optional(),
});

Expand Down Expand Up @@ -77,12 +75,7 @@ export type CreateMenteeOutput = {
roleModelInspiration?: string | null;
hopeToGainResponses?: string[] | null;
mentorQualities?: string[] | null;
preferredMeetingFormat?:
| "in-person"
| "virtual"
| "hybrid"
| "no-preference"
| null;
preferredMeetingFormat?: "in-person" | "virtual" | "hybrid" | null;
hoursPerMonthCommitment?: number | null;
createdAt: string | Date;
updatedAt: string | Date;
Expand All @@ -100,9 +93,7 @@ export const getMenteeOutputSchema = z.object({
roleModelInspiration: z.string().nullish(),
hopeToGainResponses: z.array(z.string()).nullish(),
mentorQualities: z.array(z.string()).nullish(),
preferredMeetingFormat: z
.enum(["in-person", "virtual", "hybrid", "no-preference"])
.nullish(),
preferredMeetingFormat: z.enum(["in-person", "virtual", "hybrid"]).nullish(),
hoursPerMonthCommitment: z.number().nullish(),
createdAt: z.union([z.string(), z.date()]),
updatedAt: z.union([z.string(), z.date()]),
Expand Down Expand Up @@ -136,12 +127,7 @@ export type UpdateMenteeOutput = {
roleModelInspiration?: string | null;
hopeToGainResponses?: string[] | null;
mentorQualities?: string[] | null;
preferredMeetingFormat?:
| "in-person"
| "virtual"
| "hybrid"
| "no-preference"
| null;
preferredMeetingFormat?: "in-person" | "virtual" | "hybrid" | null;
hoursPerMonthCommitment?: number | null;
createdAt: string | Date;
updatedAt: string | Date;
Expand Down
14 changes: 4 additions & 10 deletions server/src/types/mentor-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const mentorSchema = z.object({
.nullable()
.optional(),
preferredMeetingFormat: z
.enum(["in-person", "virtual", "hybrid", "no-preference"])
.enum(["in-person", "virtual", "hybrid"])
.nullable()
.optional(),
hoursPerMonthCommitment: z.number().int().positive().nullable().optional(),
Expand Down Expand Up @@ -63,9 +63,7 @@ export const createMentorInputSchema = z.object({
]),
)
.optional(),
preferredMeetingFormat: z
.enum(["in-person", "virtual", "hybrid", "no-preference"])
.optional(),
preferredMeetingFormat: z.enum(["in-person", "virtual", "hybrid"]).optional(),
hoursPerMonthCommitment: z.number().int().positive().optional(),
});

Expand All @@ -86,9 +84,7 @@ export const createMentorOutputSchema = z.object({
whyInterestedResponses: z.array(z.string()).nullish(),
careerAdvice: z.string().nullish(),
preferredMenteeCareerStages: z.array(z.string()).nullish(),
preferredMeetingFormat: z
.enum(["in-person", "virtual", "hybrid", "no-preference"])
.nullish(),
preferredMeetingFormat: z.enum(["in-person", "virtual", "hybrid"]).nullish(),
hoursPerMonthCommitment: z.number().nullish(),
createdAt: z.date(),
updatedAt: z.date(),
Expand All @@ -109,9 +105,7 @@ export const getMentorOutputSchema = z.object({
whyInterestedResponses: z.array(z.string()).nullish(),
careerAdvice: z.string().nullish(),
preferredMenteeCareerStages: z.array(z.string()).nullish(),
preferredMeetingFormat: z
.enum(["in-person", "virtual", "hybrid", "no-preference"])
.nullish(),
preferredMeetingFormat: z.enum(["in-person", "virtual", "hybrid"]).nullish(),
hoursPerMonthCommitment: z.number().nullish(),
createdAt: z.date(),
updatedAt: z.date(),
Expand Down
Loading