feat: LinkedIn profile search engine (Django + React + Elasticsearch + ELK)
Full-stack implementation of the Cyberyan full-stack trial task. Backend (Django 5 / DRF) - Normalised PostgreSQL model (Profile, Company, School, Skill, Experience, Education) as the source of truth, with GIN + trigram indexes. - Self-healing CSV reader: the supplied export carries an injected watermark column, missing columns, rows split by broken quoting and a duplicated header. A signature-scored Needleman-Wunsch alignment reconstructs 284 clean records out of 336 physical rows; only 10 rows parse correctly without it. - Pluggable search layer (Strategy): Elasticsearch by default, PostgreSQL full-text search as a fallback selected by a single environment variable. - Keyword search with per-field boosts, fuzziness and phrase boosting, six faceted filters (OR within a filter, AND across filters), an experience range, four sort orders, highlighting and facet aggregations. - JWT auth with rotation + blacklist, three roles, PII masking, scoped rate limits, a single error envelope, OpenAPI schema and health probes. Frontend (React 18 / TypeScript / Vite) - Debounced search with type-ahead, faceted filter panel, result cards, profile drawer, URL-synced search state, automatic token refresh. - Highlight snippets rendered without dangerouslySetInnerHTML. Infrastructure - Hardened multi-stage images (non-root, read-only rootfs, healthchecks). - docker-compose for the full stack plus dev and production overlays. - ELK: structured JSON logs shipped asynchronously to Logstash, routed per event type, with a composable index template and a Kibana setup script. Quality - 61 backend tests (85% coverage), ruff/black/bandit/mypy, ESLint + tsc, GitHub Actions running lint, tests and both image builds. - Persian documentation: README plus architecture, search, API, data, security and operations guides. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GnFo6fNaHCTAkJbfcdkqtG
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from apps.profiles.models import (
|
||||
Company,
|
||||
Education,
|
||||
Experience,
|
||||
Profile,
|
||||
ProfileSkill,
|
||||
School,
|
||||
Skill,
|
||||
)
|
||||
|
||||
|
||||
class ExperienceInline(admin.TabularInline):
|
||||
model = Experience
|
||||
extra = 0
|
||||
fields = ("title", "company_name", "start_date", "end_date", "is_primary")
|
||||
readonly_fields = fields
|
||||
can_delete = False
|
||||
show_change_link = True
|
||||
|
||||
|
||||
class EducationInline(admin.TabularInline):
|
||||
model = Education
|
||||
extra = 0
|
||||
fields = ("school_name", "degrees", "majors", "end_date")
|
||||
readonly_fields = fields
|
||||
can_delete = False
|
||||
|
||||
|
||||
class ProfileSkillInline(admin.TabularInline):
|
||||
model = ProfileSkill
|
||||
extra = 0
|
||||
autocomplete_fields = ("skill",)
|
||||
|
||||
|
||||
@admin.register(Profile)
|
||||
class ProfileAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
"full_name", "job_title", "current_company", "location_country", "years_experience",
|
||||
) # fmt: skip
|
||||
list_filter = ("location_country", "job_title_role", "industry")
|
||||
search_fields = ("full_name", "job_title", "skills_text", "companies_text")
|
||||
list_select_related = ("current_company",)
|
||||
inlines = (ProfileSkillInline, ExperienceInline, EducationInline)
|
||||
readonly_fields = (
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"skills_text",
|
||||
"companies_text",
|
||||
"education_text",
|
||||
)
|
||||
|
||||
|
||||
@admin.register(Skill)
|
||||
class SkillAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "slug", "profile_count")
|
||||
search_fields = ("name", "slug")
|
||||
ordering = ("-profile_count",)
|
||||
|
||||
|
||||
@admin.register(Company)
|
||||
class CompanyAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "industry", "size", "country")
|
||||
search_fields = ("name",)
|
||||
list_filter = ("size", "industry")
|
||||
|
||||
|
||||
@admin.register(School)
|
||||
class SchoolAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "type", "country")
|
||||
search_fields = ("name",)
|
||||
Reference in New Issue
Block a user