docs(openspec): add reporting API contract documentation
Add comprehensive API documentation for the reporting endpoint: - Request/response structure - View type inference (did/is/will) - Blank vs explicit zero semantics - Status values and error responses Related to enhanced-allocation change.
This commit is contained in:
50
backend/app/Models/ProjectMonthPlan.php
Normal file
50
backend/app/Models/ProjectMonthPlan.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class ProjectMonthPlan extends Model
|
||||
{
|
||||
use HasUuids;
|
||||
|
||||
protected $table = 'project_month_plans';
|
||||
|
||||
protected $fillable = [
|
||||
'project_id',
|
||||
'month',
|
||||
'planned_hours',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'month' => 'date:Y-m-01',
|
||||
'planned_hours' => 'decimal:2',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the project this plan belongs to.
|
||||
*/
|
||||
public function project(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Project::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this plan cell is blank (unset).
|
||||
*/
|
||||
public function isBlank(): bool
|
||||
{
|
||||
return $this->planned_hours === null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get planned hours or 0 for variance calculations.
|
||||
* Blank plan is treated as 0 for allocation variance.
|
||||
*/
|
||||
public function getPlannedHoursForVariance(): float
|
||||
{
|
||||
return (float) ($this->planned_hours ?? 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user