Skip to content

Commit

Permalink
rewrite other git job
Browse files Browse the repository at this point in the history
  • Loading branch information
temaotl committed Aug 12, 2024
1 parent 85063fa commit 67f9ae4
Show file tree
Hide file tree
Showing 14 changed files with 467 additions and 55 deletions.
7 changes: 0 additions & 7 deletions app/Http/Controllers/CategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@

use App\Http\Requests\StoreCategory;
use App\Http\Requests\UpdateCategory;
use App\Jobs\GitAddCategory;
use App\Jobs\GitDeleteCategory;
use App\Jobs\GitUpdateCategory;
use App\Models\Category;
use App\Models\User;
use App\Notifications\CategoryCreated;
use App\Notifications\CategoryDeleted;
use App\Notifications\CategoryUpdated;
use App\Traits\GitTrait;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\Facades\Storage;

Expand Down Expand Up @@ -67,7 +63,6 @@ public function store(StoreCategory $request)
['tagfile' => generateFederationID($validated['name']).'.tag'],
));

GitAddCategory::dispatch($category, Auth::user());
Notification::send(User::activeAdmins()->select('id', 'email')->get(), new CategoryCreated($category));

return redirect('categories')
Expand Down Expand Up @@ -120,7 +115,6 @@ public function update(UpdateCategory $request, Category $category)
->route('categories.show', $category);
}

GitUpdateCategory::dispatch($old_category, $category, Auth::user());
Notification::send(User::activeAdmins()->select('id', 'email')->get(), new CategoryUpdated($category));

return redirect()
Expand All @@ -147,7 +141,6 @@ public function destroy(Category $category)
$name = $category->tagfile;
$category->delete();

GitDeleteCategory::dispatch($name, Auth::user());
Notification::send(User::activeAdmins()->select('id', 'email')->get(), new CategoryDeleted($name));

return redirect('categories')
Expand Down
7 changes: 0 additions & 7 deletions app/Http/Controllers/GroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@

use App\Http\Requests\StoreGroup;
use App\Http\Requests\UpdateGroup;
use App\Jobs\GitAddGroup;
use App\Jobs\GitDeleteGroup;
use App\Jobs\GitUpdateGroup;
use App\Models\Group;
use App\Models\User;
use App\Notifications\GroupCreated;
use App\Notifications\GroupDeleted;
use App\Notifications\GroupUpdated;
use App\Traits\GitTrait;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\Facades\Storage;

Expand Down Expand Up @@ -66,7 +62,6 @@ public function store(StoreGroup $request)
['tagfile' => generateFederationID($validated['name']).'.tag'],
));

GitAddGroup::dispatch($group, Auth::user());
Notification::send(User::activeAdmins()->select('id', 'email')->get(), new GroupCreated($group));

return redirect('groups')
Expand Down Expand Up @@ -119,7 +114,6 @@ public function update(UpdateGroup $request, Group $group)
->route('groups.show', $group);
}

GitUpdateGroup::dispatch($old_group, $group, Auth::user());
Notification::send(User::activeAdmins()->select('id', 'email')->get(), new GroupUpdated($group));

return redirect()
Expand All @@ -146,7 +140,6 @@ public function destroy(Group $group)
$name = $group->tagfile;
$group->delete();

GitDeleteGroup::dispatch($name, Auth::user());
Notification::send(User::activeAdmins()->select('id', 'email')->get(), new GroupDeleted($name));

return redirect('groups')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Jobs;
namespace App\Jobs\Old_Jobs;

use App\Mail\ExceptionOccured;
use App\Models\Category;
Expand All @@ -16,7 +16,7 @@
use Illuminate\Support\Facades\Storage;
use Throwable;

class GitAddCategory implements ShouldQueue
class Old_GitAddCategory implements ShouldQueue
{
use Dispatchable, GitTrait, InteractsWithQueue, Queueable, SerializesModels;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Jobs;
namespace App\Jobs\Old_Jobs;

use App\Mail\ExceptionOccured;
use App\Models\Group;
Expand All @@ -16,7 +16,7 @@
use Illuminate\Support\Facades\Storage;
use Throwable;

class GitAddGroup implements ShouldQueue
class Old_GitAddGroup implements ShouldQueue
{
use Dispatchable, GitTrait, InteractsWithQueue, Queueable, SerializesModels;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Jobs;
namespace App\Jobs\Old_Jobs;

use App\Mail\ExceptionOccured;
use App\Models\User;
Expand All @@ -14,7 +14,7 @@
use Illuminate\Support\Facades\Mail;
use Throwable;

class GitDeleteCategory implements ShouldQueue
class Old_GitDeleteCategory implements ShouldQueue
{
use Dispatchable, GitTrait, InteractsWithQueue, Queueable, SerializesModels;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Jobs;
namespace App\Jobs\Old_Jobs;

use App\Mail\ExceptionOccured;
use App\Models\User;
Expand All @@ -14,7 +14,7 @@
use Illuminate\Support\Facades\Mail;
use Throwable;

class GitDeleteGroup implements ShouldQueue
class Old_GitDeleteGroup implements ShouldQueue
{
use Dispatchable, GitTrait, InteractsWithQueue, Queueable, SerializesModels;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Jobs;
namespace App\Jobs\Old_Jobs;

use App\Mail\ExceptionOccured;
use App\Models\Category;
Expand All @@ -15,7 +15,7 @@
use Illuminate\Support\Facades\Mail;
use Throwable;

class GitUpdateCategory implements ShouldQueue
class Old_GitUpdateCategory implements ShouldQueue
{
use Dispatchable, GitTrait, InteractsWithQueue, Queueable, SerializesModels;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Jobs;
namespace App\Jobs\Old_Jobs;

use App\Mail\ExceptionOccured;
use App\Models\Group;
Expand All @@ -15,7 +15,7 @@
use Illuminate\Support\Facades\Mail;
use Throwable;

class GitUpdateGroup implements ShouldQueue
class Old_GitUpdateGroup implements ShouldQueue
{
use Dispatchable, GitTrait, InteractsWithQueue, Queueable, SerializesModels;

Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
"license": "MIT",
"require": {
"php": "^8.1.0",
"ext-dom": "*",
"ext-exif": "*",
"czproject/git-php": "^4.0",
"directorytree/ldaprecord-laravel": "^2.7",
"doctrine/dbal": "^3.8",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.0",
"laravel/tinker": "^2.7",
"livewire/livewire": "^2.10",
"ext-dom": "*",
"ext-exif": "*"
"livewire/livewire": "^2.10"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.6",
Expand Down
Loading

0 comments on commit 67f9ae4

Please sign in to comment.