#116 - integration with slack #129
@@ -9,7 +9,7 @@ use Illuminate\Notifications\ChannelManager;
|
|||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Toby\Domain\Slack\SlackApiChannel;
|
use Toby\Domain\Slack\Channels\SlackApiChannel;
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Toby\Domain\Slack;
|
namespace Toby\Domain\Slack\Channels;
|
||||||
|
Can you type Can you type `$notifiable`?
Hm, I don't if I wouldn't put his to Infrastucture directory. Hm, I don't if I wouldn't put his to Infrastucture directory.
Could you extract this config to separate method? It would make further testing easier, I think. Could you extract this config to separate method? It would make further testing easier, I think.
In general, it can be anything that uses trait In general, it can be anything that uses trait `Notifiable`
Oh no, maybe you could add some interface fot that? Oh no, maybe you could add some interface fot that?
Can you type Can you type `$notifiable`?
Hm, I don't if I wouldn't put his to Infrastucture directory. Hm, I don't if I wouldn't put his to Infrastucture directory.
Could you extract this config to separate method? It would make further testing easier, I think. Could you extract this config to separate method? It would make further testing easier, I think.
In general, it can be anything that uses trait In general, it can be anything that uses trait `Notifiable`
Oh no, maybe you could add some interface fot that? Oh no, maybe you could add some interface fot that?
|
|||||||
|
|
||||||
use Illuminate\Http\Client\Response;
|
use Illuminate\Http\Client\Response;
|
||||||
use Illuminate\Notifications\Notification;
|
use Illuminate\Notifications\Notification;
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Toby\Domain\Slack;
|
namespace Toby\Domain\Slack\Exceptions;
|
||||||
|
|
||||||
use Spatie\SlashCommand\Exceptions\SlackSlashCommandException;
|
use Spatie\SlashCommand\Exceptions\SlackSlashCommandException;
|
||||||
|
|
||||||
@@ -9,7 +9,6 @@ use Spatie\SlashCommand\Attachment;
|
|||||||
```suggestion
$absences = $dailySummaryRetriever->getAbsences($now)
->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);
$remoteDays = $dailySummaryRetriever->getRemoteDays($now)
->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);
$birthdays = $dailySummaryRetriever->getBirthdays($now)
->map(fn(User $user): string => $user->profile->full_name);
```
```suggestion
$absences = $dailySummaryRetriever->getAbsences($now)
->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);
$remoteDays = $dailySummaryRetriever->getRemoteDays($now)
->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);
$birthdays = $dailySummaryRetriever->getBirthdays($now)
->map(fn(User $user): string => $user->profile->full_name);
```
What if we would have five more activities? Maybe this could be encapsulated somehow? What if we would have five more activities? Maybe this could be encapsulated somehow?
What if we would have five more activities? Maybe this could be encapsulated somehow? What if we would have five more activities? Maybe this could be encapsulated somehow?
|
|||||||
use Spatie\SlashCommand\Request;
|
use Spatie\SlashCommand\Request;
|
||||||
use Spatie\SlashCommand\Response;
|
use Spatie\SlashCommand\Response;
|
||||||
use Toby\Domain\DailySummaryRetriever;
|
use Toby\Domain\DailySummaryRetriever;
|
||||||
use Toby\Domain\Slack\SignatureHandler;
|
|
||||||
```suggestion
$absences = $dailySummaryRetriever->getAbsences($now)
->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);
$remoteDays = $dailySummaryRetriever->getRemoteDays($now)
->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);
$birthdays = $dailySummaryRetriever->getBirthdays($now)
->map(fn(User $user): string => $user->profile->full_name);
```
What if we would have five more activities? Maybe this could be encapsulated somehow? What if we would have five more activities? Maybe this could be encapsulated somehow?
|
|||||||
use Toby\Eloquent\Models\User;
|
use Toby\Eloquent\Models\User;
|
||||||
use Toby\Eloquent\Models\Vacation;
|
use Toby\Eloquent\Models\Vacation;
|
||||||
|
|
||||||
|
|||||||
```suggestion
$absences = $dailySummaryRetriever->getAbsences($now)
->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);
$remoteDays = $dailySummaryRetriever->getRemoteDays($now)
->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);
$birthdays = $dailySummaryRetriever->getBirthdays($now)
->map(fn(User $user): string => $user->profile->full_name);
```
```suggestion
$absences = $dailySummaryRetriever->getAbsences($now)
->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);
$remoteDays = $dailySummaryRetriever->getRemoteDays($now)
->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);
$birthdays = $dailySummaryRetriever->getBirthdays($now)
->map(fn(User $user): string => $user->profile->full_name);
```
What if we would have five more activities? Maybe this could be encapsulated somehow? What if we would have five more activities? Maybe this could be encapsulated somehow?
What if we would have five more activities? Maybe this could be encapsulated somehow? What if we would have five more activities? Maybe this could be encapsulated somehow?
|
|||||||
@@ -8,10 +8,9 @@ use Illuminate\Validation\ValidationException;
|
|||||||
use Spatie\SlashCommand\Request;
|
use Spatie\SlashCommand\Request;
|
||||||
use Spatie\SlashCommand\Response;
|
use Spatie\SlashCommand\Response;
|
||||||
use Toby\Domain\Notifications\KeyHasBeenGivenNotification;
|
use Toby\Domain\Notifications\KeyHasBeenGivenNotification;
|
||||||
use Toby\Domain\Slack\SignatureHandler;
|
use Toby\Domain\Slack\Exceptions\UserNotFoundException;
|
||||||
use Toby\Domain\Slack\SlackUserExistsRule;
|
use Toby\Domain\Slack\Rules\SlackUserExistsRule;
|
||||||
use Toby\Domain\Slack\Traits\FindsUserBySlackId;
|
use Toby\Domain\Slack\Traits\FindsUserBySlackId;
|
||||||
use Toby\Domain\Slack\UserNotFoundException;
|
|
||||||
use Toby\Eloquent\Models\Key;
|
use Toby\Eloquent\Models\Key;
|
||||||
|
|
||||||
class GiveKeysTo extends SignatureHandler
|
class GiveKeysTo extends SignatureHandler
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ namespace Toby\Domain\Slack\Handlers;
|
|||||||
use Spatie\SlashCommand\Attachment;
|
use Spatie\SlashCommand\Attachment;
|
||||||
use Spatie\SlashCommand\Request;
|
use Spatie\SlashCommand\Request;
|
||||||
use Spatie\SlashCommand\Response;
|
use Spatie\SlashCommand\Response;
|
||||||
use Toby\Domain\Slack\SignatureHandler;
|
|
||||||
use Toby\Domain\Slack\Traits\ListsHandlers;
|
use Toby\Domain\Slack\Traits\ListsHandlers;
|
||||||
|
|
||||||
class Help extends SignatureHandler
|
class Help extends SignatureHandler
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ use Spatie\SlashCommand\Request;
|
|||||||
use Spatie\SlashCommand\Response;
|
use Spatie\SlashCommand\Response;
|
||||||
use Toby\Domain\Actions\VacationRequest\CreateAction;
|
use Toby\Domain\Actions\VacationRequest\CreateAction;
|
||||||
use Toby\Domain\Enums\VacationType;
|
use Toby\Domain\Enums\VacationType;
|
||||||
use Toby\Domain\Slack\SignatureHandler;
|
|
||||||
use Toby\Domain\Slack\Traits\FindsUserBySlackId;
|
use Toby\Domain\Slack\Traits\FindsUserBySlackId;
|
||||||
use Toby\Eloquent\Models\User;
|
use Toby\Eloquent\Models\User;
|
||||||
use Toby\Eloquent\Models\YearPeriod;
|
use Toby\Eloquent\Models\YearPeriod;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ namespace Toby\Domain\Slack\Handlers;
|
|||||||
use Spatie\SlashCommand\Attachment;
|
use Spatie\SlashCommand\Attachment;
|
||||||
use Spatie\SlashCommand\Request;
|
use Spatie\SlashCommand\Request;
|
||||||
use Spatie\SlashCommand\Response;
|
use Spatie\SlashCommand\Response;
|
||||||
use Toby\Domain\Slack\SignatureHandler;
|
|
||||||
use Toby\Eloquent\Models\Key;
|
use Toby\Eloquent\Models\Key;
|
||||||
|
|
||||||
class KeyList extends SignatureHandler
|
class KeyList extends SignatureHandler
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Toby\Domain\Slack;
|
namespace Toby\Domain\Slack\Handlers;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Spatie\SlashCommand\Handlers\SignatureHandler as BaseSignatureHandler;
|
use Spatie\SlashCommand\Handlers\SignatureHandler as BaseSignatureHandler;
|
||||||
@@ -8,10 +8,9 @@ use Illuminate\Validation\ValidationException;
|
|||||||
use Spatie\SlashCommand\Request;
|
use Spatie\SlashCommand\Request;
|
||||||
use Spatie\SlashCommand\Response;
|
use Spatie\SlashCommand\Response;
|
||||||
use Toby\Domain\Notifications\KeyHasBeenTakenNotification;
|
use Toby\Domain\Notifications\KeyHasBeenTakenNotification;
|
||||||
use Toby\Domain\Slack\SignatureHandler;
|
use Toby\Domain\Slack\Exceptions\UserNotFoundException;
|
||||||
use Toby\Domain\Slack\SlackUserExistsRule;
|
use Toby\Domain\Slack\Rules\SlackUserExistsRule;
|
||||||
use Toby\Domain\Slack\Traits\FindsUserBySlackId;
|
use Toby\Domain\Slack\Traits\FindsUserBySlackId;
|
||||||
use Toby\Domain\Slack\UserNotFoundException;
|
|
||||||
use Toby\Eloquent\Models\Key;
|
use Toby\Eloquent\Models\Key;
|
||||||
|
|
||||||
class TakeKeysFrom extends SignatureHandler
|
class TakeKeysFrom extends SignatureHandler
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Toby\Domain\Slack;
|
namespace Toby\Domain\Slack\Rules;
|
||||||
|
|
||||||
use Illuminate\Contracts\Validation\Rule;
|
use Illuminate\Contracts\Validation\Rule;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
|||||||
|
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387 Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387 Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Yes. Yes.
`Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
Yes. Yes.
`Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
|
|||||||
namespace Toby\Domain\Slack\Traits;
|
namespace Toby\Domain\Slack\Traits;
|
||||||
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Toby\Domain\Slack\UserNotFoundException;
|
use Toby\Domain\Slack\Exceptions\UserNotFoundException;
|
||||||
|
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387 Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Yes. Yes.
`Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387 Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Yes. Yes.
`Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
|
|||||||
use Toby\Eloquent\Models\User;
|
use Toby\Eloquent\Models\User;
|
||||||
|
|
||||||
trait FindsUserBySlackId
|
trait FindsUserBySlackId
|
||||||
|
|||||||
|
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387 Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387 Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Yes. Yes.
`Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
Yes. Yes.
`Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
|
|||||||
Can you type
$notifiable?Can you type
$notifiable?Hm, I don't if I wouldn't put his to Infrastucture directory.
Hm, I don't if I wouldn't put his to Infrastucture directory.
Could you extract this config to separate method? It would make further testing easier, I think.
Could you extract this config to separate method? It would make further testing easier, I think.
In general, it can be anything that uses trait
NotifiableIn general, it can be anything that uses trait
NotifiableOh no, maybe you could add some interface fot that?
Oh no, maybe you could add some interface fot that?