Conversation
|
Please add explain what kind of changes you did with this PR. |
| public function store(StoreMiniGridRequest $request): ApiResource | ||
| { | ||
| $miniGrid = $this->miniGrid::create($request->only('cluster_id', 'name')); | ||
| event('increment.connected.meters.count'); |
There was a problem hiding this comment.
@buralp cluster_meta.connected_meters.increase would be a better name for it.
Please build your events like
- base object (cluster_meta, address, person, ....)
- property (name, gender, meter_id, ....)
- intension ( increase, change, decrease, ..... )
|
|
||
| class ClusterMetaData extends Model | ||
| { | ||
| protected $guarded = []; |
There was a problem hiding this comment.
@buralp Please use ´BaseModel instead of ´Model.
| '\App\Listeners\ClusterMetaDataListener@incrementConnectedMetersCount' | ||
| ); | ||
| $events->listen( | ||
| 'cluster_meta.connected_meters.decrement', |
There was a problem hiding this comment.
@buralp please use decrease instead of decrement
| $meter->save(); | ||
| } | ||
|
|
||
| event('cluster_meta.connected_meters.decrement', $meterParameter); |
| */ | ||
|
|
||
| if ($person->is_customer == 1) { | ||
| event('cluster_meta.registered_customers.decrement', $person); |
| } | ||
|
|
||
| /** @test */ | ||
| public function delete_cluster_meta_data_object_after_deleted_a_miniGrid() |
There was a problem hiding this comment.
you are testing if eloquents delete function.
You are deleting ClusterMetaData object and expect that is deleted 🤔 .
What I understand from the function is; After you delete a mini-grid, the ClusterMetaDataobject will also be automatically deleted. Am I right?
There was a problem hiding this comment.
yes you right. my mistake, i am changing ClusterMetaData to MiniGrid
| { | ||
| use RefreshDatabase; | ||
|
|
||
| /** @test */ |
| } | ||
|
|
||
| /** @test */ | ||
| public function decrement_connected_meters_count_after_deleted_a_meter() |
There was a problem hiding this comment.
@buralp please use decrease instead of decrement
|
|
||
| class ClusterMetaDataListener | ||
| { | ||
| public function incrementConnectedMetersCount(MeterParameter $meterParameter): void |
There was a problem hiding this comment.
@buralp increase would be a better naming. Please change all increment 's with increase .
| 'birth_date' => $this->faker->date(), | ||
| 'sex' => $this->faker->randomKey(['male', 'female']), | ||
| 'is_customer' => 1, | ||
| 'is_customer' => 0, |
There was a problem hiding this comment.
because i want to check that is customer in PersonObserver.php
… Energy Capacity, Registered Customers, Connected Meters on Mini Grid
…ement Cluster Meta Data properties ( registered customers, connected meters )
…( Create miniGrid, Delete MiniGrid, Add Customer, Delete Customer, Add Meter, Delete Meter)
36a5989 to
4f402ee
Compare
Uh oh!
There was an error while loading. Please reload this page.