Added client and organization endpoints

This commit is contained in:
Constantin Graf
2024-03-01 16:34:26 +01:00
parent a86e72f655
commit e8912650c0
18 changed files with 679 additions and 17 deletions

View File

@@ -2,6 +2,8 @@
declare(strict_types=1);
use App\Http\Controllers\Api\V1\ClientController;
use App\Http\Controllers\Api\V1\OrganizationController;
use App\Http\Controllers\Api\V1\ProjectController;
use App\Http\Controllers\Api\V1\TagController;
use App\Http\Controllers\Api\V1\TimeEntryController;
@@ -20,29 +22,43 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
*/
Route::middleware('auth:api')->prefix('v1')->name('v1.')->group(static function () {
// Organization routes
Route::name('organizations.')->group(static function () {
Route::get('/organizations/{organization}', [OrganizationController::class, 'show'])->name('show');
Route::put('/organizations/{organization}', [OrganizationController::class, 'update'])->name('update');
});
// Project routes
Route::name('projects.')->group(static function () {
Route::get('/organization/{organization}/projects', [ProjectController::class, 'index'])->name('index');
Route::get('/organization/{organization}/projects/{project}', [ProjectController::class, 'show'])->name('show');
Route::post('/organization/{organization}/projects', [ProjectController::class, 'store'])->name('store');
Route::put('/organization/{organization}/projects/{project}', [ProjectController::class, 'update'])->name('update');
Route::delete('/organization/{organization}/projects/{project}', [ProjectController::class, 'destroy'])->name('destroy');
Route::get('/organizations/{organization}/projects', [ProjectController::class, 'index'])->name('index');
Route::get('/organizations/{organization}/projects/{project}', [ProjectController::class, 'show'])->name('show');
Route::post('/organizations/{organization}/projects', [ProjectController::class, 'store'])->name('store');
Route::put('/organizations/{organization}/projects/{project}', [ProjectController::class, 'update'])->name('update');
Route::delete('/organizations/{organization}/projects/{project}', [ProjectController::class, 'destroy'])->name('destroy');
});
// Time entry routes
Route::name('time-entries.')->group(static function () {
Route::get('/organization/{organization}/time-entries', [TimeEntryController::class, 'index'])->name('index');
Route::post('/organization/{organization}/time-entries', [TimeEntryController::class, 'store'])->name('store');
Route::put('/organization/{organization}/time-entries/{timeEntry}', [TimeEntryController::class, 'update'])->name('update');
Route::delete('/organization/{organization}/time-entries/{timeEntry}', [TimeEntryController::class, 'destroy'])->name('destroy');
Route::get('/organizations/{organization}/time-entries', [TimeEntryController::class, 'index'])->name('index');
Route::post('/organizations/{organization}/time-entries', [TimeEntryController::class, 'store'])->name('store');
Route::put('/organizations/{organization}/time-entries/{timeEntry}', [TimeEntryController::class, 'update'])->name('update');
Route::delete('/organizations/{organization}/time-entries/{timeEntry}', [TimeEntryController::class, 'destroy'])->name('destroy');
});
// Tag routes
Route::name('tags.')->group(static function () {
Route::get('/organization/{organization}/tags', [TagController::class, 'index'])->name('index');
Route::post('/organization/{organization}/tags', [TagController::class, 'store'])->name('store');
Route::put('/organization/{organization}/tags/{tag}', [TagController::class, 'update'])->name('update');
Route::delete('/organization/{organization}/tags/{tag}', [TagController::class, 'destroy'])->name('destroy');
Route::get('/organizations/{organization}/tags', [TagController::class, 'index'])->name('index');
Route::post('/organizations/{organization}/tags', [TagController::class, 'store'])->name('store');
Route::put('/organizations/{organization}/tags/{tag}', [TagController::class, 'update'])->name('update');
Route::delete('/organizations/{organization}/tags/{tag}', [TagController::class, 'destroy'])->name('destroy');
});
// Client routes
Route::name('clients.')->group(static function () {
Route::get('/organizations/{organization}/clients', [ClientController::class, 'index'])->name('index');
Route::post('/organizations/{organization}/clients', [ClientController::class, 'store'])->name('store');
Route::put('/organizations/{organization}/clients/{client}', [ClientController::class, 'update'])->name('update');
Route::delete('/organizations/{organization}/clients/{client}', [ClientController::class, 'destroy'])->name('destroy');
});
});