Implement compliance exports and retention overrides
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\DataExportScope;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -21,7 +22,10 @@ class DataExport extends Model
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'tenant_id',
|
||||
'event_id',
|
||||
'status',
|
||||
'scope',
|
||||
'include_media',
|
||||
'path',
|
||||
'size_bytes',
|
||||
'expires_at',
|
||||
@@ -30,6 +34,8 @@ class DataExport extends Model
|
||||
|
||||
protected $casts = [
|
||||
'expires_at' => 'datetime',
|
||||
'include_media' => 'boolean',
|
||||
'scope' => DataExportScope::class,
|
||||
];
|
||||
|
||||
public function user(): BelongsTo
|
||||
@@ -42,6 +48,11 @@ class DataExport extends Model
|
||||
return $this->belongsTo(Tenant::class);
|
||||
}
|
||||
|
||||
public function event(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Event::class);
|
||||
}
|
||||
|
||||
public function isReady(): bool
|
||||
{
|
||||
return $this->status === self::STATUS_READY;
|
||||
|
||||
@@ -104,6 +104,11 @@ class Event extends Model
|
||||
return $this->hasMany(EventPackage::class);
|
||||
}
|
||||
|
||||
public function retentionOverrides(): HasMany
|
||||
{
|
||||
return $this->hasMany(RetentionOverride::class);
|
||||
}
|
||||
|
||||
public function joinTokens(): HasMany
|
||||
{
|
||||
return $this->hasMany(EventJoinToken::class);
|
||||
|
||||
55
app/Models/RetentionOverride.php
Normal file
55
app/Models/RetentionOverride.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\RetentionOverrideScope;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class RetentionOverride extends Model
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\RetentionOverrideFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'scope',
|
||||
'tenant_id',
|
||||
'event_id',
|
||||
'reason',
|
||||
'note',
|
||||
'created_by_id',
|
||||
'released_by_id',
|
||||
'released_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'scope' => RetentionOverrideScope::class,
|
||||
'released_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function tenant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Tenant::class);
|
||||
}
|
||||
|
||||
public function event(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Event::class);
|
||||
}
|
||||
|
||||
public function createdBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by_id');
|
||||
}
|
||||
|
||||
public function releasedBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'released_by_id');
|
||||
}
|
||||
|
||||
public function isActive(): bool
|
||||
{
|
||||
return $this->released_at === null;
|
||||
}
|
||||
}
|
||||
@@ -86,6 +86,11 @@ class Tenant extends Model
|
||||
return $this->hasMany(TenantAnnouncementDelivery::class);
|
||||
}
|
||||
|
||||
public function retentionOverrides(): HasMany
|
||||
{
|
||||
return $this->hasMany(RetentionOverride::class);
|
||||
}
|
||||
|
||||
public function packages(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Package::class, 'tenant_packages')
|
||||
|
||||
Reference in New Issue
Block a user