Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| SignatureAuditWriter | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| write | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace ImovelZapAi\Signatures\Application\Services; |
| 6 | |
| 7 | use ImovelZapAi\Signatures\Domain\Enums\SignatureAuditEvent; |
| 8 | use ImovelZapAi\Signatures\Infrastructure\Persistence\Eloquent\SignatureAuditModel; |
| 9 | |
| 10 | final class SignatureAuditWriter |
| 11 | { |
| 12 | /** @param array<string, mixed>|null $payload */ |
| 13 | public function write( |
| 14 | string $tenantId, |
| 15 | string $requestId, |
| 16 | SignatureAuditEvent $event, |
| 17 | string $actorType = 'system', |
| 18 | ?int $actorUserId = null, |
| 19 | ?string $signerId = null, |
| 20 | ?array $payload = null, |
| 21 | ?string $message = null, |
| 22 | ): void { |
| 23 | SignatureAuditModel::query()->create([ |
| 24 | 'tenant_id' => $tenantId, |
| 25 | 'signature_request_id' => $requestId, |
| 26 | 'event' => $event, |
| 27 | 'actor_type' => $actorType, |
| 28 | 'actor_user_id' => $actorUserId, |
| 29 | 'signer_id' => $signerId, |
| 30 | 'payload' => $payload, |
| 31 | 'message' => $message, |
| 32 | 'created_at' => now(), |
| 33 | ]); |
| 34 | } |
| 35 | } |