Added time estimates for projects and tasks, fixes ST-283

This commit is contained in:
Constantin Graf
2024-07-02 16:36:15 +02:00
committed by Gregor Vostrak
parent 78ea8a673b
commit a820d8540f
18 changed files with 402 additions and 6 deletions

View File

@@ -52,6 +52,7 @@ class ProjectStoreRequest extends FormRequest
'integer',
'min:0',
],
// ID of the client
'client_id' => [
'nullable',
new ExistsEloquent(Client::class, null, function (Builder $builder): Builder {
@@ -59,6 +60,12 @@ class ProjectStoreRequest extends FormRequest
return $builder->whereBelongsTo($this->organization, 'organization');
}),
],
// Estimated time in seconds
'estimated_time' => [
'nullable',
'integer',
'min:0',
],
];
}
@@ -68,4 +75,11 @@ class ProjectStoreRequest extends FormRequest
return $input !== null && $input !== 0 ? (int) $this->input('billable_rate') : null;
}
public function getEstimatedTime(): ?int
{
$input = $this->input('estimated_time');
return $input !== null && $input !== 0 ? (int) $this->input('estimated_time') : null;
}
}

View File

@@ -62,6 +62,12 @@ class ProjectUpdateRequest extends FormRequest
'integer',
'min:0',
],
// Estimated time in seconds
'estimated_time' => [
'nullable',
'integer',
'min:0',
],
];
}
@@ -78,4 +84,11 @@ class ProjectUpdateRequest extends FormRequest
return $input !== null && $input !== 0 ? (int) $this->input('billable_rate') : null;
}
public function getEstimatedTime(): ?int
{
$input = $this->input('estimated_time');
return $input !== null && $input !== 0 ? (int) $this->input('estimated_time') : null;
}
}

View File

@@ -43,6 +43,19 @@ class TaskStoreRequest extends FormRequest
return $builder->whereBelongsTo($this->organization, 'organization');
}),
],
// Estimated time in seconds
'estimated_time' => [
'nullable',
'integer',
'min:0',
],
];
}
public function getEstimatedTime(): ?int
{
$input = $this->input('estimated_time');
return $input !== null && $input !== 0 ? (int) $this->input('estimated_time') : null;
}
}

View File

@@ -38,6 +38,12 @@ class TaskUpdateRequest extends FormRequest
'is_done' => [
'boolean',
],
// Estimated time in seconds
'estimated_time' => [
'nullable',
'integer',
'min:0',
],
];
}
@@ -47,4 +53,11 @@ class TaskUpdateRequest extends FormRequest
return $this->boolean('is_done');
}
public function getEstimatedTime(): ?int
{
$input = $this->input('estimated_time');
return $input !== null && $input !== 0 ? (int) $this->input('estimated_time') : null;
}
}