Update AuditTrail entity with standardized column naming and new constants

- Renamed entity columns to adhere to naming convention (`action`, `id`, `occurredat`, `user_id`, `description`, `targets`, `metadata`).
- Added constants for audit actions (`AUDIT_VIEW`, `AUDIT_CREATE`, `AUDIT_UPDATE`, `AUDIT_DELETE`).
This commit is contained in:
2026-01-28 16:18:58 +01:00
parent ee624cae4b
commit e27876aeeb

View File

@@ -19,28 +19,33 @@ use Ramsey\Uuid\UuidInterface;
#[ORM\Table(name: 'chill_main_audit_trail')]
class AuditTrail
{
public const AUDIT_VIEW = 'view';
public const AUDIT_CREATE = 'create';
public const AUDIT_UPDATE = 'update';
public const AUDIT_DELETE = 'delete';
public function __construct(
#[ORM\Id]
#[ORM\Column(type: 'uuid', unique: true)]
#[ORM\Column(type: 'uuid', unique: true, name: 'id')]
private UuidInterface $id,
#[ORM\Column(type: Types::STRING, length: 255)]
#[ORM\Column(type: Types::STRING, length: 255, name: 'action')]
private string $action,
#[ORM\Column(type: Types::DATETIMETZ_IMMUTABLE)]
#[ORM\Column(type: Types::DATETIMETZ_IMMUTABLE, name: 'occurredat')]
private \DateTimeImmutable $occurredAt,
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: true)]
#[ORM\JoinColumn(nullable: true, name: 'user_id', referencedColumnName: 'id')]
private ?User $user = null,
#[ORM\Column(type: Types::STRING, length: 255, nullable: false, options: ['default' => ''])]
#[ORM\Column(type: Types::STRING, length: 255, nullable: false, options: ['default' => ''], name: 'description')]
private string $description = '',
/**
* @var list<array<string, mixed>>
*/
#[ORM\Column(type: Types::JSON, options: ['jsonb' => true, 'default' => "'[]'::jsonb"])]
#[ORM\Column(type: Types::JSON, options: ['jsonb' => true, 'default' => "'[]'::jsonb"], name: 'targets')]
private array $targets = [],
/**
* @var array<array-key, mixed>
*/
#[ORM\Column(type: Types::JSON, options: ['jsonb' => true, 'default' => "'[]'::jsonb"])]
#[ORM\Column(type: Types::JSON, options: ['jsonb' => true, 'default' => "'[]'::jsonb"], name: 'metadata')]
private array $metadata = [],
) {}