Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #79

Merged
merged 130 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
3ccf464
feat: add description attribute into create works table migration
Haaragard Oct 14, 2022
7b62a83
feat: add description on work model fillable attr
Haaragard Oct 14, 2022
7fea811
feat: add work factory with description state
Haaragard Oct 14, 2022
6f55ed6
feat: add work seeder with description chance
Haaragard Oct 14, 2022
e066509
fix: create new user action on contractor profile creation
Haaragard Oct 15, 2022
f676fcf
feat: add description field in store my work form
Haaragard Oct 15, 2022
d44ddca
feat: add description in store my work request
Haaragard Oct 15, 2022
fba1500
feat: add description in work creation
Haaragard Oct 15, 2022
f8ade5f
Merge pull request #61 from TCC-Klaiton-Diogo/feature/TKD-79
Haaragard Oct 15, 2022
9a594bc
fix: contractor contracted work relationship
Haaragard Oct 15, 2022
17c1a8a
chore: remove unused imports into specialty worker seeder
Haaragard Oct 15, 2022
75787a9
feat: add store contracted work request
Haaragard Oct 15, 2022
6cf194c
feat: add store contracted work action
Haaragard Oct 15, 2022
66e6d3e
feat: add store contracted work controller
Haaragard Oct 15, 2022
2fff3cd
feat: add store contracted work route
Haaragard Oct 15, 2022
821626d
feat: add hire button in show work infos
Haaragard Oct 15, 2022
74cbe4f
chore: change names contracted work to hired work
Haaragard Oct 15, 2022
7c29cf0
fix: store my works test
Haaragard Oct 15, 2022
a771042
feat: add store hired work test
Haaragard Oct 15, 2022
be8f6c5
Merge pull request #62 from TCC-Klaiton-Diogo/feature/TKD-72
Haaragard Oct 15, 2022
99f40e1
feat: add description view for work show
Haaragard Oct 16, 2022
9787446
Merge pull request #63 from TCC-Klaiton-Diogo/feature/TKD-81
Haaragard Oct 16, 2022
d19ad3f
fix: add random int as decimal in work factory with price state
Haaragard Oct 16, 2022
910d54a
Merge pull request #64 from TCC-Klaiton-Diogo/feature/TKD-87
Haaragard Oct 16, 2022
1f90918
fix: change controller name & add spacing between methods
Haaragard Oct 16, 2022
2ed203d
feat: add contractore hired works list
Haaragard Oct 18, 2022
d62c31d
feat: add list hired works controller and route
Haaragard Oct 18, 2022
cedae5d
feat: add hired works auth header list
Haaragard Oct 18, 2022
0693810
Merge pull request #65 from TCC-Klaiton-Diogo/feature/TKD-85
Haaragard Oct 18, 2022
c8d62cd
feat: add badge component
Haaragard Oct 18, 2022
55cbd41
Merge pull request #66 from TCC-Klaiton-Diogo/feature/TKD-88
Haaragard Oct 18, 2022
e3df255
feat: improve badge group component
Haaragard Oct 18, 2022
1121de8
Merge pull request #67 from TCC-Klaiton-Diogo/feature/TKD-82
Haaragard Oct 18, 2022
3be987a
fix: hired works table definition
Haaragard Oct 18, 2022
6e11da0
fix: hired works factory
Haaragard Oct 18, 2022
48c1cdb
chore: add work phpdoc on methods
Haaragard Oct 18, 2022
e255ccb
feat: add hire work model attr cast methods
Haaragard Oct 18, 2022
e5cca4f
feat: add hired work initiated validation rule message
Haaragard Oct 18, 2022
b64ee35
feat: add validation rule for hired work initiated
Haaragard Oct 18, 2022
f1f9411
feat: add destroy hired work request
Haaragard Oct 18, 2022
47bc762
feat: add destroy hired works controller and route
Haaragard Oct 18, 2022
476af66
feat: add delete hired work button and function
Haaragard Oct 18, 2022
8db2e12
Merge pull request #68 from TCC-Klaiton-Diogo/feature/TKD-86
Haaragard Oct 18, 2022
e6d32f5
chore: move and fix names on store hired work test
Haaragard Oct 19, 2022
9148d44
chore: change logic on hired work factory initiated state
Haaragard Oct 19, 2022
2fc867b
feat: add destroy hired work test
Haaragard Oct 19, 2022
9194186
Merge pull request #69 from TCC-Klaiton-Diogo/feature/TKD-90
Haaragard Oct 19, 2022
07caabb
chore: change header guest to guest header
Haaragard Oct 20, 2022
e1f83f5
refactor: improve code on auth header
Haaragard Oct 20, 2022
976871c
fix: remove contractor profile middleware from works routes
Haaragard Oct 20, 2022
058c5d1
refactor: change works auth header menu button location
Haaragard Oct 20, 2022
8fb8792
refactor: list and show works
Haaragard Oct 20, 2022
846454b
refactor: hired works routes
Haaragard Oct 20, 2022
a82c3e2
fix: change unmodified hired works routes
Haaragard Oct 20, 2022
e97fe06
refactor: change controllers locations
Haaragard Oct 20, 2022
ad2d5a0
refactor: move my works controllers to new folder
Haaragard Oct 20, 2022
0c40e3d
refactor: request for store and destroy contractors hired works
Haaragard Oct 20, 2022
23bde9a
feat: add worker hired works list page
Haaragard Oct 20, 2022
478da61
feat: add worker list hired works controller and route
Haaragard Oct 20, 2022
8c770cc
feat: add worker destroy hired work request
Haaragard Oct 20, 2022
b15b9c2
feat: add worker destroy hired work route and controller
Haaragard Oct 20, 2022
9c2a6e7
feat: add and improve hired work links on auth header
Haaragard Oct 20, 2022
a51da4d
Merge pull request #70 from TCC-Klaiton-Diogo/feature/TKD-89
Haaragard Oct 20, 2022
bd177fa
feat: add telescope to local project
Haaragard Oct 23, 2022
ff369ea
Merge pull request #71 from TCC-Klaiton-Diogo/feature/TKD-91
Haaragard Oct 23, 2022
8fc0103
feat: add validation message for work is not from auth worker
Haaragard Oct 23, 2022
90c14f6
feat: add worker info in show works controller
Haaragard Oct 23, 2022
6d5c966
feat: add custom validation for store hired work request
Haaragard Oct 23, 2022
18c7cbe
refactor: improve auth header component
Haaragard Oct 23, 2022
fa2e5b8
feat: remove button hire on show work if auth user is owner of work
Haaragard Oct 23, 2022
216c056
Merge pull request #72 from TCC-Klaiton-Diogo/feature/TKD-92
Haaragard Oct 23, 2022
cff40e6
fix: destroy my works redirect
Haaragard Oct 23, 2022
82d2b2c
Merge pull request #73 from TCC-Klaiton-Diogo/feature/TKD-93
Haaragard Oct 23, 2022
2dcbea6
refactor: update methods name pattern
Haaragard Oct 23, 2022
4f459d5
chore: move protected functions
Haaragard Oct 24, 2022
ef6fee4
feat: add filter scope in work model
Haaragard Oct 24, 2022
d1b85af
feat: change default cache driver to cache
Haaragard Oct 24, 2022
3972600
feat: add works paginate method in work cache service
Haaragard Oct 24, 2022
e311f58
feat: add cache clear in work observer
Haaragard Oct 24, 2022
ba1d8a7
feat: change work model get to cache paginate on list works
Haaragard Oct 24, 2022
a141db9
feat: change link component default text color
Haaragard Oct 24, 2022
1b0c33d
feat: add pagination component
Haaragard Oct 24, 2022
1df6aa3
feat: add pagination into list page
Haaragard Oct 24, 2022
c47e175
Merge pull request #74 from TCC-Klaiton-Diogo/feature/TKD-94
Haaragard Oct 24, 2022
f0b1b40
feat: add v-calendar plugin
Haaragard Oct 24, 2022
2ed49dd
feat: add modal component
Haaragard Oct 25, 2022
6827d69
feat: add migration to create column scheduled_to on hired_works table
Haaragard Oct 26, 2022
a837000
feat: add hired work model casts and new attribute
Haaragard Oct 26, 2022
3401bc7
feat: add new hired work factory state scheduledTo
Haaragard Oct 26, 2022
a1b7df0
feat: add new seeding addScheduledTo method
Haaragard Oct 26, 2022
1c55e56
chore: improve modal component
Haaragard Oct 26, 2022
c2a362a
chore: improve modal content margin top
Haaragard Oct 26, 2022
5208302
feat: add rule for scheduled_to param
Haaragard Oct 26, 2022
3a7aa12
feat: add extra data into store hired work action
Haaragard Oct 26, 2022
e875e03
feat: add second param on store hired work method in action usage
Haaragard Oct 26, 2022
8230a67
feat: add calendar and modal into show work
Haaragard Oct 26, 2022
9c7bef2
Merge pull request #75 from TCC-Klaiton-Diogo/feature/TKD-97
Haaragard Oct 26, 2022
6f171f9
chore: align icon in center
Haaragard Oct 28, 2022
2b73a89
feat: add scope filter in hired work model
Haaragard Oct 28, 2022
4a8fc1d
feat: add hired work cache service
Haaragard Oct 28, 2022
e836278
feat: add hired work observer
Haaragard Oct 28, 2022
862f48e
feat: add show appointments controller
Haaragard Oct 28, 2022
8cdd621
feat: add show appointments route
Haaragard Oct 28, 2022
fa395cb
feat: add show appointments from worker
Haaragard Oct 28, 2022
8e0de94
chore: change listing view
Haaragard Oct 28, 2022
684e823
feat: add appointments show profile on sidebar menu
Haaragard Oct 28, 2022
34dee6a
Merge pull request #76 from TCC-Klaiton-Diogo/feature/TKD-98
Haaragard Oct 28, 2022
d042a7f
feat: add find uuid for hired work cache service
Haaragard Oct 30, 2022
5187c56
feat: add clear cache for works paginate
Haaragard Oct 30, 2022
6dcc5c1
feat: add clear cache on store and destroy hired works
Haaragard Oct 30, 2022
ea71ecb
feat: add show hired work for contractor
Haaragard Oct 30, 2022
96bfc63
feat: add hired work show info page for contractor
Haaragard Oct 30, 2022
89b0ffb
feat: change hired work link for show page
Haaragard Oct 30, 2022
d4bb710
feat: add default env.example infos
Haaragard Oct 30, 2022
cbd8086
Merge pull request #77 from TCC-Klaiton-Diogo/feature/TKD-96
Haaragard Oct 30, 2022
8c9d4e6
feat: add validate hired work is done rule
Haaragard Nov 1, 2022
9a98d56
feat: add validate hired work is not initiated rule
Haaragard Nov 1, 2022
68a6ffa
feat: add validate worker own hired work rule
Haaragard Nov 1, 2022
5508eb7
feat: improve destroy hired work request
Haaragard Nov 1, 2022
4d2c61b
feat: add initiate hired work request
Haaragard Nov 1, 2022
661a1f5
feat: add done hired work request
Haaragard Nov 1, 2022
9ad3314
feat: add worker param on hired work factory with work state
Haaragard Nov 1, 2022
dc6aaaf
feat: add new validation messages
Haaragard Nov 1, 2022
a659f6c
chore: improve list hired works controller
Haaragard Nov 1, 2022
6f0c710
feat: add initiate hired work route and controller
Haaragard Nov 1, 2022
cdf9932
feat: add done hired work route and controller
Haaragard Nov 1, 2022
d6bbfe4
feat: add show worker hired work route and controller
Haaragard Nov 1, 2022
cea5d26
feat: add done and initiate hired work tests
Haaragard Nov 1, 2022
97909df
feat: add show worker hired work and actions page
Haaragard Nov 1, 2022
615cb24
Merge pull request #78 from TCC-Klaiton-Diogo/feature/TKD-73
Haaragard Nov 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
APP_NAME=GetWorkers
APP_ENV=local
APP_KEY=
APP_KEY=base64:aVMtLD3etBMMjYwXaeZ6kaXE6MSzrW7hXScWhPvQzhQ=
APP_DEBUG=true
APP_URL=http://get-workers.test

Expand All @@ -9,14 +9,14 @@ LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=get_workers
DB_USERNAME=root
DB_PASSWORD=
DB_PASSWORD=password

BROADCAST_DRIVER=log
CACHE_DRIVER=file
CACHE_DRIVER=redis
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=database
Expand Down
5 changes: 3 additions & 2 deletions app/Actions/Auth/CreateNewUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Actions\Auth;

use App\Exceptions\CreateUserException;
use App\Models\Contractor;
use App\Models\User;
use App\Models\Worker;
use Illuminate\Support\Facades\DB;
Expand Down Expand Up @@ -60,9 +61,9 @@ private function createWorkerFromUser(User $user): Worker

/**
* @param User $user
* @return Worker
* @return Contractor
*/
private function createContractorFromUser(User $user): Worker
private function createContractorFromUser(User $user): Contractor
{
return $user->contractor()->create();
}
Expand Down
22 changes: 22 additions & 0 deletions app/Actions/Work/HiredWork/StoreHiredWork.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace App\Actions\Work\HiredWork;

use App\Models\HiredWork;
use App\Models\Contractor;
use App\Models\Work;
use App\Services\Caches\HiredWorkCacheService;

class StoreHiredWork
{
public function storeHiredWork(Contractor $contractor, Work $work, array $data = []): void
{
$hiredWork = new HiredWork([
'price' => $work->price,
...$data,
]);
$hiredWork->work()->associate($work);
$contractor->hiredWorks()->save($hiredWork);
HiredWorkCacheService::fromWorker(clearTag: true);
}
}
2 changes: 1 addition & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
$schedule->command('telescope:prune')->daily();
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace App\Http\Controllers\User\Contractor\HiredWork;

use App\Http\Controllers\Controller;
use App\Http\Requests\User\Contractor\HiredWork\DestroyHiredWorkRequest;
use App\Services\Caches\HiredWorkCacheService;
use Illuminate\Http\RedirectResponse;

class DestroyHiredWorksController extends Controller
{
/**
* Handle the incoming request.
*
* @param \App\Http\Requests\Work\HiredWork\StoreHiredWorkRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function __invoke(DestroyHiredWorkRequest $request): RedirectResponse
{
$hiredWorkUuid = $request->validated('hiredWork');

auth()->user()->contractor
->hiredWorks()
->whereUuid($hiredWorkUuid)
->first()
->delete();

HiredWorkCacheService::findUuid($hiredWorkUuid, clear: true);

return redirect()->route('user.contractor.hired-works.list')->with('destroy', true);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace App\Http\Controllers\User\Contractor\HiredWork;

use App\Http\Controllers\Controller;
use Inertia\Response;

class ListHiredWorksController extends Controller
{
/**
* Handle the incoming request.
*
* @return \Inertia\Response
*/
public function __invoke(): Response
{
$hiredWorks = auth()->user()->contractor->hiredWorks;
$hiredWorks->load(['work', 'work.worker', 'work.unity', 'work.specialties']);
return inertia('User/Contractor/HiredWorks/List', compact('hiredWorks'));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace App\Http\Controllers\User\Contractor\HiredWork;

use App\Http\Controllers\Controller;
use App\Services\Caches\HiredWorkCacheService;
use Illuminate\Http\Response as HttpResponse;
use Inertia\Response;

class ShowHiredWorksController extends Controller
{
/**
* Handle the incoming request.
*
* @return \Inertia\Response
*/
public function __invoke(string $hiredWorkUuid): Response
{
$hiredWork = HiredWorkCacheService::findUuid($hiredWorkUuid, [
'work',
'work.unity',
'work.worker',
'work.worker.user',
'contractor',
]);
if (is_null($hiredWork)) {
abort(HttpResponse::HTTP_NOT_FOUND);
}

return inertia('User/Contractor/HiredWorks/Show', compact('hiredWork'));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace App\Http\Controllers\User\Contractor\HiredWork;

use App\Actions\Work\HiredWork\StoreHiredWork;
use App\Http\Controllers\Controller;
use App\Http\Requests\User\Contractor\HiredWork\StoreHiredWorkRequest;
use App\Models\Work;
use Illuminate\Http\RedirectResponse;

class StoreHiredWorksController extends Controller
{
private StoreHiredWork $action;

public function __construct(StoreHiredWork $action)
{
$this->action = $action;
}

/**
* Handle the incoming request.
*
* @param \App\Http\Requests\Work\HiredWork\StoreHiredWorkRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function __invoke(StoreHiredWorkRequest $request): RedirectResponse
{
$workUuid = $request->validated(['work']);
$work = Work::where('uuid', $workUuid)
->firstOrFail();

$request->validated();
$this->action->storeHiredWork(auth()->user()->contractor, $work, $request->safe(['scheduled_to']));

return redirect()->route('works.show', ['workUuid' => $work->uuid])->with('store', true);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace App\Http\Controllers\User\Profile\Worker\Appointments;

use App\Http\Controllers\Controller;
use App\Services\Caches\HiredWorkCacheService;
use Illuminate\Http\Request;
use Inertia\Response;

class ShowAppointmentsController extends Controller
{
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Inertia\Response
*/
public function __invoke(Request $request): Response
{
$hiredWorks = HiredWorkCacheService::fromWorker(
worker: auth()->user()->worker,
with: 'work.worker.user',
filters: ['scheduled_to']
) ?? [];
return inertia('User/Profile/Worker/Appointments/Show', compact('hiredWorks'));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ShowCertificationsController extends Controller
*/
public function __invoke(Request $request): Response
{
$certifications = CertificationCacheService::FromWorker(auth()->user()->worker) ?? [];
$certifications = CertificationCacheService::fromWorker(auth()->user()->worker) ?? [];

$storeStatus = session()->get('store', false);
$deleteStatus = session()->get('destroy', false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ShowSpecialtiesController extends Controller
*/
public function __invoke(Request $request): Response
{
$userSpecialties = SpecialtyWorkerCacheService::FromWorker(auth()->user()->worker);
$userSpecialties = SpecialtyWorkerCacheService::fromWorker(auth()->user()->worker);

$userSpecialtiesIds = $userSpecialties->pluck('id');
$specialties = Specialty::whereKeyNot($userSpecialtiesIds)->get();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Http\Controllers\User\Worker\HiredWork;

use App\Http\Controllers\Controller;
use App\Http\Requests\User\Worker\HiredWork\DestroyHiredWorkRequest;
use App\Models\HiredWork;
use App\Services\Caches\HiredWorkCacheService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\RedirectResponse;

class DestroyHiredWorksController extends Controller
{
/**
* Handle the incoming request.
*
* @param \App\Http\Requests\Work\HiredWork\StoreHiredWorkRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function __invoke(DestroyHiredWorkRequest $request): RedirectResponse
{
$worker = auth()->user()->worker;
$hiredWorkUuid = $request->validated('hiredWork');


HiredWork::whereUuid($hiredWorkUuid)
->whereHas('work.worker', function (Builder $query) use (&$worker) {
$query->whereId($worker->id);
})
->delete();

HiredWorkCacheService::fromWorker(clearTag: true);

return redirect()->route('user.worker.hired-works.list')->with('destroy', true);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace App\Http\Controllers\User\Worker\HiredWork;

use App\Http\Controllers\Controller;
use App\Http\Requests\User\Worker\HiredWork\DoneHiredWorkRequest;
use App\Services\Caches\HiredWorkCacheService;
use Illuminate\Http\RedirectResponse;

class DoneHiredWorksController extends Controller
{
/**
* Handle the incoming request.
*
* @param DoneHiredWorkRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function __invoke(DoneHiredWorkRequest $request): RedirectResponse
{
$hiredWork = HiredWorkCacheService::findUuid($request->validated('hiredWork'));
$hiredWork->done_at = now();
$hiredWork->save();

HiredWorkCacheService::findUuid(clearTag: true);
HiredWorkCacheService::fromWorker(clearTag: true);

return redirect()->route('user.worker.hired-works.show', ['hiredWorkUuid' => $hiredWork->uuid]);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace App\Http\Controllers\User\Worker\HiredWork;

use App\Http\Controllers\Controller;
use App\Http\Requests\User\Worker\HiredWork\InitiateHiredWorkRequest;
use App\Services\Caches\HiredWorkCacheService;
use Illuminate\Http\RedirectResponse;

class InitiateHiredWorksController extends Controller
{
/**
* Handle the incoming request.
*
* @param InitiateHiredWorkRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function __invoke(InitiateHiredWorkRequest $request): RedirectResponse
{
$hiredWork = HiredWorkCacheService::findUuid($request->validated('hiredWork'));
$hiredWork->initiated_at = now();
$hiredWork->save();

HiredWorkCacheService::findUuid(clearTag: true);
HiredWorkCacheService::fromWorker(clearTag: true);

return redirect()->route('user.worker.hired-works.show', ['hiredWorkUuid' => $hiredWork->uuid]);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace App\Http\Controllers\User\Worker\HiredWork;

use App\Http\Controllers\Controller;
use App\Models\HiredWork;
use Inertia\Response;

class ListHiredWorksController extends Controller
{
/**
* Handle the incoming request.
*
* @return \Inertia\Response
*/
public function __invoke(): Response
{
$works = auth()->user()->worker->works()->whereHas('hiredWorks')->get();
$hiredWorks = HiredWork::whereIn('work_id', $works->modelKeys())
->with(['work', 'work.worker', 'work.unity', 'work.specialties'])
->latest()
->get();
return inertia('User/Worker/HiredWorks/List', compact('hiredWorks'));
}
}
Loading