Music streaming on ATProto!
14
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(appview): initial database schema

+364 -8
+1 -1
apps/backend/.formatter.exs
··· 1 1 [ 2 2 import_deps: [:ecto, :ecto_sql, :phoenix], 3 3 subdirectories: ["priv/*/migrations"], 4 - inputs: ["*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}", "priv/*/seeds.exs"] 4 + inputs: ["*.{ex,exs}", "{config,lib,test,priv}/**/*.{ex,exs}", "priv/*/seeds.exs"] 5 5 ]
+2
apps/backend/config/config.exs
··· 11 11 ecto_repos: [Comet.Repo], 12 12 generators: [timestamp_type: :utc_datetime, binary_id: true] 13 13 14 + config :comet, Comet.Repo, migration_primary_key: [name: :id, type: :binary_id] 15 + 14 16 # Configures the endpoint 15 17 config :comet, CometWeb.Endpoint, 16 18 url: [host: "localhost"],
+2 -2
apps/backend/config/dev.exs
··· 2 2 3 3 # Configure your database 4 4 config :comet, Comet.Repo, 5 - username: "postgres", 6 - password: "postgres", 5 + username: "comet", 6 + password: "comet", 7 7 hostname: "localhost", 8 8 database: "comet_dev", 9 9 stacktrace: true,
+5 -1
apps/backend/lib/atproto/atproto.ex
··· 1 1 # AUTOGENERATED: This file was generated using the mix task `lexgen`. 2 2 defmodule Atproto do 3 - @default_pds_hostname Application.compile_env!(:comet, :default_pds_hostname) 3 + @default_pds_hostname Application.compile_env( 4 + :atproto, 5 + :default_pds_hostname, 6 + "https://bsky.social" 7 + ) 4 8 5 9 @typedoc """ 6 10 A type representing the names of the options that can be passed to `query/3` and `procedure/3`.
+22
apps/backend/lib/comet/repo/comment.ex
··· 1 + defmodule Comet.Repo.Comment do 2 + @moduledoc """ 3 + Schema containing information about a Comet comment. 4 + """ 5 + use Comet.Schema 6 + 7 + schema "comments" do 8 + field :rkey, :string 9 + field :text, :string 10 + embeds_one :facets, Repo.Embed.Facet, on_replace: :update 11 + field :subject_id, :binary_id 12 + field :subject_type, Ecto.Enum, values: [:track, :playlist] 13 + field :langs, {:array, :string} 14 + field :created_at, :utc_datetime 15 + 16 + belongs_to :identity, Repo.Identity, foreign_key: :did, references: :did 17 + belongs_to :parent, __MODULE__, foreign_key: :reply_id 18 + has_many :replies, __MODULE__, foreign_key: :reply_id 19 + 20 + timestamps(inserted_at: :indexed_at, updated_at: false) 21 + end 22 + end
+14
apps/backend/lib/comet/repo/embed/facet.ex
··· 1 + defmodule Comet.Repo.Embed.Facet do 2 + use Comet.Schema 3 + 4 + @primary_key false 5 + embedded_schema do 6 + embeds_one :index, ByteSlice do 7 + field :byte_start, :integer 8 + field :byte_end, :integer 9 + end 10 + 11 + # Sadly Ecto doesn't support union types/embeds so this has to be generic, without doing weirdness in the database at least 12 + field :features, {:array, :map} 13 + end 14 + end
+9
apps/backend/lib/comet/repo/embed/link.ex
··· 1 + defmodule Comet.Repo.Embed.Link do 2 + use Comet.Schema 3 + 4 + @primary_key false 5 + embedded_schema do 6 + field :type, :string 7 + field :value, :string 8 + end 9 + end
+18
apps/backend/lib/comet/repo/identity.ex
··· 1 + defmodule Comet.Repo.Identity do 2 + @moduledoc """ 3 + Schema containing information about an ATProtocol identity. 4 + """ 5 + use Ecto.Schema 6 + 7 + @primary_key {:did, :string, autogenerate: false} 8 + @foreign_key_type :string 9 + 10 + schema "identity" do 11 + field :handle, :string 12 + field :active, :boolean 13 + # TODO: see if it'd be possible to set this to an enum, if ecto allows open enums 14 + field :status, :string 15 + 16 + timestamps(inserted_at: :indexed_at, updated_at: false) 17 + end 18 + end
+17
apps/backend/lib/comet/repo/like.ex
··· 1 + defmodule Comet.Repo.Like do 2 + @moduledoc """ 3 + Schema containing information about a Comet like. 4 + """ 5 + use Comet.Schema 6 + 7 + schema "likes" do 8 + field :rkey, :string 9 + field :subject_id, :binary_id 10 + field :subject_type, Ecto.Enum, values: [:track, :playlist] 11 + field :created_at, :utc_datetime 12 + 13 + belongs_to :identity, Repo.Identity, foreign_key: :did, references: :did 14 + 15 + timestamps(inserted_at: :indexed_at, updated_at: false) 16 + end 17 + end
+23
apps/backend/lib/comet/repo/playlist.ex
··· 1 + defmodule Comet.Repo.Playlist do 2 + @moduledoc """ 3 + Schema containing information about a Comet playlist. 4 + """ 5 + use Comet.Schema 6 + 7 + schema "playlists" do 8 + field :rkey, :string 9 + field :title, :string 10 + field :image, :string 11 + field :description, :string 12 + embeds_one :description_facets, Repo.Embed.Facet, on_replace: :update 13 + field :type, :string 14 + field :tags, {:array, :string} 15 + embeds_one :link, Repo.Embed.Link, on_replace: :update 16 + field :created_at, :utc_datetime 17 + 18 + belongs_to :identity, Repo.Identity, foreign_key: :did, references: :did 19 + has_many :tracks, Repo.Playlist 20 + 21 + timestamps(inserted_at: :indexed_at, updated_at: false) 22 + end 23 + end
+18
apps/backend/lib/comet/repo/playlist_track.ex
··· 1 + defmodule Comet.Repo.PlaylistTrack do 2 + @moduledoc """ 3 + Schema containing information about a track in a Comet playlist. 4 + """ 5 + use Comet.Schema 6 + 7 + schema "playlist_tracks" do 8 + field :rkey, :string 9 + field :position, :integer 10 + field :created_at, :utc_datetime 11 + 12 + belongs_to :identity, Repo.Identity, foreign_key: :did, references: :did 13 + belongs_to :track, Repo.Track 14 + belongs_to :playlist, Repo.Playlist 15 + 16 + timestamps(inserted_at: :indexed_at, updated_at: false) 17 + end 18 + end
+21
apps/backend/lib/comet/repo/profile.ex
··· 1 + defmodule Comet.Repo.Profile do 2 + @moduledoc """ 3 + Schema containing information about a Comet profile. 4 + """ 5 + use Comet.Schema 6 + 7 + schema "profiles" do 8 + field :rkey, :string, default: "self" 9 + field :display_name, :string 10 + field :description, :string 11 + embeds_one :description_facets, Repo.Embed.Facet, on_replace: :update 12 + field :avatar, :string 13 + field :banner, :string 14 + field :featured_items, {:array, :string} 15 + field :created_at, :utc_datetime 16 + 17 + belongs_to :identity, Repo.Identity, foreign_key: :did, references: :did 18 + 19 + timestamps(inserted_at: :indexed_at, updated_at: false) 20 + end 21 + end
+17
apps/backend/lib/comet/repo/repost.ex
··· 1 + defmodule Comet.Repo.Repost do 2 + @moduledoc """ 3 + Schema containing information about a Comet repost. 4 + """ 5 + use Comet.Schema 6 + 7 + schema "reposts" do 8 + field :rkey, :string 9 + field :subject_id, :binary_id 10 + field :subject_type, Ecto.Enum, values: [:track, :playlist] 11 + field :created_at, :utc_datetime 12 + 13 + belongs_to :identity, Repo.Identity, foreign_key: :did, references: :did 14 + 15 + timestamps(inserted_at: :indexed_at, updated_at: false) 16 + end 17 + end
+24
apps/backend/lib/comet/repo/track.ex
··· 1 + defmodule Comet.Repo.Track do 2 + @moduledoc """ 3 + Schema containing information about a Comet track. 4 + """ 5 + use Comet.Schema 6 + 7 + schema "tracks" do 8 + field :rkey, :string 9 + field :title, :string 10 + field :audio, :string 11 + field :image, :string 12 + field :description, :string 13 + embeds_one :description_facets, Repo.Embed.Facet, on_replace: :update 14 + field :explicit, :boolean 15 + field :tags, {:array, :string} 16 + embeds_one :link, Repo.Embed.Link, on_replace: :update 17 + field :created_at, :utc_datetime 18 + field :released_at, :utc_datetime 19 + 20 + belongs_to :identity, Repo.Identity, foreign_key: :did, references: :did 21 + 22 + timestamps(inserted_at: :indexed_at, updated_at: false) 23 + end 24 + end
+11
apps/backend/lib/comet/schema.ex
··· 1 + defmodule Comet.Schema do 2 + defmacro __using__(_) do 3 + quote do 4 + use Ecto.Schema 5 + alias Comet.Repo 6 + 7 + @primary_key {:id, :binary_id, autogenerate: true} 8 + @foreign_key_type :binary_id 9 + end 10 + end 11 + end
+2
apps/backend/mix.exs
··· 44 44 {:bandit, "~> 1.5"}, 45 45 {:lexgen, "~> 1.0.0", only: [:dev]}, 46 46 {:req, "~> 0.5.0"}, 47 + {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, 48 + {:drinkup, "~> 0.1"}, 47 49 {:typedstruct, "~> 0.5"} 48 50 ] 49 51 end
+14 -4
apps/backend/mix.lock
··· 1 1 %{ 2 - "bandit": {:hex, :bandit, "1.6.11", "2fbadd60c95310eefb4ba7f1e58810aa8956e18c664a3b2029d57edb7d28d410", [:mix], [{:hpax, "~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:thousand_island, "~> 1.0", [hex: :thousand_island, repo: "hexpm", optional: false]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "543f3f06b4721619a1220bed743aa77bf7ecc9c093ba9fab9229ff6b99eacc65"}, 2 + "bandit": {:hex, :bandit, "1.7.0", "d1564f30553c97d3e25f9623144bb8df11f3787a26733f00b21699a128105c0c", [:mix], [{:hpax, "~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.18", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:thousand_island, "~> 1.0", [hex: :thousand_island, repo: "hexpm", optional: false]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "3e2f7a98c7a11f48d9d8c037f7177cd39778e74d55c7af06fe6227c742a8168a"}, 3 + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, 4 + "car": {:hex, :car, "0.1.1", "a5bc4c5c1be96eab437634b3c0ccad1fe17b5e3d68c22a4031241ae1345aebd4", [:mix], [{:cbor, "~> 1.0.0", [hex: :cbor, repo: "hexpm", optional: false]}, {:typedstruct, "~> 0.5", [hex: :typedstruct, repo: "hexpm", optional: false]}, {:varint, "~> 1.4", [hex: :varint, repo: "hexpm", optional: false]}], "hexpm", "f895dda8123d04dd336db5a2bf0d0b47f4559cd5383f83fcca0700c1b45bfb6a"}, 3 5 "castore": {:hex, :castore, "1.0.14", "4582dd7d630b48cf5e1ca8d3d42494db51e406b7ba704e81fbd401866366896a", [:mix], [], "hexpm", "7bc1b65249d31701393edaaac18ec8398d8974d52c647b7904d01b964137b9f4"}, 6 + "cbor": {:hex, :cbor, "1.0.1", "39511158e8ea5a57c1fcb9639aaa7efde67129678fee49ebbda780f6f24959b0", [:mix], [], "hexpm", "5431acbe7a7908f17f6a9cd43311002836a34a8ab01876918d8cfb709cd8b6a2"}, 7 + "certifi": {:hex, :certifi, "2.15.0", "0e6e882fcdaaa0a5a9f2b3db55b1394dba07e8d6d9bcad08318fb604c6839712", [:rebar3], [], "hexpm", "b147ed22ce71d72eafdad94f055165c1c182f61a2ff49df28bcc71d1d5b94a60"}, 8 + "cowlib": {:hex, :cowlib, "2.15.0", "3c97a318a933962d1c12b96ab7c1d728267d2c523c25a5b57b0f93392b6e9e25", [:make, :rebar3], [], "hexpm", "4f00c879a64b4fe7c8fcb42a4281925e9ffdb928820b03c3ad325a617e857532"}, 9 + "credo": {:hex, :credo, "1.7.12", "9e3c20463de4b5f3f23721527fcaf16722ec815e70ff6c60b86412c695d426c1", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "8493d45c656c5427d9c729235b99d498bd133421f3e0a683e5c1b561471291e5"}, 4 10 "db_connection": {:hex, :db_connection, "2.7.0", "b99faa9291bb09892c7da373bb82cba59aefa9b36300f6145c5f201c7adf48ec", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "dcf08f31b2701f857dfc787fbad78223d61a32204f217f15e881dd93e4bdd3ff"}, 5 11 "decimal": {:hex, :decimal, "2.3.0", "3ad6255aa77b4a3c4f818171b12d237500e63525c2fd056699967a3e7ea20f62", [:mix], [], "hexpm", "a4d66355cb29cb47c3cf30e71329e58361cfcb37c34235ef3bf1d7bf3773aeac"}, 6 12 "dns_cluster": {:hex, :dns_cluster, "0.1.3", "0bc20a2c88ed6cc494f2964075c359f8c2d00e1bf25518a6a6c7fd277c9b0c66", [:mix], [], "hexpm", "46cb7c4a1b3e52c7ad4cbe33ca5079fbde4840dedeafca2baf77996c2da1bc33"}, 13 + "drinkup": {:hex, :drinkup, "0.1.0", "a21d563163a0a19db448820f0c4cf9278d52e94b7276b099c60cb8544b16b14e", [:mix], [{:car, "~> 0.1.0", [hex: :car, repo: "hexpm", optional: false]}, {:cbor, "~> 1.0.0", [hex: :cbor, repo: "hexpm", optional: false]}, {:certifi, "~> 2.15", [hex: :certifi, repo: "hexpm", optional: false]}, {:gun, "~> 2.2", [hex: :gun, repo: "hexpm", optional: false]}, {:typedstruct, "~> 0.5", [hex: :typedstruct, repo: "hexpm", optional: false]}], "hexpm", "e2a22b12386936f4a62c6307050c3484c41ecd07c50dc1b1af653195d539baa2"}, 7 14 "ecto": {:hex, :ecto, "3.12.5", "4a312960ce612e17337e7cefcf9be45b95a3be6b36b6f94dfb3d8c361d631866", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "6eb18e80bef8bb57e17f5a7f068a1719fbda384d40fc37acb8eb8aeca493b6ea"}, 8 15 "ecto_sql": {:hex, :ecto_sql, "3.12.1", "c0d0d60e85d9ff4631f12bafa454bc392ce8b9ec83531a412c12a0d415a3a4d0", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.12", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.7", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.19 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "aff5b958a899762c5f09028c847569f7dfb9cc9d63bdb8133bff8a5546de6bf5"}, 16 + "file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"}, 9 17 "finch": {:hex, :finch, "0.19.0", "c644641491ea854fc5c1bbaef36bfc764e3f08e7185e1f084e35e0672241b76d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.6.2 or ~> 1.7", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 1.1", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "fc5324ce209125d1e2fa0fcd2634601c52a787aff1cd33ee833664a5af4ea2b6"}, 18 + "gun": {:hex, :gun, "2.2.0", "b8f6b7d417e277d4c2b0dc3c07dfdf892447b087f1cc1caff9c0f556b884e33d", [:make, :rebar3], [{:cowlib, ">= 2.15.0 and < 3.0.0", [hex: :cowlib, repo: "hexpm", optional: false]}], "hexpm", "76022700c64287feb4df93a1795cff6741b83fb37415c40c34c38d2a4645261a"}, 10 19 "hpax": {:hex, :hpax, "1.0.3", "ed67ef51ad4df91e75cc6a1494f851850c0bd98ebc0be6e81b026e765ee535aa", [:mix], [], "hexpm", "8eab6e1cfa8d5918c2ce4ba43588e894af35dbd8e91e6e55c817bca5847df34a"}, 11 20 "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, 12 21 "lexgen": {:hex, :lexgen, "1.0.0", "1ca22ba00b86f9fa97718651b77b87a5965b8a9f71109ac2c11cb573f17499aa", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "ff64e0e192645208e7ce1b6468037a6d4ebfb98a506ab15d30fb46ca492ec275"}, ··· 18 27 "phoenix_ecto": {:hex, :phoenix_ecto, "4.6.4", "dcf3483ab45bab4c15e3a47c34451392f64e433846b08469f5d16c2a4cd70052", [:mix], [{:ecto, "~> 3.5", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.1", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.16 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}], "hexpm", "f5b8584c36ccc9b903948a696fc9b8b81102c79c7c0c751a9f00cdec55d5f2d7"}, 19 28 "phoenix_html": {:hex, :phoenix_html, "4.2.1", "35279e2a39140068fc03f8874408d58eef734e488fc142153f055c5454fd1c08", [:mix], [], "hexpm", "cff108100ae2715dd959ae8f2a8cef8e20b593f8dfd031c9cba92702cf23e053"}, 20 29 "phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.8.7", "405880012cb4b706f26dd1c6349125bfc903fb9e44d1ea668adaf4e04d4884b7", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.5", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:ecto_sqlite3_extras, "~> 1.1.7 or ~> 1.2.0", [hex: :ecto_sqlite3_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.19 or ~> 1.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "3a8625cab39ec261d48a13b7468dc619c0ede099601b084e343968309bd4d7d7"}, 21 - "phoenix_live_view": {:hex, :phoenix_live_view, "1.0.12", "a37134b9bb3602efbfa5a7a8cb51d50e796f7acff7075af9d9796f30de04c66a", [:mix], [{:floki, "~> 0.36", [hex: :floki, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0 or ~> 1.8.0-rc", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.15", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "058e06e59fd38f1feeca59bbf167bec5d44aacd9b745e4363e2ac342ca32e546"}, 30 + "phoenix_live_view": {:hex, :phoenix_live_view, "1.0.14", "621f075577e286ff1e67d6de085ddf6f364f934d229c1c5564be1ef4c77908b9", [:mix], [{:floki, "~> 0.36", [hex: :floki, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0 or ~> 1.8.0-rc", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.15", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b6dcb3f236044cd9d1c0d0996331bef72716b1991bbd8e0725a617c0d95a9483"}, 22 31 "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.3", "3168d78ba41835aecad272d5e8cd51aa87a7ac9eb836eabc42f6e57538e3731d", [:mix], [], "hexpm", "bba06bc1dcfd8cb086759f0edc94a8ba2bc8896d5331a1e2c2902bf8e36ee502"}, 23 32 "phoenix_template": {:hex, :phoenix_template, "1.0.4", "e2092c132f3b5e5b2d49c96695342eb36d0ed514c5b252a77048d5969330d639", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "2c0c81f0e5c6753faf5cca2f229c9709919aba34fab866d3bc05060c9c444206"}, 24 - "plug": {:hex, :plug, "1.17.0", "a0832e7af4ae0f4819e0c08dd2e7482364937aea6a8a997a679f2cbb7e026b2e", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f6692046652a69a00a5a21d0b7e11fcf401064839d59d6b8787f23af55b1e6bc"}, 33 + "plug": {:hex, :plug, "1.18.0", "d78df36c41f7e798f2edf1f33e1727eae438e9dd5d809a9997c463a108244042", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "819f9e176d51e44dc38132e132fe0accaf6767eab7f0303431e404da8476cfa2"}, 25 34 "plug_crypto": {:hex, :plug_crypto, "2.1.1", "19bda8184399cb24afa10be734f84a16ea0a2bc65054e23a62bb10f06bc89491", [:mix], [], "hexpm", "6470bce6ffe41c8bd497612ffde1a7e4af67f36a15eea5f921af71cf3e11247c"}, 26 35 "postgrex": {:hex, :postgrex, "0.20.0", "363ed03ab4757f6bc47942eff7720640795eb557e1935951c1626f0d303a3aed", [:mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "d36ef8b36f323d29505314f704e21a1a038e2dc387c6409ee0cd24144e187c0f"}, 27 36 "req": {:hex, :req, "0.5.10", "a3a063eab8b7510785a467f03d30a8d95f66f5c3d9495be3474b61459c54376c", [:mix], [{:brotli, "~> 0.3.1", [hex: :brotli, repo: "hexpm", optional: true]}, {:ezstd, "~> 1.0", [hex: :ezstd, repo: "hexpm", optional: true]}, {:finch, "~> 0.17", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 2.0.6 or ~> 2.1", [hex: :mime, repo: "hexpm", optional: false]}, {:nimble_csv, "~> 1.0", [hex: :nimble_csv, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "8a604815743f8a2d3b5de0659fa3137fa4b1cffd636ecb69b30b2b9b2c2559be"}, 28 37 "telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"}, 29 38 "telemetry_metrics": {:hex, :telemetry_metrics, "1.1.0", "5bd5f3b5637e0abea0426b947e3ce5dd304f8b3bc6617039e2b5a008adc02f8f", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "e7b79e8ddfde70adb6db8a6623d1778ec66401f366e9a8f5dd0955c56bc8ce67"}, 30 39 "telemetry_poller": {:hex, :telemetry_poller, "1.2.0", "ba82e333215aed9dd2096f93bd1d13ae89d249f82760fcada0850ba33bac154b", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7216e21a6c326eb9aa44328028c34e9fd348fb53667ca837be59d0aa2a0156e8"}, 31 - "thousand_island": {:hex, :thousand_island, "1.3.13", "d598c609172275f7b1648c9f6eddf900e42312b09bfc2f2020358f926ee00d39", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "5a34bdf24ae2f965ddf7ba1a416f3111cfe7df50de8d66f6310e01fc2e80b02a"}, 40 + "thousand_island": {:hex, :thousand_island, "1.3.14", "ad45ebed2577b5437582bcc79c5eccd1e2a8c326abf6a3464ab6c06e2055a34a", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d0d24a929d31cdd1d7903a4fe7f2409afeedff092d277be604966cd6aa4307ef"}, 32 41 "typedstruct": {:hex, :typedstruct, "0.5.3", "d68ae424251a41b81a8d0c485328ab48edbd3858f3565bbdac21b43c056fc9b4", [:make, :mix], [], "hexpm", "b53b8186701417c0b2782bf02a2db5524f879b8488f91d1d83b97d84c2943432"}, 42 + "varint": {:hex, :varint, "1.5.1", "17160c70d0428c3f8a7585e182468cac10bbf165c2360cf2328aaa39d3fb1795", [:mix], [], "hexpm", "24f3deb61e91cb988056de79d06f01161dd01be5e0acae61d8d936a552f1be73"}, 33 43 "websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"}, 34 44 "websock_adapter": {:hex, :websock_adapter, "0.5.8", "3b97dc94e407e2d1fc666b2fb9acf6be81a1798a2602294aac000260a7c4a47d", [:mix], [{:bandit, ">= 0.6.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "315b9a1865552212b5f35140ad194e67ce31af45bcee443d4ecb96b5fd3f3782"}, 35 45 }
+129
apps/backend/priv/repo/migrations/20250602100037_init.exs
··· 1 + defmodule Comet.Repo.Migrations.Init do 2 + use Ecto.Migration 3 + 4 + defmacrop did_rkey do 5 + quote do 6 + add :did, references(:identity, column: :did, type: :string), null: false 7 + add :rkey, :string, null: false 8 + end 9 + end 10 + 11 + def change do 12 + create table(:identity, primary_key: false) do 13 + add :did, :string, primary_key: true, null: false 14 + add :handle, :string 15 + add :active, :boolean, null: false 16 + add :status, :string 17 + # TODO: cache of did record? 18 + timestamps(inserted_at: :indexed_at, updated_at: false) 19 + end 20 + 21 + create table(:profiles) do 22 + did_rkey() 23 + add :display_name, :string 24 + add :description, :string 25 + # TODO: as a table? 26 + add :description_facets, :map 27 + add :avatar, :string 28 + add :banner, :string 29 + # TODO: as a table? 30 + add :featured_items, {:array, :string} 31 + add :created_at, :utc_datetime 32 + timestamps(inserted_at: :indexed_at, updated_at: false) 33 + end 34 + 35 + create unique_index(:profiles, [:did, :rkey]) 36 + 37 + create table(:tracks) do 38 + did_rkey() 39 + add :title, :string, null: false 40 + add :audio, :string, null: false 41 + add :image, :string 42 + add :description, :string 43 + add :description_facets, :map 44 + add :explicit, :boolean 45 + # TODO: table for easier linking? 46 + add :tags, {:array, :string} 47 + add :link, :map 48 + add :created_at, :utc_datetime, null: false 49 + add :released_at, :utc_datetime 50 + timestamps(inserted_at: :indexed_at, updated_at: false) 51 + end 52 + 53 + create index(:tracks, [:did, :rkey]) 54 + 55 + create table(:playlists) do 56 + did_rkey() 57 + add :title, :string, null: false 58 + add :image, :string 59 + add :description, :string 60 + add :description_facets, :map 61 + add :type, :string, null: false 62 + add :tags, {:array, :string} 63 + add :link, :map 64 + add :created_at, :utc_datetime, null: false 65 + timestamps(inserted_at: :indexed_at, updated_at: false) 66 + end 67 + 68 + # TODO: probably still can do unique index on this 69 + create index(:playlists, [:did, :rkey]) 70 + 71 + create table(:playlist_tracks) do 72 + did_rkey() 73 + 74 + add :track_id, references(:tracks), null: false 75 + add :playlist_id, references(:playlists), null: false 76 + 77 + add :position, :integer, null: true 78 + add :created_at, :utc_datetime, null: false 79 + timestamps(inserted_at: :indexed_at, updated_at: false) 80 + end 81 + 82 + create index(:playlist_tracks, [:did, :rkey]) 83 + # create unique_index() 84 + 85 + create table(:likes) do 86 + did_rkey() 87 + # add :subject_did, :string, null: false 88 + add :subject_id, :binary_id, null: false 89 + add :subject_type, :string, null: false 90 + add :created_at, :utc_datetime, null: false 91 + end 92 + 93 + create index(:likes, [:did, :rkey]) 94 + create unique_index(:likes, [:did, :subject_id]) 95 + 96 + create table(:reposts) do 97 + did_rkey() 98 + # add :subject_did, :string, null: false 99 + add :subject_id, :binary_id, null: false 100 + add :subject_type, :string, null: false 101 + add :created_at, :utc_datetime, null: false 102 + end 103 + 104 + create index(:reposts, [:did, :rkey]) 105 + create unique_index(:reposts, [:did, :subject_id]) 106 + 107 + create table(:plays) do 108 + did_rkey() 109 + add :subject, references(:tracks), null: false 110 + add :created_at, :utc_datetime, null: false 111 + end 112 + 113 + create index(:plays, [:did, :rkey]) 114 + 115 + create table(:comments) do 116 + did_rkey() 117 + add :text, :string, null: false 118 + add :subject_id, :binary_id, null: false 119 + add :subject_type, :string, null: false 120 + add :reply_id, references(:comments) 121 + # add :reply, :string 122 + add :langs, {:array, :string} 123 + add :facets, :map 124 + add :created_at, :utc_datetime, null: false 125 + end 126 + 127 + create index(:comments, [:did, :rkey]) 128 + end 129 + end
+15
docker-compose.yml
··· 1 + services: 2 + postgres: 3 + image: postgres:17-alpine 4 + restart: unless-stopped 5 + ports: 6 + - 127.0.0.1:5432:5432 7 + environment: 8 + POSTGRES_DB: comet_dev 9 + POSTGRES_USER: comet 10 + POSTGRES_PASSWORD: comet 11 + volumes: 12 + - postgres:/var/lib/postgresql/data 13 + 14 + volumes: 15 + postgres: