Skip to content
Open
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
66 changes: 64 additions & 2 deletions src/domain/member/types.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,64 @@
// Vedanti will develop this
// If you are doing the validation task, I will provide you with the expected domain shape
export type LinuxSkillLevel =

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LinuxSkillLevel, PotentialInvolvement, YearLevel are generally good, this comment is more nitpicky.

We want to capitalise the values in the types, this is not strictly necessary, but these correspond to enums in Prisma, and it is convention for enum values in Prisma to be capitalised, so we prefer the domain to match this.

Would also prefer to use these names for the values (very nitpicky)

LinuxSkillLevel: "NOTHING", "AWARE_OF_EXISTENCE", "BEGINNER_USER", "REGULAR_USER", "POWER_USER", "CONTRIBUTOR"

PotentialInvolvement: "ATTENDING", "SPEAKING", "EXECUTIVE", "PROJECTS"

YearLevel: "FIRST_YEAR", "SECOND_YEAR", "THIRD_YEAR", "FOURTH_YEAR", "FIFTH_YEAR_OR_LATER", "POSTGRADUATE"

| "NOTHING"
| "AWARE_OF_EXISTENCE"
| "BEGINNER_USER"
| "REGULAR_USER"
| "POWER_USER"
| "CONTRIBUTOR";

export type PotentialInvolvement =
| "ATTENDING"
| "SPEAKING"
| "EXECUTIVE"
| "PROJECTS";

export type YearLevel =
| "FIRST_YEAR"
| "SECOND_YEAR"
| "THIRD_YEAR"
| "FOURTH_YEAR"
| "FIFTH_YEAR_OR_LATER"
| "GRADUATED_WITHIN_2_YEARS";

// Shared base fields present on every registration path
export type BaseMemberRegistration = {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good, but one field is missing! (and its an optional field)

Can we also leave an empty line after the email field? (very nitpicky)

firstName: string;
lastName: string;
email: string;
discordUsername?: string;
linuxSkillLevel: LinuxSkillLevel;
potentialInvolvement: PotentialInvolvement[];
};

// Case 1: Returning member - Registration path 1
export type ConditionalReturningMember = BaseMemberRegistration & {
isConditionalReturningMember: true;
upi: string;
studentId: string;
};

// Case 2: Current UoA student - Registration path 2
export type CurrentUoaStudentMember = BaseMemberRegistration & {
isConditionalReturningMember: false;
isCurrentUoaStudent: true;
upi: string;
studentId: string;
faculty: string[];
programme: string;
yearLevel: YearLevel;
};

// Case 3: Non-current UoA student - Registration path 3
export type NonCurrentUoaStudentMember = BaseMemberRegistration & {
isConditionalReturningMember: false;
isCurrentUoaStudent: false;
primaryAffiliation: string;
nonUoaExcerpt?: string;
nonUoaPitch?: string;
};

// Union type used everywhere a registration is handled
export type MemberRegistration =
| ConditionalReturningMember
| CurrentUoaStudentMember
| NonCurrentUoaStudentMember;
Loading