Applicants: 1→N contact methods with types (phone/email/Instagram/Telegram/Bale/site)
- ContactMethod entity (Type + Value + SortOrder) 1→N on TalentListing (+ migration). - Parser extracts ALL contacts: multiple phones + landlines, email, and socials (Instagram/Telegram/Bale/WhatsApp/website) via URLs and Persian keyword cues; primary Phone kept for cards. - ContactInfo helper: per-type label/icon/clickable href (tel:/mailto:/t.me/…). - Ingestion attaches contacts to each (fanned-out) talent listing; manual Review re-parses to attach them + the admin-typed phone. - Talent details renders the full contact list as buttons; falls back to the single phone, then the Divar source link. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -204,6 +204,7 @@ public class IngestionService
|
||||
Phone = !string.IsNullOrWhiteSpace(d?.Phone) ? d!.Phone!.Trim() : parsed.Phone,
|
||||
Description = raw.RawText,
|
||||
Status = ShiftStatus.Open, Source = ShiftSource.Aggregated, SourceUrl = raw.SourceUrl,
|
||||
Contacts = BuildContacts(d, parsed), // fresh instances per listing
|
||||
});
|
||||
raw.Status = RawListingStatus.Normalized;
|
||||
return;
|
||||
@@ -259,6 +260,18 @@ public class IngestionService
|
||||
raw.Status = RawListingStatus.Normalized;
|
||||
}
|
||||
|
||||
/// <summary>Fresh ContactMethod rows for one talent listing (parser contacts + AI phone).</summary>
|
||||
private static List<ContactMethod> BuildContacts(AiStructured? d, ParsedListing parsed)
|
||||
{
|
||||
var contacts = parsed.Contacts
|
||||
.Select((c, i) => new ContactMethod { Type = c.Type, Value = c.Value, SortOrder = i })
|
||||
.ToList();
|
||||
if (!string.IsNullOrWhiteSpace(d?.Phone)
|
||||
&& !contacts.Any(c => c.Type is ContactType.Mobile or ContactType.Phone))
|
||||
contacts.Insert(0, new ContactMethod { Type = ContactType.Mobile, Value = d!.Phone!.Trim(), SortOrder = -1 });
|
||||
return contacts;
|
||||
}
|
||||
|
||||
private static ShiftType MapShiftType(string? ai, ShiftType? parsed) => (ai?.ToLowerInvariant()) switch
|
||||
{
|
||||
"day" => ShiftType.Day, "evening" => ShiftType.Evening, "night" => ShiftType.Night, "oncall" => ShiftType.OnCall,
|
||||
|
||||
Reference in New Issue
Block a user