Overlay Docker para Coolify: notificación de leads API sobre imagen pública Relaticle

FROM ghcr.io/relaticle/relaticle:latest + COPY de los 5 ficheros
custom (migration + Notification + Action + 2 Observers) que
implementan la notificación in-app/email a un team cuando se crea
una Company o People vía API con creation_source=API.

Se elige overlay en vez de fork completo para no perder las
mejoras de upstream en cada build.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-08 22:34:42 -04:00
commit 5e146b8b60
6 changed files with 243 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace App\Observers;
use App\Actions\Team\NotifyTeamOfNewApiLead;
use App\Enums\CreationSource;
use App\Enums\CustomFields\CompanyField;
use App\Jobs\FetchFaviconForCompany;
use App\Models\Company;
final readonly class CompanyObserver
{
public function saved(Company $company): void
{
$company->invalidateAiSummary();
$this->dispatchFaviconFetchIfNeeded($company);
}
public function created(Company $company): void
{
if ($company->creation_source === CreationSource::API) {
new NotifyTeamOfNewApiLead()->execute($company);
}
}
private function dispatchFaviconFetchIfNeeded(Company $company): void
{
$domainField = $company->customFields()
->whereBelongsTo($company->team)
->where('code', CompanyField::DOMAINS->value)
->first();
if ($domainField === null) {
return;
}
$company->load('customFieldValues.customField.options');
$domains = $company->getCustomFieldValue($domainField);
$firstDomain = is_array($domains) ? ($domains[0] ?? null) : $domains;
if (blank($firstDomain)) {
return;
}
dispatch(new FetchFaviconForCompany($company))->afterCommit();
}
}