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

Add new models and migrations #35

Merged
merged 33 commits into from
Mar 3, 2021

Conversation

wolfrednicolas
Copy link
Contributor

No description provided.

Comment on lines 1 to 19
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBookingCategoriesTable extends Migration
{
public function up()
{
Schema::create('booking_categories', function (Blueprint $table) {
$table->id();
$table->string('label');
$table->timestamps();
});
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Does this need to have its own database table?

Could we do a similar implementation to Keyword Types (TIPOFF/seo#28)?

Copy link
Contributor

Choose a reason for hiding this comment

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

The reason models are used is a possibility to extend resource with configuration in the future. Booking category can define config for a group of bookings, for example category can have "requires_waiver" where one bookings need it, other ones dont.

Copy link
Member

Choose a reason for hiding this comment

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

OK, that makes sense. Thanks

Copy link
Member

Choose a reason for hiding this comment

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

I created issue #40 for this

{
Schema::create('booking_categories', function (Blueprint $table) {
$table->id();
$table->string('label');
Copy link
Member

Choose a reason for hiding this comment

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

I prefer to use name instead of label here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@wolfrednicolas can you rename all labels to names?

The reason I'm using label because name and label is usually different thing. $user->name is John and user->label might be John Thomas - Director of Marketing (Labels are used for text representation of resource).

Copy link
Member

Choose a reason for hiding this comment

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

OK, I tend to prefer the terminology of title and name and making a distinction between those.

With users, I separate out first_name and last_name although the existing app uses name for first_name and name_last for last_name. We'll have to make those updates throughout the codebase in all the packages during this refactoring.

$table->morphs('variation')->nullable();
$table->morphs('experience')->nullable();
$table->morphs('order')->nullable();
// $table->morphs('variation')->nullable();
Copy link
Contributor

Choose a reason for hiding this comment

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

@sl0wik how do we want to write tests for these? I'm not all that familiar with tests for these. Wouldn't these require the tipoff packages these models have been moved into? See my addtional comment below as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Its still to be confimed by @drewroberts #42

We can use those rates inside variations.

Copy link
Member

Choose a reason for hiding this comment

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

I confirm using Variations and moving in this direction.

Copy link
Member

Choose a reason for hiding this comment

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

I created Issue #44 for Variations

@@ -12,7 +12,7 @@ public function up()
{
Schema::create('participants', function (Blueprint $table) {
$table->id();
$table->morphs('user')->nullable();
// $table->morphs('user');
Copy link
Contributor

Choose a reason for hiding this comment

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

This comes close to passing model tests, but since morphs create both an id and type column, the support user model for testing does not work in the scenario.

Copy link
Contributor

Choose a reason for hiding this comment

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

If this is a blocker - we can restore it to user_id.

Copy link
Member

Choose a reason for hiding this comment

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

I prefer a nullable user_id here since the User model is now in the tipoff/authorization package which is required by this package.

Copy link
Member

Choose a reason for hiding this comment

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

CC: @sl0wik Can you make this change and then I will merge?

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

Copy link
Member

@drewroberts drewroberts left a comment

Choose a reason for hiding this comment

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

Thanks to all 3 of you! 🎬

@drewroberts drewroberts merged commit d108adc into main Mar 3, 2021
@drewroberts drewroberts deleted the wolfrednicolas/feature/refactor-bookings branch March 3, 2021 00:34
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.

4 participants