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

Dework integration #1

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/Http/Requests/CircleRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ protected function prepareForValidation()
'default_opt_in' => !empty($data['default_opt_in']) ? $data['default_opt_in']:0,
'only_giver_vouch' => !empty($data['only_giver_vouch']) ? $data['only_giver_vouch']:0,
'auto_opt_out' => !empty($data['auto_opt_out']) ? $data['auto_opt_out']:0,
'dework_organization_id' => !empty($data['dework_organization_id']) ? $data['dework_organization_id']:null,
]);

if(array_key_exists('discord_webhook', $data) &&
Expand Down Expand Up @@ -64,7 +65,8 @@ public function rules()
'default_opt_in' => 'integer|min:0|max:1',
'discord_webhook' => 'url',
'only_giver_vouch' => 'integer|min:0|max:1',
'auto_opt_out' => 'integer|min:0|max:1'
'auto_opt_out' => 'integer|min:0|max:1',
'dework_organization_id' => 'string|nullable|max:5000'
];
}
}
3 changes: 2 additions & 1 deletion app/Models/Circle.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class Circle extends Model
'discord_webhook',
'only_giver_vouch',
'is_verified',
'auto_opt_out'
'auto_opt_out',
'dework_organization_id'
];
protected $searchable = [
'protocol_id',
Expand Down
3 changes: 2 additions & 1 deletion app/Repositories/CircleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ public function updateCircle($circle, $request)
'default_opt_in',
'discord_webhook',
'only_giver_vouch',
'auto_opt_out'
'auto_opt_out',
'dework_organization_id'
));

if (!$circle->vouching) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

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

class AddDeworkOrganizationId extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('circles', function (Blueprint $table) {
$table->string('dework_organization_id')->nullable();

Choose a reason for hiding this comment

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

I think a separate table with many-to-one support for external integratinos would be a more reusable model. Allowing for any number of external integrations.

Copy link

Choose a reason for hiding this comment

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

idk, if it is only one field...

I think it would attach to the protocol table

Is this id secret at all? if not, easier as we don't have to think about permissions for it.

And then, I wonder how the permissions work once in coordinape, the user needs an access token for both front ends.. hm

And like Zashton noted in coordinape discord:
This also needs to happen in hasura, as that is handling our migrations now

});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('circles', function (Blueprint $table) {
$table->dropColumn('dework_organization_id');
});
}
}