feat&fix(add Listmonk service and sync part 1, fix association email on member sync)
This commit is contained in:
@@ -9,6 +9,7 @@ use Illuminate\Console\Command;
|
||||
use Illuminate\Http\Client\ConnectionException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Symfony\Component\Console\Command\Command as CommandAlias;
|
||||
|
||||
use function Laravel\Prompts\progress;
|
||||
|
||||
class SyncNextcloudMembers extends Command
|
||||
@@ -40,14 +41,15 @@ class SyncNextcloudMembers extends Command
|
||||
);
|
||||
|
||||
$members = Member::query()
|
||||
->where('email', 'like', '%@retzien.fr%')
|
||||
->whereNotNull('retzien_email')
|
||||
->where('retzien_email', '!=', '')
|
||||
->when($memberFilter, fn ($q) => $q->where('id', $memberFilter))
|
||||
->get()
|
||||
->filter(fn (Member $m) => !empty($m->retzien_email))
|
||||
->keyBy(fn (Member $m) => strtolower($m->retzien_email));
|
||||
|
||||
if ($members->isEmpty()) {
|
||||
$this->warn('Aucun membre à synchroniser');
|
||||
|
||||
return CommandAlias::SUCCESS;
|
||||
}
|
||||
|
||||
@@ -55,11 +57,11 @@ class SyncNextcloudMembers extends Command
|
||||
|
||||
$userIds = $this->nextcloud->listUsers();
|
||||
|
||||
$this->info(count($userIds) . ' comptes Nextcloud trouvés');
|
||||
$this->info(count($userIds).' comptes Nextcloud trouvés');
|
||||
|
||||
$progress = null;
|
||||
|
||||
if (!$dryRun) {
|
||||
if (! $dryRun) {
|
||||
$progress = progress(
|
||||
label: 'Synchronisation des membres',
|
||||
steps: $members->count()
|
||||
@@ -75,7 +77,7 @@ class SyncNextcloudMembers extends Command
|
||||
|
||||
$email = strtolower($details['email'] ?? '');
|
||||
|
||||
if (!$email || !$members->has($email)) {
|
||||
if (! $email || ! $members->has($email)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user