Merge branch 'feature/import' into feature/add_frontend_dashboard

# Conflicts:
#	app/Http/Controllers/Api/V1/TimeEntryController.php
#	app/Providers/JetstreamServiceProvider.php
This commit is contained in:
Constantin Graf
2024-03-12 17:55:49 +01:00
96 changed files with 3444 additions and 109 deletions

View File

@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace App\Http\Requests\V1\Import;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class ImportRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, array<string|ValidationRule>>
*/
public function rules(): array
{
return [
'type' => [
'required',
'string',
],
'data' => [
'required',
'string',
],
];
}
}

View File

@@ -6,6 +6,7 @@ namespace App\Http\Requests\V1\Project;
use App\Models\Client;
use App\Models\Organization;
use App\Rules\ColorRule;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Foundation\Http\FormRequest;
@@ -25,6 +26,7 @@ class ProjectStoreRequest extends FormRequest
{
return [
'name' => [
// TODO: unique
'required',
'string',
'min:1',
@@ -34,6 +36,7 @@ class ProjectStoreRequest extends FormRequest
'required',
'string',
'max:255',
new ColorRule(),
],
'client_id' => [
'nullable',

View File

@@ -6,6 +6,7 @@ namespace App\Http\Requests\V1\Project;
use App\Models\Client;
use App\Models\Organization;
use App\Rules\ColorRule;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Foundation\Http\FormRequest;
@@ -25,6 +26,7 @@ class ProjectUpdateRequest extends FormRequest
{
return [
'name' => [
// TODO: unique
'required',
'string',
'max:255',
@@ -33,6 +35,7 @@ class ProjectUpdateRequest extends FormRequest
'required',
'string',
'max:255',
new ColorRule(),
],
'client_id' => [
'nullable',

View File

@@ -18,6 +18,7 @@ class TagStoreRequest extends FormRequest
{
return [
'name' => [
// TODO: unique
'required',
'string',
'min:1',

View File

@@ -18,6 +18,7 @@ class TagUpdateRequest extends FormRequest
{
return [
'name' => [
// TODO: unique
'required',
'string',
'min:1',

View File

@@ -30,10 +30,7 @@ class TimeEntryIndexRequest extends FormRequest
'uuid',
new ExistsEloquent(User::class, null, function (Builder $builder): Builder {
/** @var Builder<User> $builder */
return $builder->whereHas('organizations', function (Builder $builder) {
/** @var Builder<Organization> $builder */
return $builder->whereKey($this->organization->getKey());
});
return $builder->belongsToOrganization($this->organization);
}),
],
// Filter only time entries that have a start date before (not including) the given date (example: 2021-12-31)

View File

@@ -33,10 +33,7 @@ class TimeEntryStoreRequest extends FormRequest
'uuid',
new ExistsEloquent(User::class, null, function (Builder $builder): Builder {
/** @var Builder<User> $builder */
return $builder->whereHas('organizations', function (Builder $builder) {
/** @var Builder<Organization> $builder */
return $builder->whereKey($this->organization->getKey());
});
return $builder->belongsToOrganization($this->organization);
}),
],
// ID of the task that the time entry should belong to
@@ -64,7 +61,7 @@ class TimeEntryStoreRequest extends FormRequest
'description' => [
'nullable',
'string',
'max:255',
'max:500',
],
// List of tag IDs
'tags' => [

View File

@@ -51,7 +51,7 @@ class TimeEntryUpdateRequest extends FormRequest
'description' => [
'nullable',
'string',
'max:255',
'max:500',
],
// List of tag IDs
'tags' => [

View File

@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace App\Http\Requests\V1\User;
use App\Models\Organization;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
/**
* @property Organization $organization
*/
class UserIndexRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, array<string|ValidationRule>>
*/
public function rules(): array
{
return [
];
}
}