chore: add BMAD framework modules, folder features, and tooling configs

Includes BMAD bmb/bmm/cis/tea workflow modules, folder (declaration)
feature implementation (controllers, models, enums, views, tests),
claude/cursor command configs, and email templates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 21:24:17 +01:00
parent a02b5f12d8
commit 7a18c40361
695 changed files with 86662 additions and 0 deletions

149
app/Models/Folder.php Normal file
View File

@@ -0,0 +1,149 @@
<?php
namespace App\Models;
use App\Enums\FolderPriority;
use App\Enums\FolderStatus;
use App\Enums\FolderType;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
class Folder extends Model implements HasMedia
{
/** @use HasFactory<\Database\Factories\FolderFactory> */
use HasFactory, InteractsWithMedia, LogsActivity, SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'workspace_id',
'client_id',
'created_by',
'title',
'type',
'period_year',
'period_month',
'period_quarter',
'due_date',
'status',
'priority',
'assigned_to',
'validated_at',
'closed_at',
'confirmation_requested_at',
'confirmation_media_id',
'confirmed_by_type',
'confirmed_by_id',
'confirmation_signature',
'refused_at',
'refusal_reason',
'notes_internal',
'notes_client',
'created_at',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'type' => FolderType::class,
'status' => FolderStatus::class,
'priority' => FolderPriority::class,
'validated_at' => 'datetime',
'closed_at' => 'datetime',
'confirmation_requested_at' => 'datetime',
'refused_at' => 'datetime',
'due_date' => 'date',
];
}
/**
* Register media collections.
*/
public function registerMediaCollections(): void
{
$this->addMediaCollection('documents')->useDisk('local');
}
/**
* Get the workspace that owns the folder.
*
* @return BelongsTo<Workspace, $this>
*/
public function workspace(): BelongsTo
{
return $this->belongsTo(Workspace::class);
}
/**
* Get the client that owns the folder.
*
* @return BelongsTo<Client, $this>
*/
public function client(): BelongsTo
{
return $this->belongsTo(Client::class);
}
/**
* Get the user who created the folder.
*
* @return BelongsTo<User, $this>
*/
public function creator(): BelongsTo
{
return $this->belongsTo(User::class, 'created_by');
}
/**
* Get the user assigned to the folder.
*
* @return BelongsTo<User, $this>
*/
public function assignee(): BelongsTo
{
return $this->belongsTo(User::class, 'assigned_to');
}
/**
* Get the messages for the folder.
*
* @return HasMany<Message>
*/
public function messages(): HasMany
{
return $this->hasMany(Message::class);
}
/**
* Get the invitations for the folder.
*
* @return HasMany<FolderInvitation>
*/
public function invitations(): HasMany
{
return $this->hasMany(FolderInvitation::class);
}
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()
->logFillable()
->logOnlyDirty()
->dontSubmitEmptyLogs();
}
}

View File

@@ -0,0 +1,72 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Str;
class FolderInvitation extends Model
{
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'folder_id',
'token',
'email',
'expires_at',
'used_at',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'expires_at' => 'datetime',
'used_at' => 'datetime',
];
}
/**
* Boot the model.
*/
protected static function boot(): void
{
parent::boot();
static::creating(function (FolderInvitation $invitation) {
if (empty($invitation->token)) {
$invitation->token = Str::uuid()->toString();
}
});
}
/**
* Get the folder that owns the invitation.
*
* @return BelongsTo<Folder, $this>
*/
public function folder(): BelongsTo
{
return $this->belongsTo(Folder::class);
}
/**
* Check if the invitation is valid (not expired, not used).
*/
public function isValid(): bool
{
if ($this->used_at !== null) {
return false;
}
return $this->expires_at->isFuture();
}
}