Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
804 changes: 231 additions & 573 deletions apps/discord_bot/src/five08/discord_bot/cogs/crm.py

Large diffs are not rendered by default.

13 changes: 1 addition & 12 deletions apps/worker/src/five08/worker/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
class WorkerSettings(SharedSettings):
"""Worker-specific settings layered on top of shared stack settings."""

_crm_linkedin_field: str = PrivateAttr(default="cLinkedIn")
_crm_intake_completed_field: str = PrivateAttr(default="")

worker_name: str = "worker"
Expand All @@ -30,7 +29,7 @@ class WorkerSettings(SharedSettings):
docuseal_member_agreement_template_id: int | None = None

max_file_size_mb: int = 10
allowed_file_types: str = "pdf,docx,txt"
allowed_file_types: str = "pdf,docx"
max_attachments_per_contact: int = 3
crm_sync_enabled: bool = True
crm_sync_interval_seconds: int = 900
Expand Down Expand Up @@ -131,16 +130,6 @@ def allowed_file_extensions(self) -> set[str]:
"""Allowed resume file extensions."""
return {ext.strip().lower() for ext in self.allowed_file_types.split(",")}

@property
def crm_linkedin_field(self) -> str:
"""Resume/profile sync always writes LinkedIn URLs to the canonical CRM field."""
return self._crm_linkedin_field

@crm_linkedin_field.setter
def crm_linkedin_field(self, value: str) -> None:
"""Allow controlled runtime overrides without reintroducing env loading."""
self._crm_linkedin_field = value

@property
def crm_intake_completed_field(self) -> str:
"""Intake completion field remains intentionally unset until explicitly adopted."""
Expand Down
5 changes: 3 additions & 2 deletions apps/worker/src/five08/worker/crm/intake_form_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

logger = logging.getLogger(__name__)
IPAddress = ipaddress.IPv4Address | ipaddress.IPv6Address
LINKEDIN_FIELD = "cLinkedIn"

DESCRIPTION_SECTIONS = {
"primary_skills_interests": "Primary skills and interests",
Expand All @@ -42,7 +43,7 @@
FIELD_MAP = {
"phone": "phoneNumber",
"discord_username": "cDiscordUsername",
"linkedin_url": settings.crm_linkedin_field,
"linkedin_url": LINKEDIN_FIELD,
"github_username": "cGitHubUsername",
"address_country": "addressCountry",
"address_city": "addressCity",
Expand Down Expand Up @@ -448,7 +449,7 @@ def _build_resume_updates(self, payload: Mapping[str, Any]) -> dict[str, Any]:
if profile_github:
updates["cGitHubUsername"] = profile_github
if profile_linkedin:
updates[settings.crm_linkedin_field] = profile_linkedin
updates[LINKEDIN_FIELD] = profile_linkedin
if profile_timezone:
updates.setdefault("cTimezone", profile_timezone)
if profile_city:
Expand Down
6 changes: 3 additions & 3 deletions apps/worker/src/five08/worker/crm/people_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
logger = logging.getLogger(__name__)

_DISCORD_ID_RE = re.compile(r"\(ID:\s*(\d+)\)")
LINKEDIN_FIELD = "cLinkedIn"


class EspoPeopleSyncClient:
Expand All @@ -31,7 +32,7 @@ def list_contact_page(
"cDiscordUsername,cDiscordUserId,cDiscordRoles,cDiscordUserID,"
"cGithubUsername,githubUsername,type,contactType,"
"addressCountry,addressCity,cTimezone,cSeniority,cMemberAgreementSignedAt,"
f"{settings.crm_linkedin_field},skills,cSkillAttrs,resumeIds,resumeNames"
f"{LINKEDIN_FIELD},skills,cSkillAttrs,resumeIds,resumeNames"
)
raw = self.api.request(
"GET",
Expand Down Expand Up @@ -323,8 +324,7 @@ def _github_username(self, raw_contact: dict[str, Any]) -> str | None:
return None

def _coerce_linkedin(self, raw_contact: dict[str, Any]) -> str | None:
configured_field = settings.crm_linkedin_field
for key in (configured_field, "cLinkedIn", "linkedin"):
for key in (LINKEDIN_FIELD, "linkedin"):
value = _text_or_none(raw_contact.get(key))
if value:
return value
Expand Down
Loading