Skip to content

Commit 25e38f3

Browse files
committed
mix format
1 parent 681817c commit 25e38f3

7 files changed

+105
-46
lines changed

lib/algora_web/live/challenges/prettier_live.ex

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -578,18 +578,26 @@ defmodule AlgoraWeb.Challenges.PrettierLive do
578578
</path>
579579
</svg>
580580
</a>
581-
<a rel="noopener" href="https://biomejs.dev"><svg
582-
xmlns="http://www.w3.org/2000/svg"
583-
width="24"
584-
height="24"
585-
viewBox="0 0 24 24"
586-
fill="none"
587-
stroke="currentColor"
588-
stroke-width="2"
589-
stroke-linecap="round"
590-
stroke-linejoin="round"
591-
class="h-7 w-7 text-yellow-600 transition-colors duration-150 hover:text-yellow-500 hover:opacity-100"
592-
><path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"></path><path d="M3.6 9h16.8"></path><path d="M3.6 15h16.8"></path><path d="M11.5 3a17 17 0 0 0 0 18"></path><path d="M12.5 3a17 17 0 0 1 0 18"></path></svg></a>
581+
<a rel="noopener" href="https://biomejs.dev">
582+
<svg
583+
xmlns="http://www.w3.org/2000/svg"
584+
width="24"
585+
height="24"
586+
viewBox="0 0 24 24"
587+
fill="none"
588+
stroke="currentColor"
589+
stroke-width="2"
590+
stroke-linecap="round"
591+
stroke-linejoin="round"
592+
class="h-7 w-7 text-yellow-600 transition-colors duration-150 hover:text-yellow-500 hover:opacity-100"
593+
>
594+
<path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"></path>
595+
<path d="M3.6 9h16.8"></path>
596+
<path d="M3.6 15h16.8"></path>
597+
<path d="M11.5 3a17 17 0 0 0 0 18"></path>
598+
<path d="M12.5 3a17 17 0 0 1 0 18"></path>
599+
</svg>
600+
</a>
593601
</div>
594602
</div>
595603
</div>

priv/repo/migrations/20250818111305_add_poaching_targets_to_users.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ defmodule Algora.Repo.Migrations.AddPoachingTargetsToUsers do
66
add :poaching_targets, :text
77
end
88
end
9-
end
9+
end

priv/repo/migrations/20250825154444_add_pipeline_fields_to_users.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ defmodule Algora.Repo.Migrations.AddPipelineFieldsToUsers do
77
add :candidate_notes, :text
88
end
99
end
10-
end
10+
end

priv/repo/migrations/20250916123955_add_pipeline_indexes.exs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,24 @@ defmodule Algora.Repo.Migrations.AddPipelineIndexes do
44
def change do
55
# Critical indexes for pipeline performance
66
create index(:users, [:last_job_match_email_at], where: "last_job_match_email_at IS NOT NULL")
7-
create index(:users, [:last_dm_date], where: "last_dm_date IS NOT NULL")
7+
create index(:users, [:last_dm_date], where: "last_dm_date IS NOT NULL")
88
create index(:users, [:country], where: "country IS NOT NULL")
99
create index(:users, [:open_to_new_role], where: "open_to_new_role = true")
1010
create index(:users, [:type], where: "type = 'individual'")
11-
11+
1212
# Composite index for the main query ordering
13-
create index(:users, [
14-
"GREATEST(last_job_match_email_at, last_dm_date)",
15-
:id
16-
], where: "last_job_match_email_at IS NOT NULL AND open_to_new_role = true AND type = 'individual'")
17-
13+
create index(
14+
:users,
15+
[
16+
"GREATEST(last_job_match_email_at, last_dm_date)",
17+
:id
18+
],
19+
where:
20+
"last_job_match_email_at IS NOT NULL AND open_to_new_role = true AND type = 'individual'"
21+
)
22+
1823
# Job matches indexes for EXISTS queries
1924
create index(:job_matches, [:user_id, :candidate_discarded_at, :candidate_approved_at])
2025
create index(:job_matches, [:user_id, :candidate_discarded_at, :candidate_bookmarked_at])
2126
end
22-
end
27+
end

priv/repo/migrations/20250917112915_add_talent_query_optimization_indexes.exs

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ defmodule Algora.Repo.Migrations.AddTalentQueryOptimizationIndexes do
1414
create index(:users, [:open_to_relocate_world], where: "open_to_relocate_world = true")
1515

1616
# 3. Composite index for common state filtering patterns
17-
create index(:users, [:country, :location_iso_lvl4, :open_to_relocate_sf, :open_to_relocate_ny],
18-
name: "idx_users_location_preferences")
17+
create index(
18+
:users,
19+
[:country, :location_iso_lvl4, :open_to_relocate_sf, :open_to_relocate_ny],
20+
name: "idx_users_location_preferences"
21+
)
1922

2023
# 4. LinkedIn and employment info indexes
2124
create index(:users, [:linkedin_url], where: "linkedin_url IS NOT NULL")
@@ -27,29 +30,51 @@ defmodule Algora.Repo.Migrations.AddTalentQueryOptimizationIndexes do
2730

2831
# 6. Complex email existence check optimization
2932
create index(:users, [:email, :internal_email, "(provider_meta ->> 'email')"],
30-
name: "idx_users_email_existence",
31-
where: "email IS NOT NULL OR internal_email IS NOT NULL OR provider_meta ->> 'email' IS NOT NULL")
33+
name: "idx_users_email_existence",
34+
where:
35+
"email IS NOT NULL OR internal_email IS NOT NULL OR provider_meta ->> 'email' IS NOT NULL"
36+
)
3237

3338
# 7. System tags GIN index for array operations
34-
create index(:users, [:system_tags], using: :gin, where: "system_tags IS NOT NULL AND array_length(system_tags, 1) > 0")
39+
create index(:users, [:system_tags],
40+
using: :gin,
41+
where: "system_tags IS NOT NULL AND array_length(system_tags, 1) > 0"
42+
)
3543

3644
# 8. Language contributions optimization
3745
create index(:language_contributions, [:user_id, :language, :prs],
38-
name: "idx_language_contributions_user_lang_prs")
46+
name: "idx_language_contributions_user_lang_prs"
47+
)
3948

4049
# 9. User contributions with repository optimization
4150
create index(:user_contributions, [:user_id, :repository_id, :contribution_count],
42-
name: "idx_user_contributions_complete")
51+
name: "idx_user_contributions_complete"
52+
)
4353

4454
# 10. Repository tech stack and topics for scoring
45-
create index(:repositories, [:tech_stack], using: :gin, where: "array_length(tech_stack, 1) > 0")
55+
create index(:repositories, [:tech_stack],
56+
using: :gin,
57+
where: "array_length(tech_stack, 1) > 0"
58+
)
59+
4660
create index(:repositories, [:topics], using: :gin, where: "array_length(topics, 1) > 0")
61+
4762
create index(:repositories, [:stargazers_count, :tech_stack],
48-
name: "idx_repositories_stars_tech_stack")
63+
name: "idx_repositories_stars_tech_stack"
64+
)
4965

5066
# 11. Job matches comprehensive index for EXISTS queries
51-
create index(:job_matches, [:user_id, :status, :candidate_discarded_at, :candidate_approved_at, :candidate_bookmarked_at],
52-
name: "idx_job_matches_user_status_complete")
67+
create index(
68+
:job_matches,
69+
[
70+
:user_id,
71+
:status,
72+
:candidate_discarded_at,
73+
:candidate_approved_at,
74+
:candidate_bookmarked_at
75+
],
76+
name: "idx_job_matches_user_status_complete"
77+
)
5378

5479
# 12. Stargazers optimization (skip user_id, repository_id - already exist individually and as composite)
5580

@@ -68,11 +93,13 @@ defmodule Algora.Repo.Migrations.AddTalentQueryOptimizationIndexes do
6893

6994
# 17. Complex composite index for main talent query patterns
7095
create index(:talents, [:status, :user_id, :inserted_at],
71-
name: "idx_talents_status_user_inserted")
96+
name: "idx_talents_status_user_inserted"
97+
)
7298

7399
# 18. Composite index for user filtering with timestamps
74100
create index(:users, [:type, :country, :open_to_new_role, :last_job_match_email_at],
75-
name: "idx_users_pipeline_filtering",
76-
where: "type = 'individual'")
101+
name: "idx_users_pipeline_filtering",
102+
where: "type = 'individual'"
103+
)
77104
end
78-
end
105+
end

priv/repo/migrations/20250918202007_add_events_performance_indexes.exs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,16 @@ defmodule Algora.Repo.Migrations.AddEventsPerformanceIndexes do
66
create index(:events, [:inserted_at, :type], name: :events_inserted_at_type_composite_index)
77

88
# Composite index for candidates page visit queries with payload JSON access
9-
create index(:events, [:type, :inserted_at], where: "type = 'candidates_page_visit'", name: :events_candidates_visits_index)
9+
create index(:events, [:type, :inserted_at],
10+
where: "type = 'candidates_page_visit'",
11+
name: :events_candidates_visits_index
12+
)
1013

1114
# Composite index for profile page visit queries with payload JSON access
12-
create index(:events, [:type, :inserted_at], where: "type = 'profile_page_visit'", name: :events_profile_visits_index)
15+
create index(:events, [:type, :inserted_at],
16+
where: "type = 'profile_page_visit'",
17+
name: :events_profile_visits_index
18+
)
1319

1420
# GIN index for JSON payload queries (for org_handle and target_user_id lookups)
1521
create index(:events, ["payload"], using: :gin, name: :events_payload_gin_index)

priv/repo/migrations/20251001175923_add_performance_indexes.exs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,39 @@ defmodule Algora.Repo.Migrations.AddPerformanceIndexes do
33

44
def change do
55
# Index for provider_meta->>'followers' queries (used in talent matching)
6-
create index(:users, ["((provider_meta->>'followers')::int)"], name: :users_provider_meta_followers_idx)
6+
create index(:users, ["((provider_meta->>'followers')::int)"],
7+
name: :users_provider_meta_followers_idx
8+
)
79

810
# Index for country filtering (frequently used in candidates/talents queries)
911
create index(:users, [:country], where: "country IS NOT NULL", name: :users_country_idx)
1012

1113
# Index for location_iso_lvl4 filtering
12-
create index(:users, [:location_iso_lvl4], where: "location_iso_lvl4 IS NOT NULL", name: :users_location_iso_lvl4_idx)
14+
create index(:users, [:location_iso_lvl4],
15+
where: "location_iso_lvl4 IS NOT NULL",
16+
name: :users_location_iso_lvl4_idx
17+
)
1318

1419
# Index for min_compensation (used in sorting)
15-
create index(:users, [:min_compensation], where: "min_compensation IS NOT NULL", name: :users_min_compensation_idx)
20+
create index(:users, [:min_compensation],
21+
where: "min_compensation IS NOT NULL",
22+
name: :users_min_compensation_idx
23+
)
1624

1725
# Composite index for common talent queries
1826
create index(:users, [:country, :min_compensation],
19-
where: "country IS NOT NULL AND min_compensation IS NOT NULL",
20-
name: :users_country_min_compensation_idx)
27+
where: "country IS NOT NULL AND min_compensation IS NOT NULL",
28+
name: :users_country_min_compensation_idx
29+
)
2130

2231
# Index for language_contributions user_id lookups
23-
create index(:language_contributions, [:user_id, :percentage], name: :language_contributions_user_id_percentage_idx)
32+
create index(:language_contributions, [:user_id, :percentage],
33+
name: :language_contributions_user_id_percentage_idx
34+
)
2435

2536
# Index for user_contributions filtering on user_id
26-
create index(:user_contributions, [:user_id, :contribution_count], name: :user_contributions_user_id_contribution_count_idx)
37+
create index(:user_contributions, [:user_id, :contribution_count],
38+
name: :user_contributions_user_id_contribution_count_idx
39+
)
2740
end
2841
end

0 commit comments

Comments
 (0)