Skip to content
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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

ankit-canyon
Copy link
Contributor

@ankit-canyon ankit-canyon commented Feb 4, 2025

Ticket(s) or GitHub Issue

Technical Description

Refactor the data models for telephone numbers, email addresses, physical addresses.

Any deployment steps required?

No.

Are any Feature Flags and/or Data Migrations that can eventually be removed Added?

No.


Before contributing and submitting this PR, make sure you have Read, agree, and are compliant with the contributing guidelines.

@ankit-canyon ankit-canyon added the Change Type | New Feature New feature or request label Feb 4, 2025
@ankit-canyon ankit-canyon requested a review from a team February 4, 2025 16:07
@ankit-canyon ankit-canyon marked this pull request as ready for review February 4, 2025 16:15
@Orrison Orrison changed the title [ADVAPP-1157]: Refactor the data models for telephone numbers, email addresses, physical addresses. [ADVAPP-1152]: Refactor the data models for telephone numbers, email addresses, physical addresses. Feb 5, 2025
@Orrison
Copy link
Collaborator

Orrison commented Feb 5, 2025

@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');
Copy link
Collaborator

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');
Copy link
Collaborator

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');
Copy link
Collaborator

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');
Copy link
Collaborator

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');
Copy link
Collaborator

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,
];
Copy link
Collaborator

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"

Comment on lines 57 to 60
'number' => $this->faker->phoneNumber,
'ext' => $this->faker->randomNumber(),
'type' => $this->faker->words(10),
'is_mobile' => $this->faker->boolean,
Copy link
Collaborator

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(),
Copy link
Collaborator

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),
Copy link
Collaborator

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,
Copy link
Collaborator

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.

Copy link
Collaborator

@Orrison Orrison left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Change Type | New Feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants