-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ADVAPP-1152]: Refactor the data models for telephone numbers, email addresses, physical addresses. #1285
base: main
Are you sure you want to change the base?
Conversation
@ankit-canyon this had the wrong ticket number. I have corrected it in the title and description. |
{ | ||
Schema::create('student_email_addresses', function (Blueprint $table) { | ||
$table->uuid('id')->primary(); | ||
$table->string('student_id'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, sorry. We should keep this consistent with the rest of the app and have this column called sisid
.
And it should be a foreign key constrained to the students table, cascading on delete.
{ | ||
Schema::create('student_phone_numbers', function (Blueprint $table) { | ||
$table->uuid('id')->primary(); | ||
$table->string('student_id'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, sorry. We should keep this consistent with the rest of the app and have this column called sisid
.
And it should be a foreign key constrained to the students table, cascading on delete.
{ | ||
Schema::create('student_addresses', function (Blueprint $table) { | ||
$table->uuid('id')->primary(); | ||
$table->string('student_id'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, sorry. We should keep this consistent with the rest of the app and have this column called sisid
.
And it should be a foreign key constrained to the students table, cascading on delete.
@@ -324,6 +324,21 @@ public function basicNeedsPrograms(): MorphToMany | |||
)->withTimestamps(); | |||
} | |||
|
|||
public function studentAddress(): HasMany | |||
{ | |||
return $this->hasMany(StudentAddress::class, 'student_id'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need to be updated when student_id
is changed to sisid
.
|
||
public function studentEmailAddress(): HasMany | ||
{ | ||
return $this->hasMany(StudentEmailAddress::class, 'student_id'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need to be updated when student_id
is changed to sisid
.
'state' => $this->faker->state, | ||
'postal' => $this->faker->postcode, | ||
'country' => $this->faker->country, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we add the type
here the random choices can be "Home", "Dorm", and "Work"
'number' => $this->faker->phoneNumber, | ||
'ext' => $this->faker->randomNumber(), | ||
'type' => $this->faker->words(10), | ||
'is_mobile' => $this->faker->boolean, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace each $this->faker
with fake()
return [ | ||
'prospect_id' => Prospect::factory(), | ||
'number' => $this->faker->phoneNumber, | ||
'ext' => $this->faker->randomNumber(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this null
in the definition. And then add a state for withExtension
'prospect_id' => Prospect::factory(), | ||
'number' => $this->faker->phoneNumber, | ||
'ext' => $this->faker->randomNumber(), | ||
'type' => $this->faker->words(10), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than having this be random words. Let's make this a random element selection between: "Home", "Mobile", "Work".
'number' => $this->faker->phoneNumber, | ||
'ext' => $this->faker->randomNumber(), | ||
'type' => $this->faker->words(10), | ||
'is_mobile' => $this->faker->boolean, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add two states to this Factory. mobile
and notMobile
to set this true or false, respectively. But this random generation can stay in the definition.
50558f3
to
4e1c914
Compare
4e1c914
to
eed88f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ankit-canyon I am just marking this so that you can re-request review when you consider Phase 2 complete
…mprove factory definitions
…ne number models and update factories accordingly
…nd students tables
…r prospects and students
81ecc7d
to
e9a37a3
Compare
1cd1adc
to
903b3f7
Compare
|
Ticket(s) or GitHub Issue
Technical Description
Any deployment steps required?
Are any Feature Flags and/or Data Migrations that can eventually be removed Added?
Before contributing and submitting this PR, make sure you have Read, agree, and are compliant with the contributing guidelines.