Feature/member domain model v2#48
Conversation
…mber-domain-model-v2
…oaWDCC/lug into feature/member-domain-model-v2
WilliamTayNZ
left a comment
There was a problem hiding this comment.
Good work, this is almost there!
There's just a few changes and improvements we could do, so I've left some comments :D
| @@ -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 = | |||
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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)
| potentialInvolvement: PotentialInvolvement[]; | ||
| }; | ||
|
|
||
| //case1: if memeber is returning - Registration path 1 |
There was a problem hiding this comment.
For the 3 cases, use the same field names as the updated Prisma schema (isCurrentUoaStudent, primaryAffiliation) etc. Otherwise the structure is good!
WilliamTayNZ
left a comment
There was a problem hiding this comment.
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.
| upi?: string; | ||
| studentId?: string; | ||
| faculty: string[]; | ||
| programme?: string; |
There was a problem hiding this comment.
Current UoA students are required to provide their programme, so this field should be required for this path
| export type NonCurrentUoaStudentMember = BaseMemberRegistration & { | ||
| memberType: "NON_CURRENT_UOA_STUDENT"; | ||
| isCurrentUoaStudent: false; | ||
| primaryAffiliation?: string; |
There was a problem hiding this comment.
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.
|
|
||
| // Case 2: Current UoA student - Registration path 2 | ||
| export type CurrentUoaStudentMember = BaseMemberRegistration & { | ||
| memberType: "CURRENT_UOA_STUDENT"; |
There was a problem hiding this comment.
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.
|
|
||
| // Case 3: Non-current UoA student - Registration path 3 | ||
| export type NonCurrentUoaStudentMember = BaseMemberRegistration & { | ||
| memberType: "NON_CURRENT_UOA_STUDENT"; |
There was a problem hiding this comment.
Same as above, memberType should be removed and this should include isConditionalReturningMember: false so the union clearly models the three mutually exclusive registration paths
| lastName: string; | ||
| email: string; | ||
|
|
||
| discordUsername?: string; //the missing field |
There was a problem hiding this comment.
awesome, can we remove this comment for merging? the committed domain model should only have comments that explain the model itself
| | "THIRD_YEAR" | ||
| | "FOURTH_YEAR" | ||
| | "FIFTH_YEAR_OR_LATER" | ||
| | "GRADUATED_WITHIN_2_YEARS"; // was "POSTGRADUATE" - corrected using the Prisma schema |
There was a problem hiding this comment.
good catch - can we remove this comment too?
There was a problem hiding this comment.
removed comments :))
| @@ -0,0 +1,17 @@ | |||
| export interface Member { | |||
There was a problem hiding this comment.
This file is not needed, so can we delete it :)
WilliamTayNZ
left a comment
There was a problem hiding this comment.
good work! functionally everything is perfect now
just a minor nitpick for the comments on the 3 different cases:
-
Can we change "Case 1: Returning member" to "Case 1: Conditional returning member" to make it clear it's not just any returning member?
-
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"?





added the member registration domain types!