style: apply Laravel Pint formatting across codebase
Auto-formatted by Laravel Pint (default Laravel preset): string concatenation spacing, anonymous class brace placement, constructor body shorthand, import ordering, and assertion indentation.
This commit is contained in:
parent
5b35afb31d
commit
04d271f96a
|
|
@ -18,14 +18,14 @@ public function handle(ChurchToolsService $churchToolsService): int
|
|||
$summary = $churchToolsService->sync();
|
||||
|
||||
$this->info('Daten wurden aktualisiert');
|
||||
$this->line('Services: ' . $summary['services_count']);
|
||||
$this->line('Songs in Agenda: ' . $summary['songs_count']);
|
||||
$this->line('Gematchte Songs: ' . $summary['matched_songs_count']);
|
||||
$this->line('Nicht gematchte Songs: ' . $summary['unmatched_songs_count']);
|
||||
$this->line('Services: '.$summary['services_count']);
|
||||
$this->line('Songs in Agenda: '.$summary['songs_count']);
|
||||
$this->line('Gematchte Songs: '.$summary['matched_songs_count']);
|
||||
$this->line('Nicht gematchte Songs: '.$summary['unmatched_songs_count']);
|
||||
|
||||
return self::SUCCESS;
|
||||
} catch (Throwable $exception) {
|
||||
$this->error('Fehler beim Synchronisieren: ' . $exception->getMessage());
|
||||
$this->error('Fehler beim Synchronisieren: '.$exception->getMessage());
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public static function run(
|
|||
|
||||
try {
|
||||
$events = EventRequest::where('from', $fromDate)->get();
|
||||
$songResponse = CTClient::getClient()->get('/api/songs/' . $songId);
|
||||
$songResponse = CTClient::getClient()->get('/api/songs/'.$songId);
|
||||
$songRaw = CTResponseUtil::dataAsArray($songResponse);
|
||||
$song = Song::createModelFromData($songRaw);
|
||||
} catch (Throwable $throwable) {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,5 @@ public function __construct(
|
|||
public int $processedPages = 0,
|
||||
public int $totalPages = 0,
|
||||
public array $convertedFiles = [],
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public function update(Request $request, SongArrangement $arrangement): Redirect
|
|||
$arrangement->arrangementGroups()->insert($rows);
|
||||
}
|
||||
|
||||
if (!empty($data['group_colors'])) {
|
||||
if (! empty($data['group_colors'])) {
|
||||
foreach ($data['group_colors'] as $groupId => $color) {
|
||||
$arrangement->song->groups()
|
||||
->whereKey((int) $groupId)
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ public function importPro(Request $request): JsonResponse
|
|||
}
|
||||
|
||||
try {
|
||||
$service = new ProImportService();
|
||||
$service = new ProImportService;
|
||||
$songs = $service->import($file);
|
||||
|
||||
return response()->json([
|
||||
'message' => count($songs) === 1
|
||||
? "Song \"{$songs[0]->title}\" erfolgreich importiert."
|
||||
: count($songs) . ' Songs erfolgreich importiert.',
|
||||
: count($songs).' Songs erfolgreich importiert.',
|
||||
'songs' => collect($songs)->map(fn (Song $song) => [
|
||||
'id' => $song->id,
|
||||
'title' => $song->title,
|
||||
|
|
@ -53,10 +53,10 @@ public function downloadPro(Song $song): BinaryFileResponse
|
|||
abort(422, 'Song hat keine Gruppen oder Slides zum Exportieren.');
|
||||
}
|
||||
|
||||
$exportService = new ProExportService();
|
||||
$exportService = new ProExportService;
|
||||
$tempPath = $exportService->generateProFile($song);
|
||||
|
||||
$filename = preg_replace('/[^a-zA-Z0-9äöüÄÖÜß\-_ ]/', '', $song->title) . '.pro';
|
||||
$filename = preg_replace('/[^a-zA-Z0-9äöüÄÖÜß\-_ ]/', '', $song->title).'.pro';
|
||||
|
||||
return response()->download($tempPath, $filename)->deleteFileAfterSend(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,7 @@ class ServiceSongController extends Controller
|
|||
{
|
||||
public function __construct(
|
||||
private readonly SongMatchingService $songMatchingService,
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Manuell einen Song aus der DB einem ServiceSong zuordnen.
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ class SongController extends Controller
|
|||
{
|
||||
public function __construct(
|
||||
private readonly SongService $songService,
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Alle Songs auflisten (paginiert, durchsuchbar).
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public function sync(ChurchToolsService $service): RedirectResponse
|
|||
|
||||
return back()->with('success', 'Daten wurden aktualisiert');
|
||||
} catch (\Throwable $e) {
|
||||
return back()->with('error', 'Sync fehlgeschlagen: ' . $e->getMessage());
|
||||
return back()->with('error', 'Sync fehlgeschlagen: '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ class TranslationController extends Controller
|
|||
{
|
||||
public function __construct(
|
||||
private readonly TranslationService $translationService,
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
public function page(Song $song): Response
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,14 +23,13 @@ class ConvertPowerPointJob implements ShouldQueue
|
|||
public function __construct(
|
||||
public string $inputPath,
|
||||
public string $jobId,
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
public function handle(FileConversionService $conversionService): void
|
||||
{
|
||||
event(new PowerPointConversionProgress($this->jobId, 'started'));
|
||||
|
||||
$tempDir = storage_path('app/temp/ppt-' . $this->jobId);
|
||||
$tempDir = storage_path('app/temp/ppt-'.$this->jobId);
|
||||
if (! is_dir($tempDir) && ! mkdir($tempDir, 0775, true) && ! is_dir($tempDir)) {
|
||||
throw new RuntimeException('Temporaires Verzeichnis konnte nicht erstellt werden.');
|
||||
}
|
||||
|
|
@ -49,10 +48,10 @@ public function handle(FileConversionService $conversionService): void
|
|||
$process->run();
|
||||
|
||||
if (! $process->isSuccessful()) {
|
||||
throw new RuntimeException('PowerPoint-Konvertierung fehlgeschlagen: ' . $process->getErrorOutput());
|
||||
throw new RuntimeException('PowerPoint-Konvertierung fehlgeschlagen: '.$process->getErrorOutput());
|
||||
}
|
||||
|
||||
$pdfPath = $tempDir . DIRECTORY_SEPARATOR . pathinfo($this->inputPath, PATHINFO_FILENAME) . '.pdf';
|
||||
$pdfPath = $tempDir.DIRECTORY_SEPARATOR.pathinfo($this->inputPath, PATHINFO_FILENAME).'.pdf';
|
||||
if (! is_file($pdfPath)) {
|
||||
throw new RuntimeException('PDF wurde von LibreOffice nicht erzeugt.');
|
||||
}
|
||||
|
|
@ -63,7 +62,7 @@ public function handle(FileConversionService $conversionService): void
|
|||
$convertedFiles = [];
|
||||
|
||||
for ($page = 1; $page <= $pageCount; $page++) {
|
||||
$slidePath = $tempDir . DIRECTORY_SEPARATOR . 'slide-' . $page . '.jpg';
|
||||
$slidePath = $tempDir.DIRECTORY_SEPARATOR.'slide-'.$page.'.jpg';
|
||||
$pdf->selectPage($page)->save($slidePath);
|
||||
|
||||
$convertedFiles[] = $conversionService->convertImage($slidePath);
|
||||
|
|
@ -104,7 +103,7 @@ private function cleanup(string $tempDir): void
|
|||
continue;
|
||||
}
|
||||
|
||||
$path = $tempDir . DIRECTORY_SEPARATOR . $entry;
|
||||
$path = $tempDir.DIRECTORY_SEPARATOR.$entry;
|
||||
|
||||
if (is_file($path)) {
|
||||
@unlink($path);
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@ public function __construct(
|
|||
public string $songName,
|
||||
public ?string $ccliId,
|
||||
public mixed $service,
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
public function build()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public function scopeSearch(Builder $query, ?string $search): Builder
|
|||
return $query;
|
||||
}
|
||||
|
||||
$term = '%' . trim($search) . '%';
|
||||
$term = '%'.trim($search).'%';
|
||||
|
||||
return $query->where(function (Builder $builder) use ($term): void {
|
||||
$builder
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
|
||||
class Song extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ class User extends Authenticatable
|
|||
{
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
use HasFactory;
|
||||
|
||||
use Notifiable;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Socialite\ChurchToolsProvider;
|
||||
use Illuminate\Support\Facades\Vite;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use App\Socialite\ChurchToolsProvider;
|
||||
use Laravel\Socialite\Facades\Socialite;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
namespace App\Services;
|
||||
|
||||
use App\Models\ApiRequestLog;
|
||||
use Closure;
|
||||
use CTApi\CTConfig;
|
||||
use CTApi\Models\Events\Event\EventAgendaRequest;
|
||||
use CTApi\Models\Events\Event\EventRequest;
|
||||
use CTApi\Models\Events\Song\SongRequest;
|
||||
use Closure;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
|
@ -24,8 +24,7 @@ public function __construct(
|
|||
private readonly ?Closure $songFetcher = null,
|
||||
private readonly ?Closure $agendaFetcher = null,
|
||||
private readonly ?Closure $eventServiceFetcher = null,
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
public function sync(): array
|
||||
{
|
||||
|
|
@ -252,7 +251,7 @@ private function summarizeResponse(mixed $result): ?string
|
|||
}
|
||||
|
||||
if (is_array($result)) {
|
||||
return 'Array mit ' . count($result) . ' Eintraegen';
|
||||
return 'Array mit '.count($result).' Eintraegen';
|
||||
}
|
||||
|
||||
if (is_scalar($result)) {
|
||||
|
|
@ -260,7 +259,7 @@ private function summarizeResponse(mixed $result): ?string
|
|||
}
|
||||
|
||||
if (is_object($result)) {
|
||||
return 'Objekt vom Typ ' . $result::class;
|
||||
return 'Objekt vom Typ '.$result::class;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -275,7 +274,7 @@ private function serializeResponseBody(mixed $result): ?string
|
|||
try {
|
||||
$json = json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR);
|
||||
|
||||
return mb_strlen($json) > 512000 ? mb_substr($json, 0, 512000) . "\n... (abgeschnitten)" : $json;
|
||||
return mb_strlen($json) > 512000 ? mb_substr($json, 0, 512000)."\n... (abgeschnitten)" : $json;
|
||||
} catch (\JsonException) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -433,7 +432,7 @@ private function extractPersonName(mixed $eventService): ?string
|
|||
|
||||
$firstName = method_exists($person, 'getFirstName') ? trim((string) $person->getFirstName()) : '';
|
||||
$lastName = method_exists($person, 'getLastName') ? trim((string) $person->getLastName()) : '';
|
||||
$fullName = trim($firstName . ' ' . $lastName);
|
||||
$fullName = trim($firstName.' '.$lastName);
|
||||
|
||||
return $fullName === '' ? null : $fullName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ public function convertImage(UploadedFile|string|SplFileInfo $file): array
|
|||
|
||||
$this->assertSize($file, $sourcePath);
|
||||
|
||||
$filename = Str::uuid()->toString() . '.jpg';
|
||||
$relativePath = 'slides/' . $filename;
|
||||
$filename = Str::uuid()->toString().'.jpg';
|
||||
$relativePath = 'slides/'.$filename;
|
||||
$targetPath = Storage::disk('public')->path($relativePath);
|
||||
Storage::disk('public')->makeDirectory('slides');
|
||||
$this->ensureDirectory(dirname($targetPath));
|
||||
|
|
@ -85,12 +85,12 @@ public function processZip(UploadedFile|string|SplFileInfo $file): array
|
|||
|
||||
$this->assertSize($file, $sourcePath);
|
||||
|
||||
$zip = new ZipArchive();
|
||||
$zip = new ZipArchive;
|
||||
if ($zip->open($sourcePath) !== true) {
|
||||
throw new InvalidArgumentException('ZIP-Datei konnte nicht geoeffnet werden.');
|
||||
}
|
||||
|
||||
$extractDir = storage_path('app/temp/zip-' . Str::uuid()->toString());
|
||||
$extractDir = storage_path('app/temp/zip-'.Str::uuid()->toString());
|
||||
if (! is_dir($extractDir) && ! mkdir($extractDir, 0775, true) && ! is_dir($extractDir)) {
|
||||
throw new InvalidArgumentException('Temporaires ZIP-Verzeichnis konnte nicht erstellt werden.');
|
||||
}
|
||||
|
|
@ -121,11 +121,13 @@ public function processZip(UploadedFile|string|SplFileInfo $file): array
|
|||
|
||||
if (in_array($entryExtension, self::IMAGE_EXTENSIONS, true)) {
|
||||
$results[] = $this->convertImage($entryPath);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($entryExtension, self::POWERPOINT_EXTENSIONS, true)) {
|
||||
$results[] = ['job_id' => $this->convertPowerPoint($entryPath)];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -147,8 +149,8 @@ public function generateThumbnail(string $path): string
|
|||
throw new InvalidArgumentException('Datei fuer Thumbnail nicht gefunden.');
|
||||
}
|
||||
|
||||
$filename = pathinfo($absolutePath, PATHINFO_FILENAME) . '.jpg';
|
||||
$thumbnailRelativePath = 'slides/thumbnails/' . $filename;
|
||||
$filename = pathinfo($absolutePath, PATHINFO_FILENAME).'.jpg';
|
||||
$thumbnailRelativePath = 'slides/thumbnails/'.$filename;
|
||||
$thumbnailAbsolutePath = Storage::disk('public')->path($thumbnailRelativePath);
|
||||
Storage::disk('public')->makeDirectory('slides/thumbnails');
|
||||
$this->ensureDirectory(dirname($thumbnailAbsolutePath));
|
||||
|
|
@ -240,6 +242,7 @@ private function deleteDirectory(string $directory): void
|
|||
|
||||
if ($item->isDir()) {
|
||||
@rmdir($item->getPathname());
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -265,6 +268,6 @@ private function createImageManager(): mixed
|
|||
$managerClass = implode('\\', ['Intervention', 'Image', 'ImageManager']);
|
||||
$driverClass = implode('\\', ['Intervention', 'Image', 'Drivers', 'Gd', 'Driver']);
|
||||
|
||||
return new $managerClass(new $driverClass());
|
||||
return new $managerClass(new $driverClass);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
use App\Models\SongArrangement;
|
||||
use App\Models\SongArrangementGroup;
|
||||
use App\Models\SongGroup;
|
||||
use App\Models\SongSlide;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use ProPresenter\Parser\ProFileReader;
|
||||
|
|
@ -34,13 +33,13 @@ public function import(UploadedFile $file): array
|
|||
/** @return Song[] */
|
||||
private function importZip(UploadedFile $file): array
|
||||
{
|
||||
$zip = new ZipArchive();
|
||||
$zip = new ZipArchive;
|
||||
|
||||
if ($zip->open($file->getRealPath()) !== true) {
|
||||
throw new \RuntimeException('ZIP-Datei konnte nicht geöffnet werden.');
|
||||
}
|
||||
|
||||
$tempDir = sys_get_temp_dir() . '/pro-import-' . uniqid();
|
||||
$tempDir = sys_get_temp_dir().'/pro-import-'.uniqid();
|
||||
mkdir($tempDir, 0755, true);
|
||||
|
||||
$songs = [];
|
||||
|
|
@ -49,8 +48,8 @@ private function importZip(UploadedFile $file): array
|
|||
$zip->extractTo($tempDir);
|
||||
$zip->close();
|
||||
|
||||
$proFiles = glob($tempDir . '/*.pro') ?: [];
|
||||
$proFilesNested = glob($tempDir . '/**/*.pro') ?: [];
|
||||
$proFiles = glob($tempDir.'/*.pro') ?: [];
|
||||
$proFilesNested = glob($tempDir.'/**/*.pro') ?: [];
|
||||
$allProFiles = array_unique(array_merge($proFiles, $proFilesNested));
|
||||
|
||||
if (empty($allProFiles)) {
|
||||
|
|
@ -201,7 +200,7 @@ private function deleteDirectory(string $dir): void
|
|||
continue;
|
||||
}
|
||||
|
||||
$path = $dir . '/' . $item;
|
||||
$path = $dir.'/'.$item;
|
||||
is_dir($path) ? $this->deleteDirectory($path) : unlink($path);
|
||||
}
|
||||
rmdir($dir);
|
||||
|
|
|
|||
|
|
@ -20,14 +20,14 @@ protected function getBaseUrl(): string
|
|||
protected function getAuthUrl($state): string
|
||||
{
|
||||
return $this->buildAuthUrlFromBase(
|
||||
$this->getBaseUrl() . '/oauth/authorize',
|
||||
$this->getBaseUrl().'/oauth/authorize',
|
||||
$state,
|
||||
);
|
||||
}
|
||||
|
||||
protected function getTokenUrl(): string
|
||||
{
|
||||
return $this->getBaseUrl() . '/oauth/access_token';
|
||||
return $this->getBaseUrl().'/oauth/access_token';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -37,10 +37,10 @@ protected function getTokenUrl(): string
|
|||
protected function getUserByToken($token): array
|
||||
{
|
||||
$response = $this->getHttpClient()->get(
|
||||
$this->getBaseUrl() . '/oauth/userinfo',
|
||||
$this->getBaseUrl().'/oauth/userinfo',
|
||||
[
|
||||
RequestOptions::HEADERS => [
|
||||
'Authorization' => 'Bearer ' . $token,
|
||||
'Authorization' => 'Bearer '.$token,
|
||||
'Accept' => 'application/json',
|
||||
],
|
||||
],
|
||||
|
|
@ -51,9 +51,9 @@ protected function getUserByToken($token): array
|
|||
|
||||
protected function mapUserToObject(array $user): User
|
||||
{
|
||||
return (new User())->setRaw($user)->map([
|
||||
return (new User)->setRaw($user)->map([
|
||||
'id' => $user['id'] ?? null,
|
||||
'name' => $user['displayName'] ?? trim(($user['firstName'] ?? '') . ' ' . ($user['lastName'] ?? '')),
|
||||
'name' => $user['displayName'] ?? trim(($user['firstName'] ?? '').' '.($user['lastName'] ?? '')),
|
||||
'email' => $user['email'] ?? null,
|
||||
'avatar' => $user['imageUrl'] ?? null,
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Configuration\Exceptions;
|
||||
use Illuminate\Foundation\Configuration\Middleware;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
|
||||
return Application::configure(basePath: dirname(__DIR__))
|
||||
->withRouting(
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ public function definition(): array
|
|||
return [
|
||||
'type' => $this->faker->randomElement(['information', 'moderation', 'sermon']),
|
||||
'service_id' => Service::factory(),
|
||||
'original_filename' => $this->faker->word() . '.jpg',
|
||||
'stored_filename' => $this->faker->uuid() . '.jpg',
|
||||
'thumbnail_filename' => $this->faker->uuid() . '_thumb.jpg',
|
||||
'original_filename' => $this->faker->word().'.jpg',
|
||||
'stored_filename' => $this->faker->uuid().'.jpg',
|
||||
'thumbnail_filename' => $this->faker->uuid().'_thumb.jpg',
|
||||
'expire_date' => $this->faker->optional()->dateTimeBetween('now', '+12 months'),
|
||||
'uploader_name' => $this->faker->name(),
|
||||
'uploaded_at' => $this->faker->dateTimeBetween('-1 month', 'now'),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class () extends Migration {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class () extends Migration {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('services', function (Blueprint $table) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class () extends Migration {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('songs', function (Blueprint $table) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class () extends Migration {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('song_groups', function (Blueprint $table) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class () extends Migration {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('song_slides', function (Blueprint $table) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class () extends Migration {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('song_arrangements', function (Blueprint $table) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class () extends Migration {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('song_arrangement_groups', function (Blueprint $table) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class () extends Migration {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('service_songs', function (Blueprint $table) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class () extends Migration {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('slides', function (Blueprint $table) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class () extends Migration {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cts_sync_log', function (Blueprint $table) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class () extends Migration {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('api_request_logs', function (Blueprint $table) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class () extends Migration {
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class () extends Migration {
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('songs', function (Blueprint $table) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
Route::middleware('auth:sanctum')->group(function () {
|
||||
Route::apiResource('songs', SongController::class)->names('api.songs');
|
||||
|
||||
|
||||
Route::post('/service-songs/{serviceSongId}/assign', [ServiceSongController::class, 'assignSong'])
|
||||
->name('api.service-songs.assign');
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public static function run(
|
|||
|
||||
try {
|
||||
$events = EventRequest::where('from', $fromDate)->get();
|
||||
$songResponse = CTClient::getClient()->get('/api/songs/' . $songId);
|
||||
$songResponse = CTClient::getClient()->get('/api/songs/'.$songId);
|
||||
$songRaw = CTResponseUtil::dataAsArray($songResponse);
|
||||
$song = Song::createModelFromData($songRaw);
|
||||
} catch (Throwable $throwable) {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
use App\Services\ChurchToolsService;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
beforeEach(function () {
|
||||
ensureSyncTables();
|
||||
|
|
@ -132,8 +132,7 @@ public function __construct(
|
|||
private readonly string $startDate,
|
||||
private readonly ?string $note = null,
|
||||
private readonly array $eventServices = [],
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
public function getId(): string
|
||||
{
|
||||
|
|
@ -166,8 +165,7 @@ final class FakeEventService
|
|||
public function __construct(
|
||||
private readonly string $name,
|
||||
private readonly ?FakePerson $person,
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
|
|
@ -185,8 +183,7 @@ final class FakePerson
|
|||
public function __construct(
|
||||
private readonly string $firstName,
|
||||
private readonly string $lastName,
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
public function getFirstName(): string
|
||||
{
|
||||
|
|
@ -201,9 +198,7 @@ public function getLastName(): string
|
|||
|
||||
final class FakeAgenda
|
||||
{
|
||||
public function __construct(private readonly array $songs)
|
||||
{
|
||||
}
|
||||
public function __construct(private readonly array $songs) {}
|
||||
|
||||
public function getSongs(): array
|
||||
{
|
||||
|
|
@ -217,8 +212,7 @@ public function __construct(
|
|||
private readonly int $id,
|
||||
private readonly string $title,
|
||||
private readonly ?string $ccli,
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
public function getId(): string
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
'type' => 'text',
|
||||
'cclid' => '7115744',
|
||||
'lyricParts' => [
|
||||
['key' => 'v1', 'text' => "Du bist hier"],
|
||||
['key' => 'v1', 'text' => 'Du bist hier'],
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace Tests\Feature;
|
||||
|
||||
use App\Mail\MissingSongRequest;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Tests\TestCase;
|
||||
|
||||
|
|
@ -28,7 +27,7 @@ public function test_missing_song_request_mailable_renders_with_german_content()
|
|||
$serviceDate = '2026-03-08';
|
||||
|
||||
// Create a mock service object
|
||||
$service = new \stdClass();
|
||||
$service = new \stdClass;
|
||||
$service->id = $serviceId;
|
||||
$service->title = $serviceTitle;
|
||||
$service->date = $serviceDate;
|
||||
|
|
@ -55,7 +54,7 @@ public function test_missing_song_request_mailable_has_correct_subject(): void
|
|||
$songName = 'Großer Gott';
|
||||
$ccliId = '12345678';
|
||||
|
||||
$service = new \stdClass();
|
||||
$service = new \stdClass;
|
||||
$service->id = 1;
|
||||
$service->title = 'Sonntagsgottesdienst';
|
||||
$service->date = '2026-03-08';
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
});
|
||||
|
||||
it('creates a new user from OAuth callback', function () {
|
||||
$socialiteUser = new SocialiteUser();
|
||||
$socialiteUser = new SocialiteUser;
|
||||
$socialiteUser->map([
|
||||
'id' => '42',
|
||||
'name' => 'Max Mustermann',
|
||||
|
|
@ -104,7 +104,7 @@
|
|||
'churchtools_id' => 42,
|
||||
]);
|
||||
|
||||
$socialiteUser = new SocialiteUser();
|
||||
$socialiteUser = new SocialiteUser;
|
||||
$socialiteUser->map([
|
||||
'id' => '42',
|
||||
'name' => 'Max Mustermann',
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ final class ProFileImportTest extends TestCase
|
|||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private function testProFile(): UploadedFile
|
||||
private function test_pro_file(): UploadedFile
|
||||
{
|
||||
$sourcePath = base_path('../propresenter-work/ref/Test.pro');
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ public function test_import_pro_datei_erstellt_song_mit_gruppen_und_slides(): vo
|
|||
$user = User::factory()->create();
|
||||
|
||||
$response = $this->actingAs($user)->postJson(route('api.songs.import-pro'), [
|
||||
'file' => $this->testProFile(),
|
||||
'file' => $this->test_pro_file(),
|
||||
]);
|
||||
|
||||
$response->assertOk();
|
||||
|
|
@ -43,13 +43,13 @@ public function test_import_pro_ohne_ccli_erstellt_neuen_song(): void
|
|||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user)->postJson(route('api.songs.import-pro'), [
|
||||
'file' => $this->testProFile(),
|
||||
'file' => $this->test_pro_file(),
|
||||
]);
|
||||
|
||||
$this->assertSame(1, Song::count());
|
||||
|
||||
$this->actingAs($user)->postJson(route('api.songs.import-pro'), [
|
||||
'file' => $this->testProFile(),
|
||||
'file' => $this->test_pro_file(),
|
||||
]);
|
||||
|
||||
$this->assertSame(2, Song::count());
|
||||
|
|
@ -71,7 +71,7 @@ public function test_import_pro_upsert_mit_ccli_dupliziert_nicht(): void
|
|||
$this->assertSame(1, Song::count());
|
||||
|
||||
$response = $this->actingAs($user)->postJson(route('api.songs.import-pro'), [
|
||||
'file' => $this->testProFile(),
|
||||
'file' => $this->test_pro_file(),
|
||||
]);
|
||||
|
||||
$response->assertOk();
|
||||
|
|
@ -94,7 +94,7 @@ public function test_import_pro_lehnt_ungueltige_datei_ab(): void
|
|||
public function test_import_pro_erfordert_authentifizierung(): void
|
||||
{
|
||||
$response = $this->postJson(route('api.songs.import-pro'), [
|
||||
'file' => $this->testProFile(),
|
||||
'file' => $this->test_pro_file(),
|
||||
]);
|
||||
|
||||
$response->assertUnauthorized();
|
||||
|
|
@ -105,7 +105,7 @@ public function test_import_pro_erstellt_arrangement_gruppen(): void
|
|||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user)->postJson(route('api.songs.import-pro'), [
|
||||
'file' => $this->testProFile(),
|
||||
'file' => $this->test_pro_file(),
|
||||
]);
|
||||
|
||||
$song = Song::where('title', 'Test')->first();
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@
|
|||
|
||||
// Create a real file with .pptx extension
|
||||
$tempPath = tempnam(sys_get_temp_dir(), 'cts-pptx-');
|
||||
$pptxPath = $tempPath . '.pptx';
|
||||
$pptxPath = $tempPath.'.pptx';
|
||||
file_put_contents($pptxPath, str_repeat('x', 1024));
|
||||
$file = new UploadedFile($pptxPath, 'slides.pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', null, true);
|
||||
|
||||
|
|
@ -136,11 +136,11 @@
|
|||
|
||||
test('upload zip processes contained images', function () {
|
||||
// Create a small zip with a valid image
|
||||
$tempDir = sys_get_temp_dir() . '/cts-zip-test-' . uniqid();
|
||||
$tempDir = sys_get_temp_dir().'/cts-zip-test-'.uniqid();
|
||||
mkdir($tempDir, 0775, true);
|
||||
|
||||
// Create an image inside
|
||||
$imgPath = $tempDir . '/slide1.png';
|
||||
$imgPath = $tempDir.'/slide1.png';
|
||||
$image = imagecreatetruecolor(200, 150);
|
||||
$blue = imagecolorallocate($image, 0, 0, 255);
|
||||
imagefill($image, 0, 0, $blue);
|
||||
|
|
@ -148,8 +148,8 @@
|
|||
imagedestroy($image);
|
||||
|
||||
// Build zip
|
||||
$zipPath = $tempDir . '/slides.zip';
|
||||
$zip = new ZipArchive();
|
||||
$zipPath = $tempDir.'/slides.zip';
|
||||
$zip = new ZipArchive;
|
||||
$zip->open($zipPath, ZipArchive::CREATE);
|
||||
$zip->addFile($imgPath, 'slide1.png');
|
||||
$zip->close();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
use App\Mail\MissingSongRequest;
|
||||
use App\Models\Service;
|
||||
use App\Models\ServiceSong;
|
||||
use App\Models\Song;
|
||||
use App\Models\SongArrangement;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
<?php
|
||||
|
||||
use App\Services\ChurchToolsService;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
beforeEach(function () {
|
||||
ensureSyncControllerTables();
|
||||
|
|
|
|||
|
|
@ -196,10 +196,10 @@
|
|||
SongSlide::factory()->create([
|
||||
'song_group_id' => $group->id,
|
||||
'order' => 1,
|
||||
'text_content' => "Line 1",
|
||||
'text_content' => 'Line 1',
|
||||
]);
|
||||
|
||||
$this->service->importTranslation($song, "Zeile 1");
|
||||
$this->service->importTranslation($song, 'Zeile 1');
|
||||
|
||||
$song->refresh();
|
||||
expect($song->has_translation)->toBeTrue();
|
||||
|
|
@ -229,15 +229,15 @@
|
|||
$slide1 = SongSlide::factory()->create([
|
||||
'song_group_id' => $group->id,
|
||||
'order' => 1,
|
||||
'text_content' => "Original",
|
||||
'text_content_translated' => "Übersetzt",
|
||||
'text_content' => 'Original',
|
||||
'text_content_translated' => 'Übersetzt',
|
||||
]);
|
||||
|
||||
$slide2 = SongSlide::factory()->create([
|
||||
'song_group_id' => $group->id,
|
||||
'order' => 2,
|
||||
'text_content' => "Original 2",
|
||||
'text_content_translated' => "Übersetzt 2",
|
||||
'text_content' => 'Original 2',
|
||||
'text_content_translated' => 'Übersetzt 2',
|
||||
]);
|
||||
|
||||
$this->service->removeTranslation($song);
|
||||
|
|
@ -350,8 +350,8 @@
|
|||
SongSlide::factory()->create([
|
||||
'song_group_id' => $group->id,
|
||||
'order' => 1,
|
||||
'text_content' => "Original",
|
||||
'text_content_translated' => "Übersetzt",
|
||||
'text_content' => 'Original',
|
||||
'text_content_translated' => 'Übersetzt',
|
||||
]);
|
||||
|
||||
$response = $this->actingAs($this->user)
|
||||
|
|
|
|||
Loading…
Reference in a new issue