Skip to content

Feature/member domain model v2#48

Open
strawberri16 wants to merge 11 commits into
mainfrom
feature/member-domain-model-v2
Open

Feature/member domain model v2#48
strawberri16 wants to merge 11 commits into
mainfrom
feature/member-domain-model-v2

Conversation

@strawberri16

Copy link
Copy Markdown
Contributor

added the member registration domain types!

@WilliamTayNZ WilliamTayNZ left a comment

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.

Good work, this is almost there!

There's just a few changes and improvements we could do, so I've left some comments :D

Comment thread src/domain/Member.ts Outdated
@@ -1,2 +1,57 @@
// 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"

| "other";

//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)

Comment thread src/domain/member/types.ts Outdated
potentialInvolvement: PotentialInvolvement[];
};

//case1: if memeber is returning - Registration path 1

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.

For the 3 cases, use the same field names as the updated Prisma schema (isCurrentUoaStudent, primaryAffiliation) etc. Otherwise the structure is good!

@WilliamTayNZ WilliamTayNZ left a comment

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.

Better, still a number of changes we should make and I've explained them as well.

The main thing to note is this: the domain types should be stricter than the Prisma model. Prisma has nullable fields because all registration paths are stored in one table, but each registration type should require the fields needed for that path.

Otherwise good stuff, let's get this PR finished soon 🔥

Also, after you make your changes, do merge the main branch into this branch. This is a good habit as it ensures your changes are compatible with the current main branch of the repository. For this PR, these changes shouldn't really affect the current main branch, but this is a good practice to make a habit.

Comment thread src/domain/member/types.ts Outdated
Comment thread src/domain/member/types.ts Outdated
Comment thread src/domain/member/types.ts Outdated
upi?: string;
studentId?: string;
faculty: string[];
programme?: string;

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.

Current UoA students are required to provide their programme, so this field should be required for this path

@strawberri16 strawberri16 May 27, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

programme made required! stupid mistake on my end!
image

Comment thread src/domain/member/types.ts Outdated
export type NonCurrentUoaStudentMember = BaseMemberRegistration & {
memberType: "NON_CURRENT_UOA_STUDENT";
isCurrentUoaStudent: false;
primaryAffiliation?: string;

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.

Non-current UoA students are required to give their primary affiliation.

In the Prisma schema, this is optional because the other 2 registration paths don't need to provide it. But for this path, it is required.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

image made required!

Comment thread src/domain/member/types.ts Outdated

// Case 2: Current UoA student - Registration path 2
export type CurrentUoaStudentMember = BaseMemberRegistration & {
memberType: "CURRENT_UOA_STUDENT";

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.

As above, we don't want to use a memberType field here.

We should use isConditionalReturningMember: false here, this makes the union stricter and clearly differentiates this path from the conditional returning member path.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

image removed and made changes!

Comment thread src/domain/member/types.ts Outdated

// Case 3: Non-current UoA student - Registration path 3
export type NonCurrentUoaStudentMember = BaseMemberRegistration & {
memberType: "NON_CURRENT_UOA_STUDENT";

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.

Same as above, memberType should be removed and this should include isConditionalReturningMember: false so the union clearly models the three mutually exclusive registration paths

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

image removed and included!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

image removed and included!

Comment thread src/domain/member/types.ts Outdated
lastName: string;
email: string;

discordUsername?: string; //the missing field

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.

awesome, can we remove this comment for merging? the committed domain model should only have comments that explain the model itself

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed! :))

Comment thread src/domain/member/types.ts Outdated
| "THIRD_YEAR"
| "FOURTH_YEAR"
| "FIFTH_YEAR_OR_LATER"
| "GRADUATED_WITHIN_2_YEARS"; // was "POSTGRADUATE" - corrected using the Prisma schema

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.

good catch - can we remove this comment too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed comments :))

Comment thread src/domain/Member.ts Outdated
@@ -0,0 +1,17 @@
export interface Member {

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 file is not needed, so can we delete it :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

deleted!
image

@WilliamTayNZ WilliamTayNZ left a comment

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.

good work! functionally everything is perfect now

just a minor nitpick for the comments on the 3 different cases:

  1. Can we change "Case 1: Returning member" to "Case 1: Conditional returning member" to make it clear it's not just any returning member?

  2. Can we remove "- Registration path 1", "- Registration path 2", "- Registration path 3" for each comment, so they become just "Case 1: Returning member", "Case 2: Current UoA student", "Case 3: Not a current UoA student"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants