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

Website integration #96

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ca76a02
enhance group events DEX message for additional fields such as scope …
tmbattey-2021 Nov 5, 2024
4bc0635
removed null fields for vcep groups
tmbattey-2021 Nov 19, 2024
6780123
clean up uses of 'optional()'
bpow Nov 20, 2024
b280902
cleaning unused code/imports
bpow Dec 17, 2024
e36e042
(WIP) make ExpertPanelAttributesUpdated use IsPublishableApplicationE…
bpow Dec 17, 2024
922390e
cleanup moving towards recognition that PublishableApplicationEvent w…
bpow Dec 17, 2024
97eae58
renaming to fit reality
bpow Dec 17, 2024
3e74bae
more renaming to reflect reality of newer conceptual model (and avoid…
bpow Dec 17, 2024
11dcdda
call magic method properly
bpow Dec 17, 2024
d1d357f
publish "non-expert-panel" events from the outset
bpow Jan 30, 2025
fcf1d3f
publish events from non-EP groups
bpow Feb 3, 2025
e4a35df
refactor base representation of group for DX messages to Group model
bpow Feb 3, 2025
39a9db8
remove redundant parentGroup
bpow Feb 3, 2025
644e362
update test for newer message format
bpow Feb 3, 2025
2276f63
publish scope description updated messages
bpow Feb 3, 2025
2f8027b
trying to be extra sure to use memory db for testing
bpow Feb 3, 2025
358824e
lots of cleanup related to description and application->expertPanel
bpow Feb 4, 2025
11170ea
fix ep publishing (after step *1* approval)
bpow Feb 4, 2025
f7dd74f
test fixes, including FastRefreshDatabase
bpow Feb 4, 2025
cf552dd
more additions to bubble scope_description up to description
bpow Feb 4, 2025
719d60d
more test fixes and ScopeDescription renamings
bpow Feb 4, 2025
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
2 changes: 1 addition & 1 deletion app/Console/Commands/Dev/FixupCSpecApprovalDates.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private function updateStepForAllApplications($step, $eventName)
$expertPanel->save();
Event::dispatch(
new StepDateApprovedUpdated(
application: $expertPanel,
expertPanel: $expertPanel,
step: $step,
dateApproved: $dateApproved
)
Expand Down
2 changes: 1 addition & 1 deletion app/Modules/ExpertPanel/Actions/ApplicationDocumentAdd.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function handle(
$this->updateOrTouchExpertPanel($expertPanel, $document);

$event = new DocumentAdded(
application: $expertPanel,
expertPanel: $expertPanel,
document: $document
);
Event::dispatch($event);
Expand Down
2 changes: 1 addition & 1 deletion app/Modules/ExpertPanel/Actions/CompleteNextAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ public function handle()
$nextAction->save();
$expertPanel->touch();

Event::dispatch(new NextActionCompleted(application: $expertPanel, nextAction: $nextAction));
Event::dispatch(new NextActionCompleted(expertPanel: $expertPanel, nextAction: $nextAction));
}
}
2 changes: 1 addition & 1 deletion app/Modules/ExpertPanel/Actions/ExpertPanelDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public function handle(String $expertPanelUuid)
$expertPanel = ExpertPanel::findByUuidOrFail($expertPanelUuid);
$expertPanel->delete();

event(new ExpertPanelDeleted(application: $expertPanel));
event(new ExpertPanelDeleted(expertPanel: $expertPanel));
}
}
2 changes: 1 addition & 1 deletion app/Modules/ExpertPanel/Actions/NextActionComplete.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function handle(ExpertPanel $expertPanel, NextAction $nextAction, ?string
$nextAction->save();
$expertPanel->touch();

Event::dispatch(new NextActionCompleted(application: $expertPanel, nextAction: $nextAction));
Event::dispatch(new NextActionCompleted(expertPanel: $expertPanel, nextAction: $nextAction));

return $nextAction;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Modules/ExpertPanel/Actions/NextActionUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function handle(
DB::transaction(fn () => $nextAction->save());
$nextAction->update($data);

event(new NextActionUpdated(application: $expertPanel, nextAction: $nextAction, oldData: $oldData));
event(new NextActionUpdated(expertPanel: $expertPanel, nextAction: $nextAction, oldData: $oldData));

return $nextAction->load('assignee');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function handle(
}

event(new SpecificationStatusUpdated(
application: $expertPanel,
expertPanel: $expertPanel,
specification: $specification,
));

Expand Down
2 changes: 1 addition & 1 deletion app/Modules/ExpertPanel/Actions/StepApprovalUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function handle(string $expertPanelUuid, int $step, string $dateApproved)

Event::dispatch(
new StepDateApprovedUpdated(
application: $expertPanel,
expertPanel: $expertPanel,
step: $step,
dateApproved: $dateApproved
)
Expand Down
2 changes: 1 addition & 1 deletion app/Modules/ExpertPanel/Actions/StepApprove.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function handle(
}

event(new StepApproved(
application: $expertPanel,
expertPanel: $expertPanel,
step: $approvedStep,
dateApproved: $dateApproved
));
Expand Down
6 changes: 3 additions & 3 deletions app/Modules/ExpertPanel/Events/ApplicationCompleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ApplicationCompleted extends ExpertPanelEvent
*
* @return void
*/
public function __construct(public ExpertPanel $application)
public function __construct(public ExpertPanel $expertPanel)
{

}
Expand All @@ -33,12 +33,12 @@ public function getLogEntry():string

public function getLogDate():Carbon
{
return $this->application->date_completed;
return $this->expertPanel->date_completed;
}

public function getProperties():array
{
return ['date_completed' => $this->application->date_completed];
return ['date_completed' => $this->expertPanel->date_completed];
}


Expand Down
6 changes: 3 additions & 3 deletions app/Modules/ExpertPanel/Events/ApplicationInitiated.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class ApplicationInitiated extends ExpertPanelEvent
use Dispatchable, InteractsWithSockets, SerializesModels;

public function __construct(
public ExpertPanel $application
public ExpertPanel $expertPanel
)
{}

public function getProperties():array
{
return $this->application->getAttributes();
return $this->expertPanel->getAttributes();
}

public function getLogEntry():string
Expand All @@ -30,7 +30,7 @@ public function getLogEntry():string

public function getLogDate():Carbon
{
return $this->application->date_initiated;
return $this->expertPanel->date_initiated;
}

public function getStep()
Expand Down
2 changes: 1 addition & 1 deletion app/Modules/ExpertPanel/Events/ContactAdded.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ContactAdded extends ExpertPanelEvent
*
* @return void
*/
public function __construct(public ExpertPanel $application, public Person $person)
public function __construct(public ExpertPanel $expertPanel, public Person $person)
{}

public function getLogEntry():string
Expand Down
2 changes: 1 addition & 1 deletion app/Modules/ExpertPanel/Events/ContactRemoved.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ContactRemoved extends ExpertPanelEvent
*
* @return void
*/
public function __construct(public ExpertPanel $application, public Person $person)
public function __construct(public ExpertPanel $expertPanel, public Person $person)
{
//
}
Expand Down
2 changes: 1 addition & 1 deletion app/Modules/ExpertPanel/Events/DocumentAdded.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DocumentAdded extends ExpertPanelEvent
* @return void
*/
public function __construct(
public ExpertPanel $application,
public ExpertPanel $expertPanel,
public Document $document
) {
//
Expand Down
2 changes: 1 addition & 1 deletion app/Modules/ExpertPanel/Events/DocumentDeleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DocumentDeleted extends ExpertPanelEvent
*
* @return void
*/
public function __construct(public ExpertPanel $application, public Document $document)
public function __construct(public ExpertPanel $expertPanel, public Document $document)
{
//
}
Expand Down
2 changes: 1 addition & 1 deletion app/Modules/ExpertPanel/Events/DocumentInfoUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DocumentInfoUpdated extends ExpertPanelEvent
*
* @return void
*/
public function __construct(public ExpertPanel $application, public Document $document)
public function __construct(public ExpertPanel $expertPanel, public Document $document)
{
}

Expand Down
2 changes: 1 addition & 1 deletion app/Modules/ExpertPanel/Events/DocumentMarkedFinal.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DocumentMarkedFinal extends ExpertPanelEvent
*
* @return void
*/
public function __construct(public ExpertPanel $application, public Document $document)
public function __construct(public ExpertPanel $expertPanel, public Document $document)
{
//
}
Expand Down
52 changes: 13 additions & 39 deletions app/Modules/ExpertPanel/Events/ExpertPanelAttributesUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,50 @@

namespace App\Modules\ExpertPanel\Events;

use App\Events\PublishableEvent;
use Illuminate\Broadcasting\Channel;
use App\Modules\Group\Events\PublishableExpertPanelEvent;
use App\Modules\Group\Events\Traits\IsPublishableExpertPanelEvent;
use App\Modules\Group\Events\GroupEvent;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use App\Modules\ExpertPanel\Models\ExpertPanel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class ExpertPanelAttributesUpdated extends ExpertPanelEvent implements PublishableEvent
class ExpertPanelAttributesUpdated extends GroupEvent implements PublishableExpertPanelEvent
{
use Dispatchable, InteractsWithSockets, SerializesModels;
use Dispatchable, InteractsWithSockets, SerializesModels, IsPublishableExpertPanelEvent;

/**
* Create a new event instance.
*
* @return void
*/
public function __construct(public ExpertPanel $application, public array $attributes)
public function __construct(public ExpertPanel $expertPanel, public array $attributes)
{
$this->group = $expertPanel->group;
//
}

public function getLogEntry():string
public function getLogEntry(): string
{
$parts = [];
foreach ($this->attributes as $key=>$value) {
$parts[] = $key.' = '.$value;
foreach ($this->attributes as $key => $value) {
$parts[] = $key . ' = ' . $value;
}

return 'Attributes updated: '.implode('; ', $parts);
return 'Attributes updated: ' . implode('; ', $parts);
}

public function getProperties():array
public function getProperties(): array
{
return $this->attributes;
}

public function getEventType():string
public function getEventType(): string
{
return 'ep_info_updated';
}

public function getPublishableMessage(): array
{
return [
"expert_panel" => [
'id' => $this->application->group->uuid,
'name' => $this->application->display_name,
'type' => $this->application->group->type->name,
'affiliation_id' => $this->application->affiliation_id,
'long_base_name' => $this->application->long_base_name,
'short_base_name' => $this->application->short_base_name,
'hypothesis_group' => $this->application->hypothesis_group,
'membership_description' => $this->application->membership_description,
'scope_description' => $this->application->scope_description
]
];
}

/**
* For PublishableEvent interface that is applied to many sub-classes
*/
public function shouldPublish(): bool
{
return parent::shouldPublish()
&& $this->application->definitionIsApproved;
}

/**
* Get the channels the event should broadcast on.
*
Expand Down
2 changes: 1 addition & 1 deletion app/Modules/ExpertPanel/Events/ExpertPanelDeleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ExpertPanelDeleted extends ExpertPanelEvent
use Dispatchable, InteractsWithSockets, SerializesModels;

public function __construct(
public ExpertPanel $application
public ExpertPanel $expertPanel
) {
}

Expand Down
10 changes: 4 additions & 6 deletions app/Modules/ExpertPanel/Events/ExpertPanelEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

namespace App\Modules\ExpertPanel\Events;

use DateTime;
use Illuminate\Queue\SerializesModels;
use App\Modules\ExpertPanel\Models\ExpertPanel;
use App\Events\RecordableEvent;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
use Ramsey\Uuid\Type\Integer;

/**
* @property App\Modules\Group\Models\Group $group
Expand All @@ -19,7 +17,7 @@ abstract class ExpertPanelEvent extends RecordableEvent
{
use Dispatchable, InteractsWithSockets, SerializesModels;

public function __construct(public ExpertPanel $application)
public function __construct(public ExpertPanel $expertPanel)
{
}

Expand All @@ -35,7 +33,7 @@ public function hasSubject():bool

public function getSubject():Model
{
return $this->application->group;
return $this->expertPanel->group;
}

public function getLogDate():Carbon
Expand All @@ -45,7 +43,7 @@ public function getLogDate():Carbon

public function getStep()
{
return $this->application->current_step;
return $this->expertPanel->current_step;
}

/**
Expand All @@ -66,6 +64,6 @@ public function shouldPublish(): bool

public function __get($key)
{
return $key == 'group' ? $this->application->group : null;
return $key == 'group' ? $this->expertPanel->group : null;
}
}
2 changes: 1 addition & 1 deletion app/Modules/ExpertPanel/Events/NextActionAdded.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class NextActionAdded extends ExpertPanelEvent
*
* @return void
*/
public function __construct(public ExpertPanel $application, public NextAction $nextAction)
public function __construct(public ExpertPanel $expertPanel, public NextAction $nextAction)
{
}

Expand Down
6 changes: 1 addition & 5 deletions app/Modules/ExpertPanel/Events/NextActionCompleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
namespace App\Modules\ExpertPanel\Events;

use Illuminate\Support\Carbon;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use App\Modules\ExpertPanel\Models\NextAction;
use Illuminate\Foundation\Events\Dispatchable;
use App\Modules\ExpertPanel\Models\ExpertPanel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class NextActionCompleted extends ExpertPanelEvent
{
Expand All @@ -22,7 +18,7 @@ class NextActionCompleted extends ExpertPanelEvent
*
* @return void
*/
public function __construct(public ExpertPanel $application, public NextAction $nextAction)
public function __construct(public ExpertPanel $expertPanel, public NextAction $nextAction)
{
//
}
Expand Down
2 changes: 1 addition & 1 deletion app/Modules/ExpertPanel/Events/NextActionUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class NextActionUpdated extends ExpertPanelEvent
*
* @return void
*/
public function __construct(public ExpertPanel $application, public NextAction $nextAction, public array $oldData)
public function __construct(public ExpertPanel $expertPanel, public NextAction $nextAction, public array $oldData)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SpecificationStatusUpdated extends ExpertPanelEvent
*
* @return void
*/
public function __construct(public ExpertPanel $application, public Specification $specification )
public function __construct(public ExpertPanel $expertPanel, public Specification $specification )
{
}

Expand Down
Loading