Skip to content

Commit

Permalink
chore: clean up old search code, generate migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Oct 12, 2023
1 parent 4a37edd commit bea48bf
Show file tree
Hide file tree
Showing 23 changed files with 1,884 additions and 130 deletions.
14 changes: 11 additions & 3 deletions lib/ash_hq/discord/listener.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@ defmodule AshHq.Discord.Listener do
@user_id 1_066_406_803_769_933_834
@server_id 711_271_361_523_351_632

def start_link() do
def start_link do
Consumer.start_link(__MODULE__)
end

def search_results!(interaction) do
item_list = AshHq.Docs.Indexer.search!(search)
search =
interaction.data.options
|> Enum.find_value(fn option ->
if option.name == "search" do
option.value
end
end)

item_list = AshHq.Docs.Indexer.search(search)

item_list = Enum.take(item_list, 10)

Expand Down Expand Up @@ -99,7 +107,7 @@ defmodule AshHq.Discord.Listener do
end
end

defp build_search_action() do
defp build_search_action do
command = %{
name: "ash_hq_search",
description: "Search AshHq Documentation",
Expand Down
1 change: 0 additions & 1 deletion lib/ash_hq/docs/extensions/search/index.ex

This file was deleted.

Binary file not shown.
61 changes: 0 additions & 61 deletions lib/ash_hq/docs/flows/search/search.ex

This file was deleted.

15 changes: 0 additions & 15 deletions lib/ash_hq/docs/flows/search/steps/build_results.ex

This file was deleted.

31 changes: 0 additions & 31 deletions lib/ash_hq/docs/flows/search/steps/search_resource.ex

This file was deleted.

13 changes: 0 additions & 13 deletions lib/ash_hq/docs/flows/search/steps/should_search.ex

This file was deleted.

1 change: 1 addition & 0 deletions lib/ash_hq/docs/indexer.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule AshHq.Docs.Indexer do
@moduledoc "Indexes content and serves up a search interface"
use GenServer

require Ash.Query
Expand Down
4 changes: 0 additions & 4 deletions lib/ash_hq/release.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ defmodule AshHq.Release do
Application.fetch_env!(@app, :ecto_repos)
end

defp apis do
Application.fetch_env!(@app, :ash_apis)
end

defp load_app do
Application.load(@app)
end
Expand Down
1 change: 1 addition & 0 deletions lib/ash_hq/sqlite_repo.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule AshHq.SqliteRepo do
@moduledoc "Ecto repo for interacting with Sqlite"
use AshSqlite.Repo,
otp_app: :ash_hq
end
2 changes: 0 additions & 2 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
"haystack": {:hex, :haystack, "0.1.0", "6cb9c72caf40ed4a5f9a094e6b09993c68c3fda0e01280c60c331a19860c504c", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:stemmer, "~> 1.1", [hex: :stemmer, repo: "hexpm", optional: false]}], "hexpm", "27a582513ef933c1b11345b96f8d41ee137d03b25312bd85068ffe8fec503635"},
"hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"},
"html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"},
"httpoison": {:hex, :httpoison, "1.8.2", "9eb9c63ae289296a544842ef816a85d881d4a31f518a0fec089aaa744beae290", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "2bb350d26972e30c96e2ca74a1aaf8293d61d0742ff17f01e0279fef11599921"},
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
"jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},
"joken": {:hex, :joken, "2.6.0", "b9dd9b6d52e3e6fcb6c65e151ad38bf4bc286382b5b6f97079c47ade6b1bcc6a", [:mix], [{:jose, "~> 1.11.5", [hex: :jose, repo: "hexpm", optional: false]}], "hexpm", "5a95b05a71cd0b54abd35378aeb1d487a23a52c324fa7efdffc512b655b5aaa7"},
Expand All @@ -84,7 +83,6 @@
"makeup_html": {:hex, :makeup_html, "0.1.0", "b0228fda985e311d8f0d25bed58f8280826633a38d7448cabdd723e116165bcf", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "0ca44e7dcb8d933e010740324470dd8ec947243b51304bd34b8165ef3281edc2"},
"makeup_js": {:hex, :makeup_js, "0.1.0", "ffa8ce9db95d14dcd09045334539d5992d540d63598c592d4805b7674bdd6675", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "3f0c1a5eb52c9737b1679c926574e83bb260ccdedf08b58ee96cca7c685dea75"},
"makeup_sql": {:hex, :makeup_sql, "0.1.0", "197a8a0a38e83885f73767530739bb8f990aecf7fd1597d3141608c14f5f233e", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "556e23ff88ad2fb8c44e393467cfba0c4f980cbe90316deaf48a1362f58cd118"},
"meilisearch": {:hex, :meilisearch, "0.20.0", "3606a7dc9c51b8e7d890761a9614dd56812da8bfcbf4e86934ae42233b257b18", [:mix], [{:httpoison, "~> 1.8", [hex: :httpoison, repo: "hexpm", optional: false]}, {:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "50faca2a72128bc93e6771bc66dadc347357c0a2d619e743e620ce131c7798fd"},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"},
"mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"},
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
Expand Down
21 changes: 21 additions & 0 deletions priv/repo/migrations/20231012221540_migrate_resources59.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
defmodule AshHq.Repo.Migrations.MigrateResources59 do
@moduledoc """
Updates resources based on their most recent snapshots.
This file was autogenerated with `mix ash_postgres.generate_migrations`
"""

use Ecto.Migration

def up do
alter table(:users) do
remove(:ashley_access)
end
end

def down do
alter table(:users) do
add(:ashley_access, :boolean, default: false)
end
end
end
128 changes: 128 additions & 0 deletions priv/resource_snapshots/repo/users/20231012221540.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"attributes": [
{
"default": "nil",
"size": null,
"type": "utc_datetime_usec",
"source": "confirmed_at",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "fragment(\"uuid_generate_v4()\")",
"size": null,
"type": "uuid",
"source": "id",
"references": null,
"primary_key?": true,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "citext",
"source": "email",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "hashed_password",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "encrypted_name",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "encrypted_address",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "shirt_size",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "map",
"source": "github_info",
"references": null,
"primary_key?": false,
"allow_nil?": true,
"generated?": false
},
{
"default": "fragment(\"now()\")",
"size": null,
"type": "utc_datetime_usec",
"source": "created_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
},
{
"default": "fragment(\"now()\")",
"size": null,
"type": "utc_datetime_usec",
"source": "updated_at",
"references": null,
"primary_key?": false,
"allow_nil?": false,
"generated?": false
}
],
"table": "users",
"hash": "73825998BF52DC0D54C385CAD698898654F4564DB62682D46AADA399AFACFE8E",
"repo": "Elixir.AshHq.Repo",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"base_filter": null,
"schema": null,
"identities": [
{
"name": "unique_email",
"keys": [
"email"
],
"index_name": "users_unique_email_index",
"base_filter": null
}
],
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true,
"check_constraints": []
}
Loading

0 comments on commit bea48bf

Please sign in to comment.