fix gitlab tests

This commit is contained in:
root
2026-06-09 02:32:58 -04:00
parent 20a0b6c4e5
commit 6def9993da
1489 changed files with 10449 additions and 11356 deletions
@@ -10,16 +10,18 @@ use RuntimeException;
class MessageCommandService
{
public function __construct(private GlobalConfigService $configService) {}
public function __construct(private GlobalConfigService $configService)
{
}
public function create(int $senderId, array $payload, ?UploadedFile $attachment = null): Message
{
$recipientId = $payload['recipient_id'] ?? null;
if (! $recipientId && ! empty($payload['recipient_role'])) {
if (!$recipientId && !empty($payload['recipient_role'])) {
$recipientId = $this->recipientIdFromRole($payload['recipient_role']);
}
if (! $recipientId) {
if (!$recipientId) {
throw new RuntimeException('Recipient is required.');
}
@@ -40,7 +42,7 @@ class MessageCommandService
'message' => (string) $payload['message'],
'sent_datetime' => now(),
'read_status' => 0,
'message_number' => 'MSG-'.now()->format('YmdHis'),
'message_number' => 'MSG-' . now()->format('YmdHis'),
'priority' => $payload['priority'] ?? 'normal',
'attachment' => $path,
'status' => $payload['status'] ?? 'sent',
@@ -48,7 +50,7 @@ class MessageCommandService
'school_year' => $payload['school_year'] ?? $this->configService->getSchoolYear() ?? '',
]);
if (! $message) {
if (!$message) {
throw new RuntimeException('Failed to send message.');
}
@@ -74,7 +76,7 @@ class MessageCommandService
}
}
if (! empty($updates)) {
if (!empty($updates)) {
$message->fill($updates);
$message->save();
}
@@ -87,7 +89,6 @@ class MessageCommandService
{
return DB::transaction(function () use ($message) {
$message->status = 'trashed';
return (bool) $message->save();
});
}
@@ -116,7 +117,7 @@ class MessageCommandService
];
$key = strtolower(trim($roleName));
if (! isset($map[$key])) {
if (!isset($map[$key])) {
throw new RuntimeException('Invalid recipient role.');
}