-
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
Open
ankit-canyon
wants to merge
12
commits into
main
Choose a base branch
from
features/advapp-1152
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,888
−0
Open
[ADVAPP-1152]: Refactor the data models for telephone numbers, email addresses, physical addresses. #1285
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8211c9f
Add models and factories for prospect and student contact information
ankit-canyon 0d8e04c
Delete .config/psysh/psysh_history
ankit-canyon 812f2f8
chore: fix enforcement of copyright on all files
ankit-canyon 008edf0
feat: add boolean casting for is_mobile in Prospect and Student phone…
ankit-canyon 63cb059
feat: update prospect and student models to implement Auditable and i…
ankit-canyon 1797409
feat: rename is_mobile to can_recieve_sms in Prospect and Student pho…
ankit-canyon 86d927c
feat: add primary_email and primary_phone foreign keys to prospects a…
ankit-canyon e9a37a3
feat: add 'order' field to address, phone number, and email models fo…
ankit-canyon 903b3f7
feat: add primaryEmail and primaryPhone relationships to Student model
ankit-canyon e4d828d
feat: update primary email, phone, and address relationships in Prosp…
ankit-canyon 46ad70c
chore: fix enforcement of copyright on all files
ankit-canyon b3fad70
chore: fix code style
Orrison File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
_HiStOrY_V2_ | ||
AdvisingApp\134StudentDataModel\134Models\134StudentPhoneNumber::factory()->create(); | ||
AdvisingApp\134StudentDataModel\134Models\134StudentPhoneNumber::factory()->canRecieveSms()->create(); | ||
AdvisingApp\134StudentDataModel\134Models\134StudentPhoneNumber::factory()->canNotRecieveSms()->create(); | ||
clear | ||
AdvisingApp\134Prospect\134Models\134ProspectPhoneNumber::factory()->create(); | ||
AdvisingApp\134Prospect\134Models\134ProspectPhoneNumber::factory()->create(); | ||
AdvisingApp\134Prospect\134Models\134ProspectPhoneNumber::factory()->create(); | ||
AdvisingApp\134Prospect\134Models\134ProspectPhoneNumber::factory()->canRecieveSms()->create(); | ||
AdvisingApp\134Prospect\134Models\134ProspectPhoneNumber::factory()->canRecieveSms()->create(); | ||
clear | ||
AdvisingApp\134Prospect\134Models\134ProspectPhoneNumber::factory()->canNotRecieveSms()->create(); | ||
AdvisingApp\134Prospect\134Models\134ProspectPhoneNumber::factory()->canNotRecieveSms()->create(); | ||
exit | ||
AdvisingApp\134StudentDataModel\134Models\134StudentEmailAddress::factory(5)->create(); | ||
AdvisingApp\134StudentDataModel\134Models\134StudentEmailAddress::factory(5)->create(); | ||
clear | ||
AdvisingApp\134StudentDataModel\134Models\134StudenAddress::factory(5)->create(); | ||
AdvisingApp\134StudentDataModel\134Models\134StudentAddress::factory(5)->create(); | ||
AdvisingApp\134StudentDataModel\134Models\134StudentAddress::factory(5)->create(); | ||
AdvisingApp\134StudentDataModel\134Models\134StudentAddress::factory(5)->create(); | ||
clear | ||
AdvisingApp\134StudentDataModel\134Models\134StudentPhoneNumber::factory(5)->create(); | ||
AdvisingApp\134StudentDataModel\134Models\134StudentPhoneNumber::factory(5)->create(); | ||
clear | ||
AdvisingApp\134Prospect\134Models\134ProspectEmailAddress::factory(5)->create(); | ||
AdvisingApp\134Prospect\134Models\134ProspectEmailAddress::factory(5)->create(); | ||
AdvisingApp\134Prospect\134Models\134ProspectAddress::factory(5)->create(); | ||
AdvisingApp\134Prospect\134Models\134ProspectAddress::factory(5)->create(); | ||
AdvisingApp\134Prospect\134Models\134ProspectPhoneNumber::factory(5)->create(); | ||
AdvisingApp\134Prospect\134Models\134ProspectPhoneNumber::factory(5)->create(); | ||
exit |
80 changes: 80 additions & 0 deletions
80
app-modules/prospect/database/factories/ProspectAddressFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
|
||
/* | ||
<COPYRIGHT> | ||
|
||
Copyright © 2016-2025, Canyon GBS LLC. All rights reserved. | ||
|
||
Advising App™ is licensed under the Elastic License 2.0. For more details, | ||
see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. | ||
|
||
Notice: | ||
|
||
- You may not provide the software to third parties as a hosted or managed | ||
service, where the service provides users with access to any substantial set of | ||
the features or functionality of the software. | ||
- You may not move, change, disable, or circumvent the license key functionality | ||
in the software, and you may not remove or obscure any functionality in the | ||
software that is protected by the license key. | ||
- You may not alter, remove, or obscure any licensing, copyright, or other notices | ||
of the licensor in the software. Any use of the licensor’s trademarks is subject | ||
to applicable law. | ||
- Canyon GBS LLC respects the intellectual property rights of others and expects the | ||
same in return. Canyon GBS™ and Advising App™ are registered trademarks of | ||
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks | ||
vigorously. | ||
- The software solution, including services, infrastructure, and code, is offered as a | ||
Software as a Service (SaaS) by Canyon GBS LLC. | ||
- Use of this software implies agreement to the license terms and conditions as stated | ||
in the Elastic License 2.0. | ||
|
||
For more information or inquiries please visit our website at | ||
https://www.canyongbs.com or contact us via email at [email protected]. | ||
|
||
</COPYRIGHT> | ||
*/ | ||
|
||
namespace AdvisingApp\Prospect\Database\Factories; | ||
|
||
use AdvisingApp\Prospect\Models\Prospect; | ||
use AdvisingApp\Prospect\Models\ProspectAddress; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
/** | ||
* @extends Factory<ProspectAddress> | ||
*/ | ||
class ProspectAddressFactory extends Factory | ||
{ | ||
private int $maxOrder; | ||
|
||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array<string, mixed> | ||
*/ | ||
public function definition(): array | ||
{ | ||
return [ | ||
'prospect_id' => Prospect::factory(), | ||
'line_1' => fake()->streetAddress(), | ||
'line_2' => fake()->optional()->streetAddress(), | ||
'line_3' => fake()->optional()->citySuffix(), | ||
'city' => fake()->city(), | ||
'state' => fake()->state(), | ||
'postal' => fake()->postcode(), | ||
'country' => fake()->country(), | ||
'type' => fake()->randomElement(['Home', 'Dorm', 'Work']), | ||
'order' => $this->getNewOrder(), | ||
]; | ||
} | ||
|
||
public function getNewOrder(): int | ||
{ | ||
return $this->maxOrder = $this->getMaxOrder() + 1; | ||
} | ||
|
||
public function getMaxOrder(): int | ||
{ | ||
return $this->maxOrder ??= ProspectAddress::max('order') ?? 0; | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
app-modules/prospect/database/factories/ProspectEmailAddressFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
/* | ||
<COPYRIGHT> | ||
|
||
Copyright © 2016-2025, Canyon GBS LLC. All rights reserved. | ||
|
||
Advising App™ is licensed under the Elastic License 2.0. For more details, | ||
see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. | ||
|
||
Notice: | ||
|
||
- You may not provide the software to third parties as a hosted or managed | ||
service, where the service provides users with access to any substantial set of | ||
the features or functionality of the software. | ||
- You may not move, change, disable, or circumvent the license key functionality | ||
in the software, and you may not remove or obscure any functionality in the | ||
software that is protected by the license key. | ||
- You may not alter, remove, or obscure any licensing, copyright, or other notices | ||
of the licensor in the software. Any use of the licensor’s trademarks is subject | ||
to applicable law. | ||
- Canyon GBS LLC respects the intellectual property rights of others and expects the | ||
same in return. Canyon GBS™ and Advising App™ are registered trademarks of | ||
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks | ||
vigorously. | ||
- The software solution, including services, infrastructure, and code, is offered as a | ||
Software as a Service (SaaS) by Canyon GBS LLC. | ||
- Use of this software implies agreement to the license terms and conditions as stated | ||
in the Elastic License 2.0. | ||
|
||
For more information or inquiries please visit our website at | ||
https://www.canyongbs.com or contact us via email at [email protected]. | ||
|
||
</COPYRIGHT> | ||
*/ | ||
|
||
namespace AdvisingApp\Prospect\Database\Factories; | ||
|
||
use AdvisingApp\Prospect\Models\Prospect; | ||
use AdvisingApp\Prospect\Models\ProspectEmailAddress; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
/** | ||
* @extends Factory<ProspectEmailAddress> | ||
*/ | ||
class ProspectEmailAddressFactory extends Factory | ||
{ | ||
private int $maxOrder; | ||
|
||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array<string, mixed> | ||
*/ | ||
public function definition(): array | ||
{ | ||
return [ | ||
'prospect_id' => Prospect::factory(), | ||
'address' => fake()->email(), | ||
'type' => fake()->randomElement(['School', 'Personal', 'Work']), | ||
'order' => $this->getNewOrder(), | ||
]; | ||
} | ||
|
||
public function getNewOrder(): int | ||
{ | ||
return $this->maxOrder = $this->getMaxOrder() + 1; | ||
} | ||
|
||
public function getMaxOrder(): int | ||
{ | ||
return $this->maxOrder ??= ProspectEmailAddress::max('order') ?? 0; | ||
} | ||
} |
103 changes: 103 additions & 0 deletions
103
app-modules/prospect/database/factories/ProspectPhoneNumberFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<?php | ||
|
||
/* | ||
<COPYRIGHT> | ||
|
||
Copyright © 2016-2025, Canyon GBS LLC. All rights reserved. | ||
|
||
Advising App™ is licensed under the Elastic License 2.0. For more details, | ||
see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. | ||
|
||
Notice: | ||
|
||
- You may not provide the software to third parties as a hosted or managed | ||
service, where the service provides users with access to any substantial set of | ||
the features or functionality of the software. | ||
- You may not move, change, disable, or circumvent the license key functionality | ||
in the software, and you may not remove or obscure any functionality in the | ||
software that is protected by the license key. | ||
- You may not alter, remove, or obscure any licensing, copyright, or other notices | ||
of the licensor in the software. Any use of the licensor’s trademarks is subject | ||
to applicable law. | ||
- Canyon GBS LLC respects the intellectual property rights of others and expects the | ||
same in return. Canyon GBS™ and Advising App™ are registered trademarks of | ||
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks | ||
vigorously. | ||
- The software solution, including services, infrastructure, and code, is offered as a | ||
Software as a Service (SaaS) by Canyon GBS LLC. | ||
- Use of this software implies agreement to the license terms and conditions as stated | ||
in the Elastic License 2.0. | ||
|
||
For more information or inquiries please visit our website at | ||
https://www.canyongbs.com or contact us via email at [email protected]. | ||
|
||
</COPYRIGHT> | ||
*/ | ||
|
||
namespace AdvisingApp\Prospect\Database\Factories; | ||
|
||
use AdvisingApp\Prospect\Models\Prospect; | ||
use AdvisingApp\Prospect\Models\ProspectPhoneNumber; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
/** | ||
* @extends Factory<ProspectPhoneNumber> | ||
*/ | ||
class ProspectPhoneNumberFactory extends Factory | ||
{ | ||
private int $maxOrder; | ||
|
||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array<string, mixed> | ||
*/ | ||
public function definition(): array | ||
{ | ||
return [ | ||
'prospect_id' => Prospect::factory(), | ||
'number' => fake()->phoneNumber(), | ||
'ext' => null, | ||
'type' => fake()->randomElement(['Home', 'Mobile', 'Work']), | ||
'can_recieve_sms' => fake()->boolean(), | ||
'order' => $this->getNewOrder(), | ||
]; | ||
} | ||
|
||
public function canNotRecieveSms(): Factory | ||
{ | ||
return $this->state(function (array $attributes) { | ||
return [ | ||
'can_recieve_sms' => false, | ||
]; | ||
}); | ||
} | ||
|
||
public function canRecieveSms(): Factory | ||
{ | ||
return $this->state(function (array $attributes) { | ||
return [ | ||
'can_recieve_sms' => true, | ||
]; | ||
}); | ||
} | ||
|
||
public function withExtension(): Factory | ||
{ | ||
return $this->state(function (array $attributes) { | ||
return [ | ||
'ext' => fake()->randomNumber(), | ||
]; | ||
}); | ||
} | ||
|
||
public function getNewOrder(): int | ||
{ | ||
return $this->maxOrder = $this->getMaxOrder() + 1; | ||
} | ||
|
||
public function getMaxOrder(): int | ||
{ | ||
return $this->maxOrder ??= ProspectPhoneNumber::max('order') ?? 0; | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...odules/prospect/database/migrations/2025_02_04_142318_create_prospect_addresses_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
/* | ||
<COPYRIGHT> | ||
|
||
Copyright © 2016-2025, Canyon GBS LLC. All rights reserved. | ||
|
||
Advising App™ is licensed under the Elastic License 2.0. For more details, | ||
see https://github.com/canyongbs/advisingapp/blob/main/LICENSE. | ||
|
||
Notice: | ||
|
||
- You may not provide the software to third parties as a hosted or managed | ||
service, where the service provides users with access to any substantial set of | ||
the features or functionality of the software. | ||
- You may not move, change, disable, or circumvent the license key functionality | ||
in the software, and you may not remove or obscure any functionality in the | ||
software that is protected by the license key. | ||
- You may not alter, remove, or obscure any licensing, copyright, or other notices | ||
of the licensor in the software. Any use of the licensor’s trademarks is subject | ||
to applicable law. | ||
- Canyon GBS LLC respects the intellectual property rights of others and expects the | ||
same in return. Canyon GBS™ and Advising App™ are registered trademarks of | ||
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks | ||
vigorously. | ||
- The software solution, including services, infrastructure, and code, is offered as a | ||
Software as a Service (SaaS) by Canyon GBS LLC. | ||
- Use of this software implies agreement to the license terms and conditions as stated | ||
in the Elastic License 2.0. | ||
|
||
For more information or inquiries please visit our website at | ||
https://www.canyongbs.com or contact us via email at [email protected]. | ||
|
||
</COPYRIGHT> | ||
*/ | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class () extends Migration { | ||
public function up(): void | ||
{ | ||
Schema::create('prospect_addresses', function (Blueprint $table) { | ||
$table->uuid('id')->primary(); | ||
$table->foreignUuid('prospect_id')->constrained('prospects')->onDelete('cascade'); | ||
$table->string('line_1')->nullable(); | ||
$table->string('line_2')->nullable(); | ||
$table->string('line_3')->nullable(); | ||
$table->string('city')->nullable(); | ||
$table->string('state')->nullable(); | ||
$table->string('postal')->nullable(); | ||
$table->string('country')->nullable(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add a nullable |
||
$table->string('type')->nullable(); | ||
$table->integer('order'); | ||
$table->timestamps(); | ||
|
||
$table->index(['prospect_id', 'order']); | ||
}); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
Schema::dropIfExists('prospect_addresses'); | ||
} | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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"